Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove cloning under ze1_compatibility_mode

 - minor BC break but doesnt work right under compat mode anyways
  • Loading branch information...
commit a50166004d8eb8a196c9397b4c5458114eed83e2 1 parent 02fa5aa
Rob Richards authored
Showing with 42 additions and 1 deletion.
  1. +42 −1 ext/simplexml/simplexml.c
View
43 ext/simplexml/simplexml.c
@@ -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
@@ -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;
}
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.