mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
We should keep one refcount to resource
This commit is contained in:
parent
6815c08e29
commit
d5b78cec64
2 changed files with 12 additions and 10 deletions
|
@ -5,13 +5,14 @@ Bug #70398 (SIGSEGV, Segmentation fault zend_ast_destroy_ex)
|
|||
|
||||
define("FILE_STREAM", fopen("php://temp", "r"));
|
||||
|
||||
define("FILE_STREAMS", array(fopen("php://temp", "r")));
|
||||
|
||||
$array = array(
|
||||
fopen("php://temp", "r"),
|
||||
);
|
||||
|
||||
define("FILE_STREAMS", $array);
|
||||
var_dump(FILE_STREAM);
|
||||
var_dump(FILE_STREAMS);
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
--EXPECTF--
|
||||
resource(%d) of type (stream)
|
||||
array(1) {
|
||||
[0]=>
|
||||
resource(%d) of type (stream)
|
||||
}
|
||||
|
|
|
@ -780,10 +780,11 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
|
|||
if (!Z_IMMUTABLE_P(val)) {
|
||||
copy_constant_array(new_val, val);
|
||||
}
|
||||
} else if (Z_TYPE_INFO_P(val) == IS_RESOURCE_EX) {
|
||||
Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
|
||||
} else if (Z_REFCOUNTED_P(val)) {
|
||||
Z_ADDREF_P(val);
|
||||
if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_RESOURCE_EX)) {
|
||||
Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue