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
1 change: 0 additions & 1 deletion tests/basic/GHSA-9pqp-7h25-4f32.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ Content-type: text/html; charset=UTF-8
Hello world
array(0) {
}

4 changes: 2 additions & 2 deletions tests/classes/abstract_user_call.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ $o->func();
try {
call_user_func(array($o, 'test_base::func'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECTF--
test::func()

Deprecated: Callables of the form ["test", "test_base::func"] are deprecated in %s on line %d
call_user_func(): Argument #1 ($callback) must be a valid callback, cannot call abstract method test_base::func()
TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot call abstract method test_base::func()
16 changes: 8 additions & 8 deletions tests/classes/array_access_013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ try
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try
Expand All @@ -28,7 +28,7 @@ try
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try
Expand All @@ -37,7 +37,7 @@ try
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

try
Expand All @@ -46,11 +46,11 @@ try
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Caught in Test::offsetExists()
Caught in Test::offsetGet()
Caught in Test::offsetSet()
Caught in Test::offsetUnset()
Exception: Test::offsetExists
Exception: Test::offsetGet
Exception: Test::offsetSet
Exception: Test::offsetUnset
4 changes: 2 additions & 2 deletions tests/classes/autoload_012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ spl_autoload_register(function ($name) {
try {
call_user_func("UndefC::test");
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
In autoload: string(6) "UndefC"
call_user_func(): Argument #1 ($callback) must be a valid callback, class "UndefC" not found
TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class "UndefC" not found
4 changes: 2 additions & 2 deletions tests/classes/autoload_013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ try {
new ReflectionClass("UndefC");
}
catch (ReflectionException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
In autoload: string(6) "UndefC"
Class "UndefC" does not exist
ReflectionException: Class "UndefC" does not exist
4 changes: 2 additions & 2 deletions tests/classes/autoload_014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ try {
new ReflectionMethod("UndefC", "test");
}
catch (ReflectionException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
In autoload: string(6) "UndefC"
Class "UndefC" does not exist
ReflectionException: Class "UndefC" does not exist
4 changes: 2 additions & 2 deletions tests/classes/autoload_015.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ try {
new ReflectionProperty('UndefC', 'p');
}
catch (ReflectionException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
In autoload: string(6) "UndefC"
Class "UndefC" does not exist
ReflectionException: Class "UndefC" does not exist
4 changes: 2 additions & 2 deletions tests/classes/autoload_016.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ $rc = new ReflectionClass("stdClass");
try {
$rc->getProperty("UndefC::p");
} catch (ReflectionException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
In autoload: string(6) "UndefC"
Class "UndefC" does not exist
ReflectionException: Class "UndefC" does not exist
4 changes: 2 additions & 2 deletions tests/classes/autoload_017.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ $rc = new ReflectionClass("stdClass");
try {
$rc->implementsInterface("UndefI");
} catch (ReflectionException $e) {
echo $e->getMessage();
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
In autoload: string(6) "UndefI"
Interface "UndefI" does not exist
ReflectionException: Interface "UndefI" does not exist
8 changes: 4 additions & 4 deletions tests/classes/bug27504.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ $foo = new foo();
try {
call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$foo->bar('3');
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Called function foo:bar(1)
call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method foo::bar()
Call to private method foo::bar() from global scope
TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method foo::bar()
Error: Call to private method foo::bar() from global scope
4 changes: 2 additions & 2 deletions tests/classes/constants_visibility_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ A::staticConstDump();
try {
constant('A::protectedConst');
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
string(14) "protectedConst"
string(14) "protectedConst"
Cannot access protected constant A::protectedConst
Error: Cannot access protected constant A::protectedConst
4 changes: 2 additions & 2 deletions tests/classes/constants_visibility_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ A::staticConstDump();
try {
constant('A::privateConst');
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
string(12) "privateConst"
string(12) "privateConst"
Cannot access private constant A::privateConst
Error: Cannot access private constant A::privateConst
4 changes: 2 additions & 2 deletions tests/classes/ctor_failure.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ try
}
catch (Exception $e)
{
echo 'Caught ' . get_class($e) . '(' . $e->getMessage() . ")\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Test::__construct(Hello)
Caught Exception(Hello)
Exception: Hello
10 changes: 5 additions & 5 deletions tests/classes/destructor_and_exceptions.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try
}
catch(Exception $e)
{
echo "Caught: " . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

class FatalException extends Exception
Expand All @@ -42,17 +42,17 @@ try
}
catch(Exception $e)
{
echo "Caught Exception: " . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
catch(FatalException $e)
{
echo "Caught FatalException: " . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
FailClass::__destruct
Caught: FailClass
Exception: FailClass
FatalException::__construct
FailClass::__destruct
Caught Exception: FailClass
Exception: FailClass
2 changes: 1 addition & 1 deletion tests/classes/factory_and_singleton_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ try {
$obj = new test;
$clone = clone $obj;
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

?>
Expand Down
2 changes: 1 addition & 1 deletion tests/classes/factory_and_singleton_008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ try {
$obj = new test;
$clone = clone $obj;
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

?>
Expand Down
12 changes: 6 additions & 6 deletions tests/classes/iterators_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ while($t->x < 5)
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
$t->x++;
}
?>
--EXPECT--
Caught in Test::rewind()
Caught in Test::current()
Caught in Test::key()
Exception: Test::rewind
Exception: Test::current
Exception: Test::key
Current
Caught in Test::next()
Caught in Test::valid()
Exception: Test::next
Exception: Test::valid
2 changes: 1 addition & 1 deletion tests/classes/serialize_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ foreach($tests as $data)
}
catch(Exception $e)
{
echo 'Exception: ' . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/classes/tostring_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ print_r($o);
try {
var_dump((string)$o);
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($o);

Expand Down Expand Up @@ -59,7 +59,7 @@ $ar[$o->__toString()] = "ERROR";
try {
echo $ar[$o];
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "====test8====\n";
Expand All @@ -75,7 +75,7 @@ var_dump($o);
try {
echo $o;
} catch (Error $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
Expand All @@ -85,7 +85,7 @@ try {
test1 Object
(
)
Object of class test1 could not be converted to string
Error: Object of class test1 could not be converted to string
object(test1)#1 (0) {
}
====test2====
Expand Down Expand Up @@ -118,7 +118,7 @@ test2::__toString()
Converted
====test7====
test2::__toString()
Cannot access offset of type test2 on array
TypeError: Cannot access offset of type test2 on array
====test8====
test2::__toString()
string(9) "Converted"
Expand All @@ -131,5 +131,5 @@ Converted
object(test3)#2 (0) {
}
test3::__toString()
test3::__toString(): Return value must be of type string, array returned
TypeError: test3::__toString(): Return value must be of type string, array returned
====DONE====
4 changes: 2 additions & 2 deletions tests/classes/tostring_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ try
}
catch(Exception $e)
{
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
====DONE====
--EXPECT--
string(5) "Damn!"
Exception: Damn!
====DONE====
Loading
Loading