com php-src: Merge branch 'PHP-7.3' into PHP-7.4: ext/pdo/pdo _stmt.c

From: Date: Fri, 05 Apr 2019 23:31:32 +0000
Subject: com php-src: Merge branch 'PHP-7.3' into PHP-7.4: ext/pdo/pdo _stmt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-105541@lists.php.net to get a copy of this message
Commit: 1b85e72032ecf912f6fc50d0704662dfa2cb0292 Author: Joe Watkins <krakjoe@php.net> Sat, 6 Apr 2019 01:30:03 +0200 Parents: 7f4a6b147825eb1d64598075362ba2b8e330216a 0c6a68fa362be996d9a027ef4847c52a6bfa7873 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1b85e72032ecf912f6fc50d0704662dfa2cb0292 Log: Merge branch 'PHP-7.3' into PHP-7.4 * PHP-7.3: Follow up #77849 PDOStatement objects in undefined state after clone Bugs: https://bugs.php.net/77849 Changed paths: MM ext/pdo/pdo_stmt.c Diff: diff --cc ext/pdo/pdo_stmt.c index c3e79f5,873f977..6e0f22c --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@@ -2246,24 -2263,37 +2246,8 @@@ static int dbstmt_compare(zval *object1 return -1; } - static zend_object *dbstmt_clone_obj(zval *zobject) - { - pdo_stmt_t *stmt; - pdo_stmt_t *old_stmt; - - stmt = zend_object_alloc(sizeof(pdo_stmt_t), Z_OBJCE_P(zobject)); - zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject)); - object_properties_init(&stmt->std, Z_OBJCE_P(zobject)); - - old_stmt = Z_PDO_STMT_P(zobject); - - zend_objects_clone_members(&stmt->std, &old_stmt->std); - - return &stmt->std; - } - zend_object_handlers pdo_dbstmt_object_handlers; -static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); - -void pdo_stmt_init(void) -{ - zend_class_entry ce; - - INIT_CLASS_ENTRY(ce, "PDOStatement", pdo_dbstmt_functions); - pdo_dbstmt_ce = zend_register_internal_class(&ce); - pdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get; - pdo_dbstmt_ce->create_object = pdo_dbstmt_new; - zend_class_implements(pdo_dbstmt_ce, 1, zend_ce_traversable); - zend_declare_property_null(pdo_dbstmt_ce, "queryString", sizeof("queryString")-1, ZEND_ACC_PUBLIC); - - memcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); - pdo_dbstmt_object_handlers.offset = XtOffsetOf(pdo_stmt_t, std); - pdo_dbstmt_object_handlers.dtor_obj = zend_objects_destroy_object; - pdo_dbstmt_object_handlers.free_obj = pdo_dbstmt_free_storage; - pdo_dbstmt_object_handlers.write_property = dbstmt_prop_write; - pdo_dbstmt_object_handlers..unset_property = dbstmt_prop_delete; - pdo_dbstmt_object_handlers.get_method = dbstmt_method_get; - pdo_dbstmt_object_handlers.compare_objects = dbstmt_compare; - pdo_dbstmt_object_handlers.clone_obj = NULL; - - INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions); - pdo_row_ce = zend_register_internal_class(&ce); - pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */ - pdo_row_ce->create_object = pdo_row_new; - pdo_row_ce->serialize = pdo_row_serialize; - pdo_row_ce->unserialize = zend_class_unserialize_deny; -} +zend_object_handlers pdo_row_object_handlers; PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt) { @@@ -2646,52 -2705,18 +2630,52 @@@ zend_object *pdo_row_new(zend_class_ent return &row->std; } -static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) +void pdo_stmt_init(void) { - php_error_docref(NULL, E_WARNING, "PDORow instances may not be serialized"); - return FAILURE; -} -/* }}} */ + zend_class_entry ce; -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ + INIT_CLASS_ENTRY(ce, "PDOStatement", pdo_dbstmt_functions); + pdo_dbstmt_ce = zend_register_internal_class(&ce); + pdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get; + pdo_dbstmt_ce->create_object = pdo_dbstmt_new; + pdo_dbstmt_ce->serialize = zend_class_serialize_deny; + pdo_dbstmt_ce->unserialize = zend_class_unserialize_deny; + zend_class_implements(pdo_dbstmt_ce, 1, zend_ce_traversable); + zend_declare_property_null(pdo_dbstmt_ce, "queryString", sizeof("queryString")-1, ZEND_ACC_PUBLIC); + + memcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); + pdo_dbstmt_object_handlers.offset = XtOffsetOf(pdo_stmt_t, std); + pdo_dbstmt_object_handlers.dtor_obj = zend_objects_destroy_object; + pdo_dbstmt_object_handlers.free_obj = pdo_dbstmt_free_storage; + pdo_dbstmt_object_handlers.write_property = dbstmt_prop_write; + pdo_dbstmt_object_handlers.unset_property = dbstmt_prop_delete; + pdo_dbstmt_object_handlers.get_method = dbstmt_method_get; + pdo_dbstmt_object_handlers.compare_objects = dbstmt_compare; - pdo_dbstmt_object_handlers.clone_obj = dbstmt_clone_obj; ++ pdo_dbstmt_object_handlers.clone_obj = NULL; + + INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions); + pdo_row_ce = zend_register_internal_class(&ce); + pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */ + pdo_row_ce->create_object = pdo_row_new; + pdo_row_ce->serialize = zend_class_serialize_deny; + pdo_row_ce->unserialize = zend_class_unserialize_deny; + + memcpy(&pdo_row_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); + pdo_row_object_handlers.free_obj = pdo_row_free_storage; + pdo_row_object_handlers.clone_obj = NULL; + pdo_row_object_handlers.get_property_ptr_ptr = NULL; + pdo_row_object_handlers.read_property = row_prop_read; + pdo_row_object_handlers.write_property = row_prop_write; + pdo_row_object_handlers.has_property = row_prop_exists; + pdo_row_object_handlers.unset_property = row_prop_delete; + pdo_row_object_handlers.read_dimension = row_dim_read; + pdo_row_object_handlers.write_dimension = row_dim_write; + pdo_row_object_handlers.has_dimension = row_dim_exists; + pdo_row_object_handlers.unset_dimension = row_dim_delete; + pdo_row_object_handlers.get_properties_for = row_get_properties_for; + pdo_row_object_handlers.get_method = row_method_get; + pdo_row_object_handlers.call_method = row_call_method; + pdo_row_object_handlers.get_constructor = row_get_ctor; + pdo_row_object_handlers.get_class_name = row_get_classname; + pdo_row_object_handlers.compare_objects = row_compare; +}

« previous php.cvs (#105541) next »