Fix identical comparison of arrays with references

Also commit a test I forgot.
This commit is contained in:
Nikita Popov 2014-05-09 15:46:43 +02:00
parent f1e1231529
commit 9343f874cd
3 changed files with 30 additions and 0 deletions

View 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)

View 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

View File

@ -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;
}