com php-src: Fixed bug #70208 (Assert breaking access on objects): NEWS Zend/tests/assert/bug70208.phpt ext/standard/assert.c
| From: | Anatol Belski | Date: | Fri, 07 Aug 2015 22:02:49 +0000 |
| Subject: | com php-src: Fixed bug #70208 (Assert breaking access on objects): NEWS Zend/tests/assert/bug70208.phpt ext/standard/assert.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88632@lists.php.net to get a copy of this message | ||
Commit: b7aac1f5f2d1f072fa52b0bbedce1ac7d20ae789
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 8 Aug 2015 00:02:49 +0200
Parents: cc53406747b99fec9518c71aee25161c156af1f1
Branches: PHP-7.0.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b7aac1f5f2d1f072fa52b0bbedce1ac7d20ae789
Log:
Fixed bug #70208 (Assert breaking access on objects)
Bugs:
https://bugs.php.net/70208
Changed paths:
M NEWS
A Zend/tests/assert/bug70208.phpt
M ext/standard/assert.c
Diff:
diff --git a/NEWS b/NEWS
index 0908a2d..22371a5 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 0000000..ec93253
--- /dev/null
+++ b/Zend/tests/assert/bug70208.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #70208 (scope information must be preserved with assert())
+--FILE--
+<?php
+
+function non_class_scope() {
+ return true;
+}
+
+class test {
+ protected $prop = 1;
+
+ public function __construct() {
+ assert('non_class_scope();');
+ var_dump($this->prop);
+ }
+}
+
+new test;
+
+?>
+--EXPECT--
+int(1)
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 61dd286..545c099 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 {