From 42902919bc0f97977e116415c9968dc6b23b12d2 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 12 Jul 2016 11:51:20 +0800 Subject: [PATCH] Fixed bug #72581 (previous property undefined in Exception after deserialization) --- NEWS | 2 ++ Zend/tests/bug72581.phpt | 17 +++++++++++++++++ Zend/zend_exceptions.c | 3 +-- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug72581.phpt diff --git a/NEWS b/NEWS index b2289638ac..437d77feb9 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2016 PHP 7.0.10 - Core: + . Fixed bug #72581 (previous property undefined in Exception after + deserialization). (Laruence) . Fixed bug #72496 (Cannot declare public method with signature incompatible with parent private method). (Pedro Magalhães) . Fixed bug #72024 (microtime() leaks memory). (maroszek at gmx dot net) diff --git a/Zend/tests/bug72581.phpt b/Zend/tests/bug72581.phpt new file mode 100644 index 0000000000..775f6e360d --- /dev/null +++ b/Zend/tests/bug72581.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #72581 (previous property undefined in Exception after deserialization) +--FILE-- +__toString()); +?> +--EXPECTF-- +string(%s) "Exception: aaa in %sbug72581.php:%d +Stack trace: +#0 {main}" diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 663e83f821..374f3045b3 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -291,9 +291,8 @@ ZEND_METHOD(exception, __construct) /* {{{ proto Exception::__wakeup() Exception unserialize checks */ #define CHECK_EXC_TYPE(name, type) \ - ZVAL_UNDEF(&value); \ pvalue = zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &value); \ - if(Z_TYPE_P(pvalue) != IS_UNDEF && Z_TYPE_P(pvalue) != type) { \ + if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \ zval tmp; \ ZVAL_STRINGL(&tmp, name, sizeof(name) - 1); \ Z_OBJ_HANDLER_P(object, unset_property)(object, &tmp, NULL); \ -- 2.50.1