summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2019-01-02 15:32:17 +0800
committerXinchen Hui <laruence@gmail.com>2019-01-02 15:32:17 +0800
commite01f08f679105b5fc80a6e65774731821227b66f (patch)
treea93268969804f93aa94171e9dafebad7772f9d88
parent703ccd5d2738d79e5df1a7f30cff7efd18c9d1bd (diff)
downloadphp-git-e01f08f679105b5fc80a6e65774731821227b66f.tar.gz
Fixed bug #77376 ("undefined function" message no longer includes namespace)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug77376.phpt12
-rw-r--r--Zend/zend_vm_def.h7
-rw-r--r--Zend/zend_vm_execute.h7
4 files changed, 20 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index f106d11787..5ad17e012e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? ????, PHP 7.3.2
- Core:
+ . Fixed bug #77376 ("undefined function" message no longer includes
+ namespace). (Laruence)
. Fixed bug #77339 (__callStatic may get incorrect arguments). (Dmitry)
. Fixed bug #77317 (__DIR__, __FILE__, realpath() reveal physical path for
subst virtual drive). (Anatol)
diff --git a/Zend/tests/bug77376.phpt b/Zend/tests/bug77376.phpt
new file mode 100644
index 0000000000..4f6aec9ce9
--- /dev/null
+++ b/Zend/tests/bug77376.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #77376 ("undefined function" message no longer includes namespace)
+--FILE--
+<?php
+namespace Hello;
+World();
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Call to undefined function Hello\World() %sbug77376.php:%d
+Stack trace:
+#0 {main}
+ thrown in %sbug77376.php on line %d
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 29f7563a2d..a49baa5a9b 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -3443,11 +3443,10 @@ ZEND_VM_HOT_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
fbc = CACHED_PTR(opline->result.num);
if (UNEXPECTED(fbc == NULL)) {
- func_name = RT_CONSTANT(opline, opline->op2) + 1;
- func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
+ func_name = (zval *)RT_CONSTANT(opline, opline->op2);
+ func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
if (func == NULL) {
- func_name++;
- func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
+ func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
if (UNEXPECTED(func == NULL)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_undefined_function_helper, function_name, func_name);
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 5355f7be64..49bc2c0de7 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2153,11 +2153,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_N
fbc = CACHED_PTR(opline->result.num);
if (UNEXPECTED(fbc == NULL)) {
- func_name = RT_CONSTANT(opline, opline->op2) + 1;
- func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
+ func_name = (zval *)RT_CONSTANT(opline, opline->op2);
+ func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
if (func == NULL) {
- func_name++;
- func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
+ func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
if (UNEXPECTED(func == NULL)) {
ZEND_VM_TAIL_CALL(zend_undefined_function_helper_SPEC(func_name ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}