php-src/Zend/tests/call_user_func_by_ref.phpt
Nikita Popov 01453a0af7 Fix SEND_USER with ref arg
Even though the input is not a reference (or not treated as such),
we still need to create a reference to satisfy the function
signature. Various code relies on reference arguments actually
being references. In this particular case, it would result in
a JIT crash.

The zend_call_function() implementation already handled this
correctly.
2021-09-17 12:17:33 +02:00

18 lines
391 B
PHP

--TEST--
call_user_func() with ref arg and type check
--FILE--
<?php
function test(Type &$ref) {
}
try {
call_user_func('test', 0);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: test(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
test(): Argument #1 ($ref) must be of type Type, int given, called in %s on line %d