dmitry Thu, 06 May 2010 08:37:41 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=299060
Log:
Fixed PDO objects binary incompatibility
Changed paths:
U php/php-src/trunk/NEWS
U php/php-src/trunk/ext/pdo/pdo_dbh.c
U php/php-src/trunk/ext/pdo/pdo_stmt.c
U php/php-src/trunk/ext/pdo/php_pdo_driver.h
Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS 2010-05-06 08:14:00 UTC (rev 299059)
+++ php/php-src/trunk/NEWS 2010-05-06 08:37:41 UTC (rev 299060)
@@ -49,7 +49,9 @@
. session_is_registered(), session_register() and session_unregister()
functions. (Kalle)
. y2k_compliance ini option. (Kalle)
-
+
+- Fixed PDO objects binary incompatibility. (Dmitry)
+
?? ??? 20??, PHP 5.3.3
- Upgraded bundled PCRE to version 8.01. (Ilia)
Modified: php/php-src/trunk/ext/pdo/pdo_dbh.c
===================================================================
--- php/php-src/trunk/ext/pdo/pdo_dbh.c 2010-05-06 08:14:00 UTC (rev 299059)
+++ php/php-src/trunk/ext/pdo/pdo_dbh.c 2010-05-06 08:37:41 UTC (rev 299060)
@@ -328,20 +328,20 @@
memcpy((char *)pdbh->persistent_id, hashkey,
plen+1);
pdbh->persistent_id_len = plen+1;
pdbh->refcount = 1;
- pdbh->properties = NULL;
+ pdbh->std.properties = NULL;
}
}
if (pdbh) {
/* let's copy the emalloc bits over from the other
handle */
- if (pdbh->properties) {
- zend_hash_destroy(dbh->properties);
- efree(dbh->properties);
+ if (pdbh->std.properties) {
+ zend_hash_destroy(dbh->std.properties);
+ efree(dbh->std.properties);
} else {
- pdbh->ce = dbh->ce;
+ pdbh->std.ce = dbh->std.ce;
pdbh->def_stmt_ce = dbh->def_stmt_ce;
pdbh->def_stmt_ctor_args =
dbh->def_stmt_ctor_args;
- pdbh->properties = dbh->properties;
+ pdbh->std.properties = dbh->std.properties;
}
/* kill the non-persistent thingamy */
efree(dbh);
@@ -1286,7 +1286,7 @@
ifunc->type = ZEND_INTERNAL_FUNCTION;
ifunc->handler = funcs->handler;
ifunc->function_name = (char*)funcs->fname;
- ifunc->scope = dbh->ce;
+ ifunc->scope = dbh->std.ce;
ifunc->prototype = NULL;
if (funcs->arg_info) {
ifunc->arg_info = (zend_arg_info*)funcs->arg_info + 1;
@@ -1539,16 +1539,12 @@
dbh->methods->rollback(dbh TSRMLS_CC);
dbh->in_txn = 0;
}
-
- if (dbh->properties) {
- zend_hash_destroy(dbh->properties);
- efree(dbh->properties);
- dbh->properties = NULL;
- }
if (dbh->is_persistent && dbh->methods &&
dbh->methods->persistent_shutdown) {
dbh->methods->persistent_shutdown(dbh TSRMLS_CC);
}
+ zend_object_std_dtor(&dbh->std TSRMLS_CC);
+ dbh->std.properties = NULL;
dbh_free(dbh TSRMLS_CC);
}
@@ -1560,11 +1556,9 @@
dbh = emalloc(sizeof(*dbh));
memset(dbh, 0, sizeof(*dbh));
- dbh->ce = ce;
+ zend_object_std_init(&dbh->std, ce TSRMLS_CC);
+ zend_hash_copy(dbh->std.properties, &ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
dbh->refcount = 1;
- ALLOC_HASHTABLE(dbh->properties);
- zend_hash_init(dbh->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(dbh->properties, &ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
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);
Modified: php/php-src/trunk/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/trunk/ext/pdo/pdo_stmt.c 2010-05-06 08:14:00 UTC (rev
299059)
+++ php/php-src/trunk/ext/pdo/pdo_stmt.c 2010-05-06 08:37:41 UTC (rev
299060)
@@ -2319,11 +2319,9 @@
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
stmt = ecalloc(1, sizeof(*stmt));
- stmt->ce = Z_OBJCE_P(zobject);
+ zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject) TSRMLS_CC);
+ zend_hash_copy(stmt->std.properties, &stmt->std.ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
stmt->refcount = 1;
- ALLOC_HASHTABLE(stmt->properties);
- zend_hash_init(stmt->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(stmt->properties, &stmt->ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
old_stmt = (pdo_stmt_t *)zend_object_store_get_object(zobject
TSRMLS_CC);
@@ -2366,12 +2364,6 @@
static void free_statement(pdo_stmt_t *stmt TSRMLS_DC)
{
- if (stmt->properties) {
- zend_hash_destroy(stmt->properties);
- efree(stmt->properties);
- stmt->properties = NULL;
- }
-
if (stmt->bound_params) {
zend_hash_destroy(stmt->bound_params);
FREE_HASHTABLE(stmt->bound_params);
@@ -2420,6 +2412,7 @@
if (stmt->dbh) {
php_pdo_dbh_delref(stmt->dbh TSRMLS_CC);
}
+ zend_object_std_dtor(&stmt->std TSRMLS_CC);
efree(stmt);
}
@@ -2448,11 +2441,9 @@
pdo_stmt_t *stmt;
stmt = emalloc(sizeof(*stmt));
memset(stmt, 0, sizeof(*stmt));
- stmt->ce = ce;
+ zend_object_std_init(&stmt->std, ce TSRMLS_CC);
+ zend_hash_copy(stmt->std.properties, &ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
stmt->refcount = 1;
- ALLOC_HASHTABLE(stmt->properties);
- zend_hash_init(stmt->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(stmt->properties, &ce->default_properties,
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
retval.handle = zend_objects_store_put(stmt,
(zend_objects_store_dtor_t)zend_objects_destroy_object,
(zend_objects_free_object_storage_t)pdo_dbstmt_free_storage,
(zend_objects_store_clone_t)dbstmt_clone_obj TSRMLS_CC);
retval.handlers = &pdo_dbstmt_object_handlers;
@@ -2694,10 +2685,10 @@
MAKE_STD_ZVAL(val);
fetch_value(stmt, val, i, NULL TSRMLS_CC);
- zend_hash_update(stmt->properties, stmt->columns[i].name,
stmt->columns[i].namelen + 1, (void *)&val, sizeof(zval *), NULL);
+ zend_hash_update(stmt->std.properties, stmt->columns[i].name,
stmt->columns[i].namelen + 1, (void *)&val, sizeof(zval *), NULL);
}
- return stmt->properties;
+ return stmt->std.properties;
}
static union _zend_function *row_method_get(
Modified: php/php-src/trunk/ext/pdo/php_pdo_driver.h
===================================================================
--- php/php-src/trunk/ext/pdo/php_pdo_driver.h 2010-05-06 08:14:00 UTC (rev
299059)
+++ php/php-src/trunk/ext/pdo/php_pdo_driver.h 2010-05-06 08:37:41 UTC (rev
299060)
@@ -430,10 +430,7 @@
to allow the extending class to escape all the custom handlers
that PDO declares.
*/
- zend_class_entry *ce;
- HashTable *properties;
- unsigned int in_get:1;
- unsigned int in_set:1;
+ zend_object std;
/* driver specific methods */
struct pdo_dbh_methods *methods;
@@ -548,10 +545,7 @@
to allow the extending class to escape all the custom handlers
that PDO declares.
*/
- zend_class_entry *ce;
- HashTable *properties;
- unsigned int in_get:1;
- unsigned int in_set:1;
+ zend_object std;
/* driver specifics */
struct pdo_stmt_methods *methods;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php