tony2001                Tue Jun  6 22:05:56 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/pdo    pdo_dbh.c 
  Log:
  yet another dummy clone_obj handler to fix problems created by ze1 compat mode
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.82.2.31.2.1&r2=1.82.2.31.2.2&diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.1 
php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.2
--- php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.1     Thu May 11 22:43:44 2006
+++ php-src/ext/pdo/pdo_dbh.c   Tue Jun  6 22:05:56 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.1 2006/05/11 22:43:44 helly Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.2 2006/06/06 22:05:56 tony2001 Exp $ */
 
 /* The PDO Database Handle Class */
 
@@ -1251,7 +1251,14 @@
        return -1;
 }
 
+static zend_object_value dbh_ze1_clone_obj(zval *object TSRMLS_DC)
+{
+       php_error(E_ERROR, "Cannot clone object of class %s due to 
'zend.ze1_compatibility_mode'", Z_OBJCE_P(object)->name);
+       return object->value.obj;
+}
+
 static zend_object_handlers pdo_dbh_object_handlers;
+static zend_object_handlers pdo_dbh_object_handlers_ze1;
 
 void pdo_dbh_init(TSRMLS_D)
 {
@@ -1264,6 +1271,11 @@
        memcpy(&pdo_dbh_object_handlers, &std_object_handlers, 
sizeof(zend_object_handlers));
        pdo_dbh_object_handlers.get_method = dbh_method_get;
        pdo_dbh_object_handlers.compare_objects = dbh_compare;
+       
+       memcpy(&pdo_dbh_object_handlers_ze1, &std_object_handlers, 
sizeof(zend_object_handlers));
+       pdo_dbh_object_handlers_ze1.get_method = dbh_method_get;
+       pdo_dbh_object_handlers_ze1.compare_objects = dbh_compare;
+       pdo_dbh_object_handlers_ze1.clone_obj = dbh_ze1_clone_obj;
 
        REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (long)PDO_PARAM_BOOL);
        REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (long)PDO_PARAM_NULL);
@@ -1447,7 +1459,7 @@
        dbh->def_stmt_ce = pdo_dbstmt_ce;
        
        retval.handle = zend_objects_store_put(dbh, 
(zend_objects_store_dtor_t)zend_objects_destroy_object, 
(zend_objects_free_object_storage_t)pdo_dbh_free_storage, NULL TSRMLS_CC);
-       retval.handlers = &pdo_dbh_object_handlers;
+       retval.handlers = EG(ze1_compatibility_mode) ? 
&pdo_dbh_object_handlers_ze1 : &pdo_dbh_object_handlers;
        
        return retval;
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to