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
8 changes: 4 additions & 4 deletions Zend/tests/dynamic_call/bug77877.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class Foo {
try {
array_map([new Foo, 'bar'],[1]);
} catch (Throwable $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
call_user_func([new Foo, 'bar']);
} catch (Throwable $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Using $this when not in object context
Using $this when not in object context
Error: Using $this when not in object context
Error: Using $this when not in object context
12 changes: 6 additions & 6 deletions Zend/tests/dynamic_call/dynamic_call_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ function test_calls($func) {
array_map($func, [['i' => new stdClass]]);
var_dump($i);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
$func(['i' => new stdClass]);
var_dump($i);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
call_user_func($func, ['i' => new stdClass]);
var_dump($i);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}
test_calls('extract');

?>
--EXPECT--
Cannot call extract() dynamically
Cannot call extract() dynamically
Cannot call extract() dynamically
Error: Cannot call extract() dynamically
Error: Cannot call extract() dynamically
Error: Cannot call extract() dynamically
24 changes: 12 additions & 12 deletions Zend/tests/dynamic_call/dynamic_call_006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@ function test() {
$func = 'extract';
$func(['a' => 'b']);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

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

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

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

try {
$func = 'func_get_arg';
$func(1);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

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

?>
--EXPECT--
Cannot call extract() dynamically
Cannot call compact() dynamically
Cannot call get_defined_vars() dynamically
Cannot call func_get_args() dynamically
Cannot call func_get_arg() dynamically
Cannot call func_num_args() dynamically
Error: Cannot call extract() dynamically
Error: Cannot call compact() dynamically
Error: Cannot call get_defined_vars() dynamically
Error: Cannot call func_get_args() dynamically
Error: Cannot call func_get_arg() dynamically
Error: Cannot call func_num_args() dynamically
4 changes: 2 additions & 2 deletions Zend/tests/dynamic_call/dynamic_call_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function test() {
try {
array_map('extract', [['i' => new stdClass]]);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
$i += 1;
var_dump($i);
Expand All @@ -17,5 +17,5 @@ test();

?>
--EXPECT--
Cannot call extract() dynamically
Error: Cannot call extract() dynamically
int(2)
4 changes: 2 additions & 2 deletions Zend/tests/dynamic_call/dynamic_call_008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function test() {
try {
((string) 'extract')(['a' => 42]);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}
test();

?>
--EXPECT--
Cannot call extract() dynamically
Error: Cannot call extract() dynamically
12 changes: 6 additions & 6 deletions Zend/tests/dynamic_call/dynamic_call_freeing.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ try {
$bar = "bar";
("foo" . $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$bar = ["bar"];
(["foo"] + $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
(new stdClass)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Call to undefined function foobar()
Array callback must have exactly two elements
Object of type stdClass is not callable
Error: Call to undefined function foobar()
Error: Array callback must have exactly two elements
Error: Object of type stdClass is not callable
8 changes: 4 additions & 4 deletions Zend/tests/dynamic_call/dynamic_call_non_static.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ $x = new Foo;
try {
$x->test1();
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x->test2();
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Non-static method Foo::bar() cannot be called statically
Non-static method Foo::bar() cannot be called statically
Error: Non-static method Foo::bar() cannot be called statically
Error: Non-static method Foo::bar() cannot be called statically
4 changes: 2 additions & 2 deletions Zend/tests/dynamic_call/dynamic_fully_qualified_call.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Foo;
try {
('\bar')();
} catch (\Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Call to undefined function bar()
Error: Call to undefined function bar()
4 changes: 2 additions & 2 deletions Zend/tests/dynamic_prop_deprecation_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ $a = new class{};
try {
[&$a->y];
} catch (Throwable $ex) {
echo "Exception: " .$ex->getMessage() . "\n";
echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
Err: Creation of dynamic property class@anonymous::$y is deprecated
Exception: Cannot create dynamic property class@anonymous::$y
Error: Cannot create dynamic property class@anonymous::$y
4 changes: 2 additions & 2 deletions Zend/tests/enum/ast-dumper.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ try {
return false;
})());
} catch (Error $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
assert((function () {
AssertionError: assert((function () {
enum Foo {
case Bar;
}
Expand Down
16 changes: 8 additions & 8 deletions Zend/tests/enum/backed-duplicate-int.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ enum Foo: int {
try {
var_dump(Foo::Bar);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

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

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

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

?>
--EXPECT--
Duplicate value in enum Foo for cases Bar and Baz
Duplicate value in enum Foo for cases Bar and Baz
Duplicate value in enum Foo for cases Bar and Baz
Foo::tryFrom(): Argument #1 ($value) must be of type int, string given
Error: Duplicate value in enum Foo for cases Bar and Baz
Error: Duplicate value in enum Foo for cases Bar and Baz
Error: Duplicate value in enum Foo for cases Bar and Baz
TypeError: Foo::tryFrom(): Argument #1 ($value) must be of type int, string given
16 changes: 8 additions & 8 deletions Zend/tests/enum/backed-duplicate-string.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ enum Suit: string {
try {
var_dump(Suit::Hearts);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

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

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

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

?>
--EXPECT--
Duplicate value in enum Suit for cases Hearts and Spades
Duplicate value in enum Suit for cases Hearts and Spades
Duplicate value in enum Suit for cases Hearts and Spades
Duplicate value in enum Suit for cases Hearts and Spades
Error: Duplicate value in enum Suit for cases Hearts and Spades
Error: Duplicate value in enum Suit for cases Hearts and Spades
Error: Duplicate value in enum Suit for cases Hearts and Spades
Error: Duplicate value in enum Suit for cases Hearts and Spades
4 changes: 2 additions & 2 deletions Zend/tests/enum/backed-from-invalid-int.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ enum Foo: int {
try {
var_dump(Foo::from(2));
} catch (Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
2 is not a valid backing value for enum Foo
ValueError: 2 is not a valid backing value for enum Foo
4 changes: 2 additions & 2 deletions Zend/tests/enum/backed-from-invalid-string.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ enum Suit: string {
try {
var_dump(Suit::from('A'));
} catch (Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
"A" is not a valid backing value for enum Suit
ValueError: "A" is not a valid backing value for enum Suit
8 changes: 4 additions & 4 deletions Zend/tests/enum/backed-from-invalid-type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum Suit: string {
try {
var_dump(Suit::from(42));
} catch (Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

enum Foo: int {
Expand All @@ -24,11 +24,11 @@ enum Foo: int {
try {
var_dump(Foo::from('H'));
} catch (Error $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}


?>
--EXPECT--
"42" is not a valid backing value for enum Suit
Foo::from(): Argument #1 ($value) must be of type int, string given
ValueError: "42" is not a valid backing value for enum Suit
TypeError: Foo::from(): Argument #1 ($value) must be of type int, string given
8 changes: 4 additions & 4 deletions Zend/tests/enum/backed-mismatch.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ enum Foo: int {
try {
var_dump(Foo::Bar);
} catch (Error $e) {
echo get_class($e), ': ', $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

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

try {
var_dump(Foo::from(42));
} catch (Error $e) {
echo get_class($e), ': ', $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
var_dump(Foo::from('bar'));
} catch (Error $e) {
echo get_class($e), ': ', $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
Expand Down
Loading
Loading