From 7903276f4c18fcfda06c02785f0b4201421f9c7c Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 12 Jul 2016 12:14:45 +0800 Subject: [PATCH] backport to 5.6 (we should not unset the default value) --- NEWS | 2 ++ Zend/zend_exceptions.c | 2 +- ext/standard/tests/serialize/bug69152.phpt | 1 - ext/standard/tests/serialize/bug69793.phpt | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 2b21a03c0ee1..5da0c578ebd8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2016, PHP 5.6.25 - Core: + . Fixed bug #72581 (previous property undefined in Exception after + deserialization). (Laruence) . Fixed bug #72024 (microtime() leaks memory). (maroszek at gmx dot net) - Curl: diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 66476a15172f..fda4d21e032b 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -230,7 +230,7 @@ ZEND_METHOD(exception, __construct) Exception unserialize checks */ #define CHECK_EXC_TYPE(name, type) \ value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \ - if(value && Z_TYPE_P(value) != type) { \ + if (value && Z_TYPE_P(value) != IS_NULL && Z_TYPE_P(value) != type) { \ zval *tmp; \ MAKE_STD_ZVAL(tmp); \ ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \ diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt index bc2b302ddb75..4e741685ccd0 100644 --- a/ext/standard/tests/serialize/bug69152.phpt +++ b/ext/standard/tests/serialize/bug69152.phpt @@ -9,7 +9,6 @@ $x->test(); ?> --EXPECTF-- -Notice: Undefined property: Exception::$previous in %s on line %d exception 'Exception' in %s:%d Stack trace: #0 {main} diff --git a/ext/standard/tests/serialize/bug69793.phpt b/ext/standard/tests/serialize/bug69793.phpt index 624f1ac74010..b5784b89eb35 100644 --- a/ext/standard/tests/serialize/bug69793.phpt +++ b/ext/standard/tests/serialize/bug69793.phpt @@ -7,8 +7,6 @@ $e = unserialize('O:9:"Exception":7:{s:17:"'."\0".'Exception'."\0".'string";s:1: var_dump($e.""); ?> --EXPECTF-- -Notice: Undefined property: Exception::$message in %s%ebug69793.php on line %d - Notice: Undefined property: Exception::$file in %s%ebug69793.php on line %d Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d