1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 19:14:16 +02:00

Merge branch 'PHP-7.3'

This commit is contained in:
Nikita Popov
2018-10-08 13:16:54 +02:00
2 changed files with 25 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
--TEST--
Reference IDs should be correctly generated when $GLOBALS is serialized
--FILE--
<?php
$obj = new stdClass;
$obj2 = new stdClass;
$obj2->obj = $obj;
$s = serialize($GLOBALS);
$globals = unserialize($s);
var_dump($obj);
var_dump($obj2);
?>
--EXPECT--
object(stdClass)#1 (0) {
}
object(stdClass)#2 (1) {
["obj"]=>
object(stdClass)#1 (0) {
}
}

View File

@@ -959,9 +959,9 @@ again:
/* we should still add element even if it's not OK,
* since we already wrote the length of the array before */
if (Z_TYPE_P(data) == IS_ARRAY) {
if (Z_TYPE_P(data) == IS_ARRAY
&& (UNEXPECTED(Z_IS_RECURSIVE_P(data))
|| UNEXPECTED(Z_TYPE_P(struc) == IS_ARRAY && Z_ARR_P(data) == Z_ARR_P(struc)))) {
if (UNEXPECTED(Z_IS_RECURSIVE_P(data))
|| UNEXPECTED(Z_TYPE_P(struc) == IS_ARRAY && Z_ARR_P(data) == Z_ARR_P(struc))) {
php_add_var_hash(var_hash, struc);
smart_str_appendl(buf, "N;", 2);
} else {
if (Z_REFCOUNTED_P(data)) {