1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00

Merge branch 'PHP-7.0'

* PHP-7.0:
  Fixed bug #71603 (compact() maintains references in php7)
This commit is contained in:
Xinchen Hui
2016-02-16 11:03:09 +08:00
2 changed files with 16 additions and 0 deletions
+1
View File
@@ -1938,6 +1938,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
ZVAL_DEREF(entry);
if (Z_TYPE_P(entry) == IS_STRING) {
if ((value_ptr = zend_hash_find_ind(eg_active_symbol_table, Z_STR_P(entry))) != NULL) {
ZVAL_DEREF(value_ptr);
ZVAL_COPY(&data, value_ptr);
zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
}
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #71603 (compact() maintains references in php7)
--FILE--
<?php
$foo = "okey";
$foo_reference =& $foo;
$array = compact('foo_reference');
$foo = 'changed!';
var_dump($array['foo_reference']);
--EXPECT--
string(4) "okey"