]> granicus.if.org Git - php/commitdiff
Final ze1_compat restoration - it was mostly done by hand, so if anybody
authorZeev Suraski <zeev@php.net>
Mon, 5 Jun 2006 16:53:21 +0000 (16:53 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 5 Jun 2006 16:53:21 +0000 (16:53 +0000)
spots any (new) problems, let me know.  Test wise, the same tests that
failed before are failing now.

ext/dom/php_dom.c
ext/simplexml/simplexml.c

index 80437a13e34a626c3c2248fcb575ca84e195967a..038529e0d4f998e4b94d9d17a9cebc412c4bed9c 100644 (file)
@@ -69,6 +69,7 @@ zend_class_entry *dom_xpath_class_entry;
 zend_class_entry *dom_namespace_node_class_entry;
 
 zend_object_handlers dom_object_handlers;
+zend_object_handlers dom_ze1_object_handlers;
 
 static HashTable classes;
 
@@ -490,12 +491,25 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
        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[] = {
        PHP_FE(dom_import_simplexml, 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;
+       }
        return &dom_object_handlers;
 }
 
@@ -535,6 +549,13 @@ PHP_MINIT_FUNCTION(dom)
        dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
        dom_object_handlers.has_property = dom_property_exists;
 
+       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_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr;
+       dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj;
+       dom_ze1_object_handlers.has_property = dom_property_exists;
+
        zend_hash_init(&classes, 0, NULL, NULL, 1);
 
        INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
index 62e2b7c5c771e129ab4bad09358f540e493168b0..f1e2b1dcfa749577a16f2452db6c6d7883f0d2c0 100644 (file)
@@ -1689,6 +1689,38 @@ static zend_object_handlers sxe_object_handlers = {
        sxe_count_elements
 };
 
+static zend_object_handlers sxe_ze1_object_handlers = {
+       ZEND_OBJECTS_STORE_HANDLERS,
+       sxe_property_read,
+       sxe_property_write,
+       sxe_dimension_read,
+       sxe_dimension_write,
+       sxe_property_get_adr,
+       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,
+       sxe_count_elements
+};
+
+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 */
+       /* FIXME: Should not be a fatal */
+       return zobject->value.obj;
+}
+
 /* {{{ sxe_object_clone()
  */
 static void
@@ -2239,6 +2271,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;
+
 #ifdef HAVE_SPL
        if (zend_get_module_started("spl") == SUCCESS) {
                PHP_MINIT(spl_sxe)(INIT_FUNC_ARGS_PASSTHRU);