mirror of
https://github.com/php/php-src.git
synced 2025-01-20 10:43:40 +08:00
Fix identical comparison of arrays with references
Also commit a test I forgot.
This commit is contained in:
parent
f1e1231529
commit
9343f874cd
13
Zend/tests/array_with_refs_identical.phpt
Normal file
13
Zend/tests/array_with_refs_identical.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Identical comparison of array with references
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$foo = 42;
|
||||
$array1 = [&$foo];
|
||||
$array2 = [$foo];
|
||||
var_dump($array1 === $array2);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
15
Zend/tests/throw_reference.phpt
Normal file
15
Zend/tests/throw_reference.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Throw reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$e = new Exception;
|
||||
$ref =& $e;
|
||||
throw $e;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
@ -1890,6 +1890,8 @@ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
|
||||
* whereas this comparison function is expected to return 0 on identity,
|
||||
* and non zero otherwise.
|
||||
*/
|
||||
ZVAL_DEREF(z1);
|
||||
ZVAL_DEREF(z2);
|
||||
if (is_identical_function(&result, z1, z2 TSRMLS_CC)==FAILURE) {
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user