mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
remove cloning under ze1_compatibility_mode
- minor BC break but doesnt work right under compat mode anyways
This commit is contained in:
parent
d39cca1530
commit
02fa5aa0dc
6 changed files with 38 additions and 16 deletions
|
@ -1058,7 +1058,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} end dom_document_get_elements_by_tag_name */
|
/* }}} end dom_document_get_elements_by_tag_name */
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
|
||||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
nsuri = xmlCharStrndup(uri, uri_len);
|
nsuri = xmlCharStrndup(uri, uri_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||||
entityht = (xmlHashTable *) doctypep->entities;
|
entityht = (xmlHashTable *) doctypep->entities;
|
||||||
|
|
||||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||||
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL);
|
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL TSRMLS_CC);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||||
notationht = (xmlHashTable *) doctypep->notations;
|
notationht = (xmlHashTable *) doctypep->notations;
|
||||||
|
|
||||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||||
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL);
|
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL TSRMLS_CC);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,7 +455,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
|
||||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} end dom_element_get_elements_by_tag_name */
|
/* }}} end dom_element_get_elements_by_tag_name */
|
||||||
|
|
||||||
|
@ -777,7 +777,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
|
||||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||||
local = xmlCharStrndup(name, name_len);
|
local = xmlCharStrndup(name, name_len);
|
||||||
nsuri = xmlCharStrndup(uri, uri_len);
|
nsuri = xmlCharStrndup(uri, uri_len);
|
||||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* }}} end dom_element_get_elements_by_tag_name_ns */
|
/* }}} end dom_element_get_elements_by_tag_name_ns */
|
||||||
|
|
|
@ -351,7 +351,7 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||||
} else {
|
} else {
|
||||||
php_dom_create_interator(*retval, DOM_NODELIST TSRMLS_CC);
|
php_dom_create_interator(*retval, DOM_NODELIST TSRMLS_CC);
|
||||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
|
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
@ -529,7 +529,7 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||||
if (nodep->type == XML_ELEMENT_NODE) {
|
if (nodep->type == XML_ELEMENT_NODE) {
|
||||||
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
||||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||||
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL);
|
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(*retval);
|
ZVAL_NULL(*retval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#define PHP_XPTR 2
|
#define PHP_XPTR 2
|
||||||
|
|
||||||
zend_object_handlers dom_object_handlers;
|
zend_object_handlers dom_object_handlers;
|
||||||
|
zend_object_handlers dom_ze1_object_handlers;
|
||||||
|
|
||||||
static HashTable classes;
|
static HashTable classes;
|
||||||
|
|
||||||
|
@ -334,7 +335,7 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||||
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
||||||
|
|
||||||
if (obj->clone == NULL) {
|
if (obj->clone == NULL) {
|
||||||
zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
php_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->clone(obj->object, &new_object TSRMLS_CC);
|
obj->clone(obj->object, &new_object TSRMLS_CC);
|
||||||
|
@ -347,11 +348,26 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zend_object_value dom_objects_ze1_clone_obj(zval *zobject TSRMLS_DC)
|
||||||
|
{
|
||||||
|
php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
|
||||||
|
/* Return zobject->value.obj just to satisfy compiler */
|
||||||
|
return zobject->value.obj;
|
||||||
|
}
|
||||||
|
|
||||||
static zend_function_entry dom_functions[] = {
|
static zend_function_entry dom_functions[] = {
|
||||||
PHP_FE(dom_import_simplexml, NULL)
|
PHP_FE(dom_import_simplexml, NULL)
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
|
||||||
|
if (EG(ze1_compatibility_mode)) {
|
||||||
|
return &dom_ze1_object_handlers;
|
||||||
|
} else {
|
||||||
|
return &dom_object_handlers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
zend_module_entry dom_module_entry = {
|
zend_module_entry dom_module_entry = {
|
||||||
STANDARD_MODULE_HEADER,
|
STANDARD_MODULE_HEADER,
|
||||||
"dom",
|
"dom",
|
||||||
|
@ -380,6 +396,12 @@ PHP_MINIT_FUNCTION(dom)
|
||||||
dom_object_handlers.get_property_ptr_ptr = NULL;
|
dom_object_handlers.get_property_ptr_ptr = NULL;
|
||||||
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
|
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
|
||||||
|
|
||||||
|
memcpy(&dom_ze1_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||||
|
dom_ze1_object_handlers.read_property = dom_read_property;
|
||||||
|
dom_ze1_object_handlers.write_property = dom_write_property;
|
||||||
|
dom_ze1_object_handlers.get_property_ptr_ptr = NULL;
|
||||||
|
dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj;
|
||||||
|
|
||||||
zend_hash_init(&classes, 0, NULL, NULL, 1);
|
zend_hash_init(&classes, 0, NULL, NULL, 1);
|
||||||
|
|
||||||
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
|
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
|
||||||
|
@ -807,7 +829,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns)
|
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC)
|
||||||
{
|
{
|
||||||
dom_nnodemap_object *mapptr;
|
dom_nnodemap_object *mapptr;
|
||||||
zval *baseobj = NULL;
|
zval *baseobj = NULL;
|
||||||
|
@ -818,7 +840,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
|
||||||
baseobj->type = IS_OBJECT;
|
baseobj->type = IS_OBJECT;
|
||||||
baseobj->is_ref = 1;
|
baseobj->is_ref = 1;
|
||||||
baseobj->value.obj.handle = basenode->handle;
|
baseobj->value.obj.handle = basenode->handle;
|
||||||
baseobj->value.obj.handlers = &dom_object_handlers;
|
baseobj->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||||
zval_copy_ctor(baseobj);
|
zval_copy_ctor(baseobj);
|
||||||
}
|
}
|
||||||
mapptr->baseobjptr = baseobj;
|
mapptr->baseobjptr = baseobj;
|
||||||
|
@ -898,7 +920,7 @@ zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||||
|
|
||||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||||
intern->handle = retval.handle;
|
intern->handle = retval.handle;
|
||||||
retval.handlers = &dom_object_handlers;
|
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +937,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||||
|
|
||||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_xpath_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_xpath_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||||
intern->handle = retval.handle;
|
intern->handle = retval.handle;
|
||||||
retval.handlers = &dom_object_handlers;
|
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -979,7 +1001,7 @@ zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_D
|
||||||
|
|
||||||
retval.handle = zend_objects_store_put(intern, dom_nnodemap_object_dtor, (zend_objects_free_object_storage_t)dom_nnodemap_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
retval.handle = zend_objects_store_put(intern, dom_nnodemap_object_dtor, (zend_objects_free_object_storage_t)dom_nnodemap_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||||
intern->handle = retval.handle;
|
intern->handle = retval.handle;
|
||||||
retval.handlers = &dom_object_handlers;
|
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1016,7 +1038,7 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *
|
||||||
return_value->type = IS_OBJECT;
|
return_value->type = IS_OBJECT;
|
||||||
return_value->is_ref = 1;
|
return_value->is_ref = 1;
|
||||||
return_value->value.obj.handle = intern->handle;
|
return_value->value.obj.handle = intern->handle;
|
||||||
return_value->value.obj.handlers = &dom_object_handlers;
|
return_value->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||||
zval_copy_ctor(return_value);
|
zval_copy_ctor(return_value);
|
||||||
*found = 1;
|
*found = 1;
|
||||||
return return_value;
|
return return_value;
|
||||||
|
|
|
@ -104,7 +104,7 @@ int dom_has_feature(char *feature, char *version);
|
||||||
int dom_node_is_read_only(xmlNodePtr node);
|
int dom_node_is_read_only(xmlNodePtr node);
|
||||||
int dom_node_children_valid(xmlNodePtr node);
|
int dom_node_children_valid(xmlNodePtr node);
|
||||||
void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
|
void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
|
||||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns);
|
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC);
|
||||||
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
|
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
|
||||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
|
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
|
||||||
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue