Skip to content

Commit

Permalink
remove cloning under ze1_compatibility_mode
Browse files Browse the repository at this point in the history
 - minor BC break but doesnt work right under compat mode anyways
  • Loading branch information
Rob Richards committed Aug 30, 2004
1 parent 02fa5aa commit a501660
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion ext/simplexml/simplexml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,37 @@ static zend_object_handlers sxe_object_handlers = {
NULL
};

static zend_object_handlers sxe_ze1_object_handlers = {
ZEND_OBJECTS_STORE_HANDLERS,
sxe_property_read,
sxe_property_write,
sxe_dimension_read,
sxe_dimension_write,
NULL,
sxe_get_value, /* get */
NULL,
sxe_property_exists,
sxe_property_delete,
sxe_dimension_exists,
sxe_dimension_delete,
sxe_properties_get,
NULL, /* zend_get_std_object_handlers()->get_method,*/
NULL, /* zend_get_std_object_handlers()->call_method,*/
NULL, /* zend_get_std_object_handlers()->get_constructor, */
NULL, /* zend_get_std_object_handlers()->get_class_entry,*/
NULL, /* zend_get_std_object_handlers()->get_class_name,*/
sxe_objects_compare,
sxe_object_cast,
NULL
};

static zend_object_value sxe_object_ze1_clone(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;
}

/* {{{ sxe_object_clone()
*/
static void
Expand Down Expand Up @@ -1207,7 +1238,11 @@ php_sxe_register_object(php_sxe_object *intern TSRMLS_DC)
zend_object_value rv;

rv.handle = zend_objects_store_put(intern, sxe_object_dtor, (zend_objects_free_object_storage_t)sxe_object_free_storage, sxe_object_clone TSRMLS_CC);
rv.handlers = (zend_object_handlers *) &sxe_object_handlers;
if (EG(ze1_compatibility_mode)) {
rv.handlers = (zend_object_handlers *) &sxe_ze1_object_handlers;
} else {
rv.handlers = (zend_object_handlers *) &sxe_object_handlers;
}

return rv;
}
Expand Down Expand Up @@ -1652,6 +1687,12 @@ PHP_MINIT_FUNCTION(simplexml)
sxe_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry;
sxe_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name;

sxe_ze1_object_handlers.get_method = zend_get_std_object_handlers()->get_method;
sxe_ze1_object_handlers.get_constructor = zend_get_std_object_handlers()->get_constructor;
sxe_ze1_object_handlers.get_class_entry = zend_get_std_object_handlers()->get_class_entry;
sxe_ze1_object_handlers.get_class_name = zend_get_std_object_handlers()->get_class_name;
sxe_ze1_object_handlers.clone_obj = sxe_object_ze1_clone;

#if HAVE_SPL && !defined(COMPILE_DL_SPL)
if (zend_get_module_started("spl") == SUCCESS) {
PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);
Expand Down

0 comments on commit a501660

Please sign in to comment.