Skip to content

Commit 0b3684c

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix phpGH-16574: Incorrect error "undefined method" messages
2 parents 91e6f26 + e9283c0 commit 0b3684c

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,7 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
36343634
fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (RT_CONSTANT(opline, opline->op2) + 1) : NULL));
36353635
if (UNEXPECTED(fbc == NULL)) {
36363636
if (EXPECTED(!EG(exception))) {
3637-
zend_undefined_method(obj->ce, Z_STR_P(function_name));
3637+
zend_undefined_method(orig_obj->ce, Z_STR_P(function_name));
36383638
}
36393639
FREE_OP2();
36403640
if ((OP1_TYPE & (IS_VAR|IS_TMP_VAR)) && GC_DELREF(orig_obj) == 0) {

Zend/zend_vm_execute.h

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/spl/tests/gh16574.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-16574 (Incorrect error "undefined method" messages)
3+
--CREDITS--
4+
YuanchengJiang
5+
--FILE--
6+
<?php
7+
$i = new ArrayIterator([1,1,1,1,1]);
8+
$i = new CachingIterator($i, CachingIterator::FULL_CACHE);
9+
$i->doesnotexist("x");
10+
?>
11+
--EXPECTF--
12+
Fatal error: Uncaught Error: Call to undefined method CachingIterator::doesnotexist() in %s:%d
13+
Stack trace:
14+
#0 {main}
15+
thrown in %s on line %d

0 commit comments

Comments
 (0)