summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/assert/bug70528.phpt23
-rw-r--r--Zend/zend_ast.c6
3 files changed, 30 insertions, 1 deletions
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--
+<?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 ");