diff options
| author | Xinchen Hui <laruence@gmail.com> | 2015-09-19 19:49:36 -0700 |
|---|---|---|
| committer | Xinchen Hui <laruence@gmail.com> | 2015-09-19 19:49:36 -0700 |
| commit | bb07905a4a34e3e7d6f1ebe94818dd88ba951dcb (patch) | |
| tree | 173ac866eb7aee56aea7b0c8022b7411062673ea | |
| parent | 509712c7d9056b4ceb50134bfeea1a1115720744 (diff) | |
| download | php-git-bb07905a4a34e3e7d6f1ebe94818dd88ba951dcb.tar.gz | |
Fixed bug #70528 (assert() with instanceof adds apostrophes around class name)
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | Zend/tests/assert/bug70528.phpt | 23 | ||||
| -rw-r--r-- | Zend/zend_ast.c | 6 |
3 files changed, 30 insertions, 1 deletions
@@ -3,6 +3,8 @@ PHP NEWS 01 Oct 2015, PHP 7.0.0 RC 4 - Core: + . Fixed bug #70528 (assert() with instanceof adds apostrophes around class + name). (Laruence) . Fixed bug #70481 (Memory leak in auto_global_copy_ctor() in ZTS build). (Laruence) diff --git a/Zend/tests/assert/bug70528.phpt b/Zend/tests/assert/bug70528.phpt new file mode 100644 index 0000000000..1b5803859c --- /dev/null +++ b/Zend/tests/assert/bug70528.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #70528 (assert() with instanceof adds apostrophes around class name) +--INI-- +zend.assertions=1 +assert.exception=0 +assert.warning=1 +--FILE-- +<?php + +namespace Foo; +class Bar {} + +$bar = "Bar"; +assert(new \stdClass instanceof $bar); +assert(new \stdClass instanceof Bar); +assert(new \stdClass instanceof \Foo\Bar); +?> +--EXPECTF-- +Warning: assert(): assert(new \stdClass() instanceof $bar) failed in %sbug70528.php on line %d + +Warning: assert(): assert(new \stdClass() instanceof Bar) failed in %sbug70528.php on line %d + +Warning: assert(): assert(new \stdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index d36ce0b2ad..9dadd35d6a 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1349,7 +1349,11 @@ simple_list: zend_ast_export_ex(str, ast->child[1], 0, indent); smart_str_appendc(str, ')'); break; - case ZEND_AST_INSTANCEOF: BINARY_OP(" instanceof ", 230, 231, 231); + case ZEND_AST_INSTANCEOF: + zend_ast_export_ex(str, ast->child[0], 0, indent); + smart_str_appends(str, " instanceof "); + zend_ast_export_ns_name(str, ast->child[1], 0, indent); + break; case ZEND_AST_YIELD: if (priority > 70) smart_str_appendc(str, '('); smart_str_appends(str, "yield "); |
