From: Bob Weinand Date: Fri, 7 Aug 2015 22:02:49 +0000 (+0200) Subject: Fixed bug #70208 (Assert breaking access on objects) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7aac1f5f2d1f072fa52b0bbedce1ac7d20ae789;p=php Fixed bug #70208 (Assert breaking access on objects) --- diff --git a/NEWS b/NEWS index 0908a2db95..22371a511d 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 20 Aug 2015, PHP 7.0.0 RC 1 - +- Standard: + . Fixed bug #70208 (Assert breaking access on objects). (Bob) 06 Aug 2015, PHP 7.0.0 Beta 3 diff --git a/Zend/tests/assert/bug70208.phpt b/Zend/tests/assert/bug70208.phpt new file mode 100644 index 0000000000..ec9325334c --- /dev/null +++ b/Zend/tests/assert/bug70208.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #70208 (scope information must be preserved with assert()) +--FILE-- +prop); + } +} + +new test; + +?> +--EXPECT-- +int(1) diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 61dd286d6d..545c099877 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -164,6 +164,7 @@ PHP_FUNCTION(assert) if (Z_TYPE_P(assertion) == IS_STRING) { zval retval; int old_error_reporting = 0; /* shut up gcc! */ + zend_class_entry *orig_scope = EG(scope); myeval = Z_STRVAL_P(assertion); @@ -193,6 +194,8 @@ PHP_FUNCTION(assert) EG(error_reporting) = old_error_reporting; } + EG(scope) = orig_scope; + convert_to_boolean(&retval); val = Z_TYPE(retval) == IS_TRUE; } else {