diff options
Diffstat (limited to 'ext/pdo/pdo_dbh.c')
| -rw-r--r-- | ext/pdo/pdo_dbh.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index afca2d1cfb..9fbfc1ff57 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -359,18 +359,11 @@ static PHP_METHOD(PDO, dbh_constructor) /* all set */ if (is_persistent) { - zend_resource le; - /* register in the persistent list etc. */ /* we should also need to replace the object store entry, since it was created with emalloc */ - - le.type = php_pdo_list_entry(); - le.ptr = dbh; - GC_REFCOUNT(&le) = 1; - - if ((zend_hash_str_update_mem(&EG(persistent_list), - (char*)dbh->persistent_id, dbh->persistent_id_len, &le, sizeof(le))) == NULL) { + if ((zend_register_persistent_resource( + (char*)dbh->persistent_id, dbh->persistent_id_len, dbh, php_pdo_list_entry())) == NULL) { php_error_docref(NULL, E_ERROR, "Failed to register persistent entry"); } } @@ -449,7 +442,6 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt zend_fcall_info_args(&fci, ctor_args); - fcc.initialized = 1; fcc.function_handler = dbstmt_ce->constructor; fcc.calling_scope = zend_get_executed_scope(); fcc.called_scope = Z_OBJCE_P(object); @@ -880,7 +872,7 @@ static PHP_METHOD(PDO, getAttribute) array_init(return_value); add_next_index_str(return_value, zend_string_copy(dbh->def_stmt_ce->name)); if (!Z_ISUNDEF(dbh->def_stmt_ctor_args)) { - if (Z_REFCOUNTED(dbh->def_stmt_ctor_args)) Z_ADDREF(dbh->def_stmt_ctor_args); + Z_TRY_ADDREF(dbh->def_stmt_ctor_args); add_next_index_zval(return_value, &dbh->def_stmt_ctor_args); } return; @@ -1352,9 +1344,6 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m pdo_dbh_object_t *dbh_obj = php_pdo_dbh_fetch_object(*object); zend_string *lc_method_name; - lc_method_name = zend_string_init(ZSTR_VAL(method_name), ZSTR_LEN(method_name), 0); - zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name)); - if ((fbc = std_object_handlers.get_method(object, method_name, key)) == NULL) { /* not a pre-defined method, nor a user-defined method; check * the driver specific methods */ @@ -1366,11 +1355,12 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m } } + lc_method_name = zend_string_tolower(method_name); fbc = zend_hash_find_ptr(dbh_obj->inner->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH], lc_method_name); + zend_string_release(lc_method_name); } out: - zend_string_release(lc_method_name); return fbc; } @@ -1561,7 +1551,7 @@ zend_object *pdo_dbh_new(zend_class_entry *ce) { pdo_dbh_object_t *dbh; - dbh = ecalloc(1, sizeof(pdo_dbh_object_t) + zend_object_properties_size(ce)); + dbh = zend_object_alloc(sizeof(pdo_dbh_object_t), ce); zend_object_std_init(&dbh->std, ce); object_properties_init(&dbh->std, ce); rebuild_object_properties(&dbh->std); |
