Skip to content

Commit e01f08f

Browse files
committed
Fixed bug #77376 ("undefined function" message no longer includes namespace)
1 parent 703ccd5 commit e01f08f

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? ????, PHP 7.3.2
44

55
- Core:
6+
. Fixed bug #77376 ("undefined function" message no longer includes
7+
namespace). (Laruence)
68
. Fixed bug #77339 (__callStatic may get incorrect arguments). (Dmitry)
79
. Fixed bug #77317 (__DIR__, __FILE__, realpath() reveal physical path for
810
subst virtual drive). (Anatol)

Zend/tests/bug77376.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #77376 ("undefined function" message no longer includes namespace)
3+
--FILE--
4+
<?php
5+
namespace Hello;
6+
World();
7+
?>
8+
--EXPECTF--
9+
Fatal error: Uncaught Error: Call to undefined function Hello\World() %sbug77376.php:%d
10+
Stack trace:
11+
#0 {main}
12+
thrown in %sbug77376.php on line %d

Zend/zend_vm_def.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,11 +3443,10 @@ ZEND_VM_HOT_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
34433443

34443444
fbc = CACHED_PTR(opline->result.num);
34453445
if (UNEXPECTED(fbc == NULL)) {
3446-
func_name = RT_CONSTANT(opline, opline->op2) + 1;
3447-
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
3446+
func_name = (zval *)RT_CONSTANT(opline, opline->op2);
3447+
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
34483448
if (func == NULL) {
3449-
func_name++;
3450-
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
3449+
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
34513450
if (UNEXPECTED(func == NULL)) {
34523451
ZEND_VM_DISPATCH_TO_HELPER(zend_undefined_function_helper, function_name, func_name);
34533452
}

Zend/zend_vm_execute.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,11 +2153,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_N
21532153

21542154
fbc = CACHED_PTR(opline->result.num);
21552155
if (UNEXPECTED(fbc == NULL)) {
2156-
func_name = RT_CONSTANT(opline, opline->op2) + 1;
2157-
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
2156+
func_name = (zval *)RT_CONSTANT(opline, opline->op2);
2157+
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 1), 1);
21582158
if (func == NULL) {
2159-
func_name++;
2160-
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
2159+
func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name + 2), 1);
21612160
if (UNEXPECTED(func == NULL)) {
21622161
ZEND_VM_TAIL_CALL(zend_undefined_function_helper_SPEC(func_name ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
21632162
}

0 commit comments

Comments
 (0)