Skip to content

Commit 8755976

Browse files
committed
Fix arginfo/zpp consistency check for call_user_func from strict_types scope
This was using the wrong strict_types information. In this case the call is performed with strict_types=0.
1 parent 6e20f0f commit 8755976

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Arginfo / zpp consistency check for call_user_func() in strict context
3+
--FILE--
4+
<?php
5+
declare(strict_types=1);
6+
7+
namespace Foo;
8+
9+
// strlen() will be called with strict_types=0, so this is legal.
10+
var_dump(call_user_func('strlen', false));
11+
12+
?>
13+
--EXPECT--
14+
int(0)

Zend/zend_execute_API.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,12 +886,12 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
886886
EG(jit_trace_num) = orig_jit_trace_num;
887887
} else {
888888
ZEND_ASSERT(func->type == ZEND_INTERNAL_FUNCTION);
889-
#if ZEND_DEBUG
890-
bool should_throw = zend_internal_call_should_throw(func, call);
891-
#endif
892889
ZVAL_NULL(fci->retval);
893890
call->prev_execute_data = EG(current_execute_data);
894891
EG(current_execute_data) = call;
892+
#if ZEND_DEBUG
893+
bool should_throw = zend_internal_call_should_throw(func, call);
894+
#endif
895895
if (EXPECTED(zend_execute_internal == NULL)) {
896896
/* saves one function call if zend_execute_internal is not used */
897897
func->internal_function.handler(call, fci->retval);

0 commit comments

Comments
 (0)