summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/dynamic_fully_qualified_call.phpt15
-rw-r--r--Zend/zend_compile.c1
-rw-r--r--ext/posix/posix.c2
3 files changed, 17 insertions, 1 deletions
diff --git a/Zend/tests/dynamic_fully_qualified_call.phpt b/Zend/tests/dynamic_fully_qualified_call.phpt
new file mode 100644
index 0000000000..cca6fa38b6
--- /dev/null
+++ b/Zend/tests/dynamic_fully_qualified_call.phpt
@@ -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()
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index fb196f04b5..c79f1d75f6 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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);
}
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 25cb26f372..771e316325 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -987,7 +987,7 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
array_init(&array_members);
add_assoc_string(array_group, "name", g->gr_name);
- if (array_group->gr_passwd) {
+ if (g->gr_passwd) {
add_assoc_string(array_group, "passwd", g->gr_passwd);
} else {
add_assoc_null(array_group, "passwd");