mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
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:
commit
aef65393be
3 changed files with 35 additions and 3 deletions
4
NEWS
4
NEWS
|
@ -14,6 +14,10 @@ PHP NEWS
|
||||||
classes). (ilutov)
|
classes). (ilutov)
|
||||||
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
|
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
|
||||||
|
|
||||||
|
- MySQLi:
|
||||||
|
. Fixed bug GH-8068 (mysqli_fetch_object creates inaccessible properties).
|
||||||
|
(cmb)
|
||||||
|
|
||||||
- Pcntl:
|
- Pcntl:
|
||||||
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
|
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
|
||||||
|
|
||||||
|
|
|
@ -1155,11 +1155,13 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||||
ZVAL_COPY_VALUE(&dataset, return_value);
|
ZVAL_COPY_VALUE(&dataset, return_value);
|
||||||
|
|
||||||
object_init_ex(return_value, ce);
|
object_init_ex(return_value, ce);
|
||||||
if (!ce->default_properties_count && !ce->__set) {
|
HashTable *prop_table = zend_symtable_to_proptable(Z_ARR(dataset));
|
||||||
Z_OBJ_P(return_value)->properties = Z_ARR(dataset);
|
|
||||||
} else {
|
|
||||||
zend_merge_properties(return_value, Z_ARRVAL(dataset));
|
|
||||||
zval_ptr_dtor(&dataset);
|
zval_ptr_dtor(&dataset);
|
||||||
|
if (!ce->default_properties_count && !ce->__set) {
|
||||||
|
Z_OBJ_P(return_value)->properties = prop_table;
|
||||||
|
} else {
|
||||||
|
zend_merge_properties(return_value, prop_table);
|
||||||
|
zend_array_release(prop_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ce->constructor) {
|
if (ce->constructor) {
|
||||||
|
|
26
ext/mysqli/tests/gh8068.phpt
Normal file
26
ext/mysqli/tests/gh8068.phpt
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
--TEST--
|
||||||
|
GH-8068 (mysqli_fetch_object creates inaccessible properties)
|
||||||
|
--EXTENSION--
|
||||||
|
mysqli
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
require_once 'skipifconnectfailure.inc';
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
require_once "connect.inc";
|
||||||
|
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||||
|
$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
$res = $mysqli->query('SELECT 42');
|
||||||
|
$obj = $res->fetch_object();
|
||||||
|
var_dump(
|
||||||
|
$obj,
|
||||||
|
$obj->{42}
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
object(stdClass)#4 (1) {
|
||||||
|
["42"]=>
|
||||||
|
string(2) "42"
|
||||||
|
}
|
||||||
|
string(2) "42"
|
Loading…
Add table
Add a link
Reference in a new issue