]> granicus.if.org Git - php/commitdiff
Fix ('\bar')() in namespace
authorNikita Popov <nikic@php.net>
Sun, 1 May 2016 11:04:08 +0000 (13:04 +0200)
committerNikita Popov <nikic@php.net>
Sun, 1 May 2016 11:05:14 +0000 (13:05 +0200)
Zend/tests/dynamic_fully_qualified_call.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/dynamic_fully_qualified_call.phpt b/Zend/tests/dynamic_fully_qualified_call.phpt
new file mode 100644 (file)
index 0000000..cca6fa3
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Crash when using dynamic call syntax with fully qualified name in a namespace
+--FILE--
+<?php
+
+namespace Foo;
+try {
+    ('\bar')();
+} catch (\Error $e) {
+    echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Call to undefined function bar()
index fb196f04b54a9b4e9bc7a3de58900d6396e52b21..c79f1d75f69aa7859ff76410cc489fd4494d3b74 100644 (file)
@@ -773,6 +773,7 @@ zend_string *zend_resolve_non_class_name(
 
        if (ZSTR_VAL(name)[0] == '\\') {
                /* Remove \ prefix (only relevant if this is a string rather than a label) */
+               *is_fully_qualified = 1;
                return zend_string_init(ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1, 0);
        }