From: Nikita Popov Date: Fri, 9 May 2014 13:46:43 +0000 (+0200) Subject: Fix identical comparison of arrays with references X-Git-Tag: POST_PHPNG_MERGE~384^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9343f874cd9e1a006c897c1dc8d5a334e73af942;p=php Fix identical comparison of arrays with references Also commit a test I forgot. --- diff --git a/Zend/tests/array_with_refs_identical.phpt b/Zend/tests/array_with_refs_identical.phpt new file mode 100644 index 0000000000..a7c6567189 --- /dev/null +++ b/Zend/tests/array_with_refs_identical.phpt @@ -0,0 +1,13 @@ +--TEST-- +Identical comparison of array with references +--FILE-- + +--EXPECT-- +bool(true) diff --git a/Zend/tests/throw_reference.phpt b/Zend/tests/throw_reference.phpt new file mode 100644 index 0000000000..f02eaa6540 --- /dev/null +++ b/Zend/tests/throw_reference.phpt @@ -0,0 +1,15 @@ +--TEST-- +Throw reference +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 4093a8adea..9cf0497d22 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -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; }