From: Xinchen Hui Date: Sun, 20 Sep 2015 02:49:36 +0000 (-0700) Subject: Fixed bug #70528 (assert() with instanceof adds apostrophes around class name) X-Git-Tag: php-7.1.0alpha2~40^2~46^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb07905a4a34e3e7d6f1ebe94818dd88ba951dcb;p=php Fixed bug #70528 (assert() with instanceof adds apostrophes around class name) --- diff --git a/NEWS b/NEWS index ac0d0506ef..eeeadbcfd9 100644 --- a/NEWS +++ b/NEWS @@ -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-- + +--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 ");