Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-8068: mysqli_fetch_object creates inaccessible properties
This commit is contained in:
Christoph M. Becker 2022-03-14 14:28:35 +01:00
commit aef65393be
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
3 changed files with 35 additions and 3 deletions

View file

@ -1155,11 +1155,13 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
ZVAL_COPY_VALUE(&dataset, return_value);
object_init_ex(return_value, ce);
HashTable *prop_table = zend_symtable_to_proptable(Z_ARR(dataset));
zval_ptr_dtor(&dataset);
if (!ce->default_properties_count && !ce->__set) {
Z_OBJ_P(return_value)->properties = Z_ARR(dataset);
Z_OBJ_P(return_value)->properties = prop_table;
} else {
zend_merge_properties(return_value, Z_ARRVAL(dataset));
zval_ptr_dtor(&dataset);
zend_merge_properties(return_value, prop_table);
zend_array_release(prop_table);
}
if (ce->constructor) {