mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix misleading pass by reference error message (#10639)
This commit is contained in:
parent
9bcdf219ec
commit
c322da0606
22 changed files with 31 additions and 31 deletions
|
@ -25,6 +25,6 @@ function test(&$param) {
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
test(): Argument #1 ($param) cannot be passed by reference
|
||||
test(): Argument #1 ($param) cannot be passed by reference
|
||||
test(): Argument #1 ($param) could not be passed by reference
|
||||
test(): Argument #1 ($param) could not be passed by reference
|
||||
int(1)
|
||||
|
|
|
@ -12,7 +12,7 @@ change(list($val) = $array);
|
|||
var_dump($array);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: change(): Argument #1 ($ref) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: change(): Argument #1 ($ref) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -22,5 +22,5 @@ namespace Foo {
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference
|
||||
Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference
|
||||
Exception: similar_text(): Argument #3 ($percent) could not be passed by reference
|
||||
Exception: similar_text(): Argument #3 ($percent) could not be passed by reference
|
||||
|
|
|
@ -5,7 +5,7 @@ Bug #79783: Segfault in php_str_replace_common
|
|||
str_replace("a", "b", "c", strlen("d"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: str_replace(): Argument #4 ($count) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: str_replace(): Argument #4 ($count) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -26,7 +26,7 @@ int(9)
|
|||
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
||||
int(81)
|
||||
|
||||
Fatal error: Uncaught Error: {closure}(): Argument #1 ($x) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: {closure}(): Argument #1 ($x) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): test()
|
||||
#1 {main}
|
||||
|
|
|
@ -11,7 +11,7 @@ foo(1);
|
|||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: foo(): Argument #1 ($var) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: foo(): Argument #1 ($var) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -30,7 +30,7 @@ main();
|
|||
usesValue 0
|
||||
i is 0
|
||||
|
||||
Fatal error: Uncaught Error: Test::usesRef(): Argument #1 ($x) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: Test::usesRef(): Argument #1 ($x) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): main()
|
||||
#1 {main}
|
||||
|
|
|
@ -34,4 +34,4 @@ try {
|
|||
usesValue 42
|
||||
usesValue 42
|
||||
int(42)
|
||||
Caught Test::usesRef(): Argument #1 ($x) cannot be passed by reference
|
||||
Caught Test::usesRef(): Argument #1 ($x) could not be passed by reference
|
||||
|
|
|
@ -10,4 +10,4 @@ try {
|
|||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
test(): Argument #2 ($e) cannot be passed by reference
|
||||
test(): Argument #2 ($e) could not be passed by reference
|
||||
|
|
|
@ -29,7 +29,7 @@ test(new Foo());
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
set(): Argument #1 ($ref) cannot be passed by reference
|
||||
set(): Argument #1 ($ref) cannot be passed by reference
|
||||
set(): Argument #1 ($ref) cannot be passed by reference
|
||||
set(): Argument #1 ($ref) cannot be passed by reference
|
||||
set(): Argument #1 ($ref) could not be passed by reference
|
||||
set(): Argument #1 ($ref) could not be passed by reference
|
||||
set(): Argument #1 ($ref) could not be passed by reference
|
||||
set(): Argument #1 ($ref) could not be passed by reference
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
$GLOBALS cannot be passed by reference (runtime error)
|
||||
$GLOBALS must be passed by reference (runtime error)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -19,5 +19,5 @@ function by_ref2(&$ref) {}
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
by_ref(): Argument #1 ($ref) cannot be passed by reference
|
||||
by_ref2(): Argument #1 ($ref) cannot be passed by reference
|
||||
by_ref(): Argument #1 ($ref) could not be passed by reference
|
||||
by_ref2(): Argument #1 ($ref) could not be passed by reference
|
||||
|
|
|
@ -9,7 +9,7 @@ test(1);
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: test(): Argument #1 cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: test(): Argument #1 could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -595,7 +595,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg
|
|||
zend_string *func_name = get_function_or_method_name(EX(call)->func);
|
||||
const char *param_name = get_function_arg_name(EX(call)->func, arg_num);
|
||||
|
||||
zend_throw_error(NULL, "%s(): Argument #%d%s%s%s cannot be passed by reference",
|
||||
zend_throw_error(NULL, "%s(): Argument #%d%s%s%s could not be passed by reference",
|
||||
ZSTR_VAL(func_name), arg_num, param_name ? " ($" : "", param_name ? param_name : "", param_name ? ")" : ""
|
||||
);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ Array
|
|||
string(7) "changed"
|
||||
string(7) "changed"
|
||||
|
||||
Fatal error: Uncaught Error: ref(): Argument #1 ($b) cannot be passed by reference in %soptimize_func_calls.php:%d
|
||||
Fatal error: Uncaught Error: ref(): Argument #1 ($b) could not be passed by reference in %soptimize_func_calls.php:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %soptimize_func_calls.php on line %d
|
||||
|
|
|
@ -17,7 +17,7 @@ echo "Done";
|
|||
--EXPECTF--
|
||||
*** Testing preg_match_all() : error conditions ***
|
||||
|
||||
Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($matches) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($matches) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -19,7 +19,7 @@ $stmt = $db->prepare("SELECT 1");
|
|||
$stmt->bindParam(':a', 'b');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($var) cannot be passed by reference in %sbug_37445.php:%d
|
||||
Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($var) could not be passed by reference in %sbug_37445.php:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sbug_37445.php on line %d
|
||||
|
|
|
@ -8,7 +8,7 @@ function f() {
|
|||
var_dump(next(array(1, 2)));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: next(): Argument #1 ($array) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: next(): Argument #1 ($array) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -14,7 +14,7 @@ __();
|
|||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: array_splice(): Argument #1 ($array) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: array_splice(): Argument #1 ($array) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): __()
|
||||
#1 {main}
|
||||
|
|
|
@ -10,7 +10,7 @@ prev - ensure we cannot pass a temporary
|
|||
var_dump(prev(array(1, 2)));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: prev(): Argument #1 ($array) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: prev(): Argument #1 ($array) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -16,7 +16,7 @@ Basic class support - attempting to pass a class constant by reference.
|
|||
var_dump(aclass::myConst);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: f(): Argument #1 ($a) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: f(): Argument #1 ($a) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -12,7 +12,7 @@ f(2);
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: f(): Argument #1 ($arg1) cannot be passed by reference in %s:%d
|
||||
Fatal error: Uncaught Error: f(): Argument #1 ($arg1) could not be passed by reference in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -50,11 +50,11 @@ try {
|
|||
?>
|
||||
--EXPECT--
|
||||
---> Pass constant assignment by reference:
|
||||
Exception: f(): Argument #1 ($a) cannot be passed by reference
|
||||
Exception: f(): Argument #1 ($a) could not be passed by reference
|
||||
|
||||
|
||||
---> Pass variable assignment by reference:
|
||||
Exception: f(): Argument #1 ($a) cannot be passed by reference
|
||||
Exception: f(): Argument #1 ($a) could not be passed by reference
|
||||
|
||||
|
||||
---> Pass reference assignment by reference:
|
||||
|
@ -63,4 +63,4 @@ string(9) "a.changed"
|
|||
|
||||
|
||||
---> Pass concat assignment by reference:
|
||||
Exception: f(): Argument #1 ($a) cannot be passed by reference
|
||||
Exception: f(): Argument #1 ($a) could not be passed by reference
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue