Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/tests/named_params/cannot_pass_by_ref.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function test($a, &$e) {}
try {
test(e: 42);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
test(): Argument #2 ($e) could not be passed by reference
Error: test(): Argument #2 ($e) could not be passed by reference
8 changes: 4 additions & 4 deletions Zend/tests/named_params/ctor_extra_named_args.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class Test {}
try {
new stdClass(x: "nope");
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
new Test(x: "nope");
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Unknown named parameter $x
Unknown named parameter $x
Error: Unknown named parameter $x
Error: Unknown named parameter $x
8 changes: 4 additions & 4 deletions Zend/tests/named_params/duplicate_param.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ function test($a) {}
try {
test(a: 1, a: 2);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(1, a: 2);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Named parameter $a overwrites previous argument
Named parameter $a overwrites previous argument
Error: Named parameter $a overwrites previous argument
Error: Named parameter $a overwrites previous argument
4 changes: 2 additions & 2 deletions Zend/tests/named_params/gh17216.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ $array = ["a" => "b", 1];
try {
forward_static_call_array($callback, $array);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
Cannot use positional argument after named argument
Error: Cannot use positional argument after named argument
Done
12 changes: 6 additions & 6 deletions Zend/tests/named_params/missing_param.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ function test($a, $b, $c, $d) {
try {
test(a: 'a', d: 'd');
} catch (ArgumentCountError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
array_keys(strict: true);
} catch (ArgumentCountError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
array_keys([], strict: true);
} catch (ArgumentCountError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

// This works fine, as search_value is explicitly specified.
var_dump(array_keys([41, 42], filter_value: 42, strict: true));

?>
--EXPECT--
test(): Argument #2 ($b) not passed
array_keys(): Argument #1 ($array) not passed
array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
ArgumentCountError: test(): Argument #2 ($b) not passed
ArgumentCountError: array_keys(): Argument #1 ($array) not passed
ArgumentCountError: array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
array(1) {
[0]=>
int(1)
Expand Down
18 changes: 9 additions & 9 deletions Zend/tests/named_params/unknown_named_param.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ function test2(...$a) {
try {
test(b: 42);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(b: new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(b: 2, a: 1);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(...new ArrayIterator(['unknown' => 42]));
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test2(a: 42);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Unknown named parameter $b
Unknown named parameter $b
Unknown named parameter $b
Unknown named parameter $unknown
Error: Unknown named parameter $b
Error: Unknown named parameter $b
Error: Unknown named parameter $b
Error: Unknown named parameter $unknown
16 changes: 8 additions & 8 deletions Zend/tests/named_params/unpack.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ test(...['a', 'b' => 'b', 'c' => 'c']);
try {
test(...['a', 'b' => 'b', 'c']);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(...['a', 'a' => 'a']);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

$ary = ['b' => 0];
Expand All @@ -39,13 +39,13 @@ test(...new ArrayIterator(['a', 'b' => 'b', 'c' => 'c']));
try {
test(...new ArrayIterator(['a', 'b' => 'b', 'c']));
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
test(...new ArrayIterator(['a', 'a' => 'a']));
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

$ary = ['b' => 0];
Expand All @@ -58,8 +58,8 @@ var_dump($ary, $ary2);
a = a, b = b, c = c
a = a, b = b, c = c
a = a, b = b, c = c
Cannot use positional argument after named argument during unpacking
Named parameter $a overwrites previous argument
Error: Cannot use positional argument after named argument during unpacking
Error: Named parameter $a overwrites previous argument
array(1) {
["b"]=>
int(1)
Expand All @@ -71,8 +71,8 @@ array(1) {
a = a, b = b, c = c
a = a, b = b, c = c
a = a, b = b, c = c
Cannot use positional argument after named argument during unpacking
Named parameter $a overwrites previous argument
Error: Cannot use positional argument after named argument during unpacking
Error: Named parameter $a overwrites previous argument

Warning: Cannot pass by-reference argument 2 of test2() by unpacking a Traversable, passing by-value instead in %s on line %d
array(1) {
Expand Down
8 changes: 4 additions & 4 deletions Zend/tests/named_params/unpack_and_named_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ test2(...['b' => 2, 'a' => 1], d: 40);
try {
test2(...[1, 2], b: 20);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test2(...[1, 'b' => 2], b: 20);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
Expand Down Expand Up @@ -54,5 +54,5 @@ int(1)
int(2)
int(3)
int(40)
Named parameter $b overwrites previous argument
Named parameter $b overwrites previous argument
Error: Named parameter $b overwrites previous argument
Error: Named parameter $b overwrites previous argument
12 changes: 6 additions & 6 deletions Zend/tests/namespaces/ns_076.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ use Error;
try {
$a = array(unknown => unknown);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
echo unknown;
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
echo \unknown;
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Undefined constant "foo\unknown"
Undefined constant "foo\unknown"
Undefined constant "unknown"
Error: Undefined constant "foo\unknown"
Error: Undefined constant "foo\unknown"
Error: Undefined constant "unknown"
4 changes: 2 additions & 2 deletions Zend/tests/not_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $b = array(1,2);
try {
var_dump(~$b);
} catch (Error $e) {
echo "\nException: " . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

$a = ~$b;
Expand All @@ -18,7 +18,7 @@ var_dump($a);
echo "Done\n";
?>
--EXPECTF--
Exception: Cannot perform bitwise not on array
TypeError: Cannot perform bitwise not on array

Fatal error: Uncaught TypeError: Cannot perform bitwise not on array in %s:%d
Stack trace:
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/nullsafe_operator/001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var_dump($foo->self(null?->bar())->null());
try {
var_dump($foo?->self()[null?->bar()]);
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
Expand Down Expand Up @@ -103,4 +103,4 @@ string(11) "Foo::self()"
string(11) "Foo::null()"
NULL
string(11) "Foo::self()"
string(38) "Cannot use object of type Foo as array"
Error: Cannot use object of type Foo as array
20 changes: 10 additions & 10 deletions Zend/tests/nullsafe_operator/002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ Test nullsafe strict type check
try {
false?->bar();
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
[]?->bar();
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
(0)?->bar();
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
(0.0)?->bar();
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
''?->bar();
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
string(40) "Call to a member function bar() on false"
string(40) "Call to a member function bar() on array"
string(38) "Call to a member function bar() on int"
string(40) "Call to a member function bar() on float"
string(41) "Call to a member function bar() on string"
Error: Call to a member function bar() on false
Error: Call to a member function bar() on array
Error: Call to a member function bar() on int
Error: Call to a member function bar() on float
Error: Call to a member function bar() on string
8 changes: 4 additions & 4 deletions Zend/tests/nullsafe_operator/003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var_dump($foo?->qux());
try {
var_dump($foo?->quux());
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

var_dump((new Foo)?->bar);
Expand All @@ -34,7 +34,7 @@ var_dump((new Foo)?->qux());
try {
var_dump((new Foo)?->quux());
} catch (Throwable $e) {
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
Expand All @@ -48,10 +48,10 @@ string(3) "bar"
Warning: Undefined property: Foo::$baz in %s.php on line 20
NULL
string(3) "qux"
string(36) "Call to undefined method Foo::quux()"
Error: Call to undefined method Foo::quux()
string(3) "bar"

Warning: Undefined property: Foo::$baz in %s.php on line 29
NULL
string(3) "qux"
string(36) "Call to undefined method Foo::quux()"
Error: Call to undefined method Foo::quux()
Binary file modified Zend/tests/nullsafe_operator/013.phpt
Binary file not shown.
8 changes: 4 additions & 4 deletions Zend/tests/nullsafe_operator/014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function try_and_dump($fn) {
try {
var_dump($fn());
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

Expand Down Expand Up @@ -40,8 +40,8 @@ bar
int(0)
bar
int(0)
Call to a member function null() on null
Call to a member function null() on null
Error: Call to a member function null() on null
Error: Call to a member function null() on null
bar
bar
Call to a member function baz() on int
Error: Call to a member function baz() on int
Loading
Loading