From 9343f874cd9e1a006c897c1dc8d5a334e73af942 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 9 May 2014 15:46:43 +0200 Subject: [PATCH] Fix identical comparison of arrays with references Also commit a test I forgot. --- Zend/tests/array_with_refs_identical.phpt | 13 +++++++++++++ Zend/tests/throw_reference.phpt | 15 +++++++++++++++ Zend/zend_operators.c | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 Zend/tests/array_with_refs_identical.phpt create mode 100644 Zend/tests/throw_reference.phpt diff --git a/Zend/tests/array_with_refs_identical.phpt b/Zend/tests/array_with_refs_identical.phpt new file mode 100644 index 00000000000..a7c6567189b --- /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 00000000000..f02eaa6540d --- /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 4093a8adea2..9cf0497d220 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; }