Skip to content
Draft
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
6 changes: 4 additions & 2 deletions Zend/tests/exceptions/bug50383.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ function thrower2() {
try {
thrower();
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage();
echo $e::class, ': ', $e->getMessage(), "\n";
print_r($e->getTrace());
}

try {
thrower2();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage();
echo $e::class, ': ', $e->getMessage(), "\n";
print_r($e->getTrace());
}

?>
--EXPECTF--
Exception: Missing static method 'ThrowException'

Array
(
[0] => Array
Expand Down Expand Up @@ -70,6 +71,7 @@ Array

)
Exception: Missing method 'foo'

Array
(
[0] => Array
Expand Down
8 changes: 4 additions & 4 deletions ext/intl/uchar/tests/enumCharTypes_trampoline.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ foreach ([new TrampolineTest(), TrampolineTest::class] as $target) {
foreach (['trampoline', 'trampolineThrow', 'trampoline'] as $method) {
try {
var_dump(IntlChar::enumCharTypes([$target, $method]));
} catch (Exception $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
Expand All @@ -42,7 +42,7 @@ trampoline: 32, 33, 12
NULL
trampolineThrow: 0, 32, 15
trampolineThrow: 32, 33, 12
Stop enumeration
Exception: Stop enumeration
trampoline: 0, 32, 15
trampoline: 32, 33, 12
NULL
Expand All @@ -52,7 +52,7 @@ trampoline: 32, 33, 12
NULL
trampolineThrow: 0, 32, 15
trampolineThrow: 32, 33, 12
Stop enumeration
Exception: Stop enumeration
trampoline: 0, 32, 15
trampoline: 32, 33, 12
NULL
6 changes: 3 additions & 3 deletions ext/mbstring/tests/gh23106.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ var_dump(mb_strrpos("AA\xf0\x90", "A", 3));
var_dump(mb_strrpos("AA\xf0\x90", "A", -1));
try {
mb_strpos("AA\xf0\x90", "xyz", 4);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(false)
bool(false)
bool(false)
int(1)
mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
ValueError: mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
12 changes: 6 additions & 6 deletions ext/reflection/tests/002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ try
{
$r->class = 'bullshit';
}
catch(ReflectionException $e)
catch(Throwable $e)
{
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
try
{
$r->name = 'bullshit';
}
catch(ReflectionException $e)
catch(Throwable $e)
{
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

$r->foo = 'bar';
Expand All @@ -54,8 +54,8 @@ string(26) "ReflectionFunctionAbstract"
string(7) "getName"
string(3) "xyz"
NULL
Cannot set read-only property ReflectionMethodEx::$class
Cannot set read-only property ReflectionMethodEx::$name
ReflectionException: Cannot set read-only property ReflectionMethodEx::$class
ReflectionException: Cannot set read-only property ReflectionMethodEx::$name
string(26) "ReflectionFunctionAbstract"
string(7) "getName"
string(3) "bar"
Expand Down
16 changes: 8 additions & 8 deletions ext/reflection/tests/004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ $m=$a->getMethod("__construct");

try {
$m->invoke(null);
} catch (ReflectionException $E) {
echo $E->getMessage()."\n";
} catch (Throwable $E) {
echo $E::class, ': ', $E->getMessage(), "\n";
}


try {
$m->invoke($b);
} catch (ReflectionException $E) {
echo $E->getMessage()."\n";
} catch (Throwable $E) {
echo $E::class, ': ', $E->getMessage(), "\n";
}

$b = new a();
try {
$m->invoke($b);
} catch (ReflectionException $E) {
echo $E->getMessage()."\n";
} catch (Throwable $E) {
echo $E::class, ': ', $E->getMessage(), "\n";
}

?>
--EXPECT--
Trying to invoke non static method a::__construct() without an object
Given object is not an instance of the class this method was declared in
ReflectionException: Trying to invoke non static method a::__construct() without an object
ReflectionException: Given object is not an instance of the class this method was declared in
26 changes: 13 additions & 13 deletions ext/reflection/tests/007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function test($class)
{
$ref = new ReflectionClass($class);
}
catch (ReflectionException $e)
catch (Throwable $e)
{
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
return; // only here
}

Expand All @@ -21,33 +21,33 @@ function test($class)
{
var_dump($ref->newInstance());
}
catch (ReflectionException $e)
catch (Throwable $e)
{
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}
catch (Throwable $e)
{
echo "Exception: " . $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "====>newInstance(25)\n";
try
{
var_dump($ref->newInstance(25));
}
catch (ReflectionException $e)
catch (Throwable $e)
{
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "====>newInstance(25, 42)\n";
try
{
var_dump($ref->newInstance(25, 42));
}
catch (ReflectionException $e)
catch (Throwable $e)
{
var_dump($e->getMessage());
echo $e::class, ': ', $e->getMessage(), "\n";
}

echo "\n";
Expand Down Expand Up @@ -91,15 +91,15 @@ test('WithCtorWithArgs');
--EXPECTF--
====>Class_does_not_exist
{closure:%s:%d}(Class_does_not_exist)
string(43) "Class "Class_does_not_exist" does not exist"
ReflectionException: Class "Class_does_not_exist" does not exist
====>NoCtor
====>newInstance()
object(NoCtor)#%d (0) {
}
====>newInstance(25)
string(86) "Class NoCtor does not have a constructor, so you cannot pass any constructor arguments"
ReflectionException: Class NoCtor does not have a constructor, so you cannot pass any constructor arguments
====>newInstance(25, 42)
string(86) "Class NoCtor does not have a constructor, so you cannot pass any constructor arguments"
ReflectionException: Class NoCtor does not have a constructor, so you cannot pass any constructor arguments

====>WithCtor
====>newInstance()
Expand Down Expand Up @@ -129,7 +129,7 @@ object(WithCtor)#%d (0) {

====>WithCtorWithArgs
====>newInstance()
Exception: Too few arguments to function WithCtorWithArgs::__construct(), 0 passed and exactly 1 expected
ArgumentCountError: Too few arguments to function WithCtorWithArgs::__construct(), 0 passed and exactly 1 expected
====>newInstance(25)
WithCtorWithArgs::__construct(25)
array(1) {
Expand Down
42 changes: 21 additions & 21 deletions ext/reflection/tests/008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ $a = array("", 1, "::", "a::", "::b", "a::b");
foreach ($a as $val) {
try {
new ReflectionMethod($val);
} catch (Exception $e) {
var_dump($e->getMessage());
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
ReflectionMethod::createFromMethodName($val);
} catch (Exception $e) {
var_dump($e->getMessage());
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

Expand All @@ -25,38 +25,38 @@ $b = array("", "", 1);
foreach ($a as $key=>$val) {
try {
new ReflectionMethod($val, $b[$key]);
} catch (Exception $e) {
var_dump($e->getMessage());
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
}

echo "Done\n";
?>
--EXPECTF--
Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name"
ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name
ReflectionException: ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name

Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name"
ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name
ReflectionException: ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name

Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(23) "Class "" does not exist"
string(23) "Class "" does not exist"
ReflectionException: Class "" does not exist
ReflectionException: Class "" does not exist

Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(24) "Class "a" does not exist"
string(24) "Class "a" does not exist"
ReflectionException: Class "a" does not exist
ReflectionException: Class "a" does not exist

Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(23) "Class "" does not exist"
string(23) "Class "" does not exist"
ReflectionException: Class "" does not exist
ReflectionException: Class "" does not exist

Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
string(24) "Class "a" does not exist"
string(24) "Class "a" does not exist"
string(23) "Class "" does not exist"
string(24) "Class "1" does not exist"
string(23) "Class "" does not exist"
ReflectionException: Class "a" does not exist
ReflectionException: Class "a" does not exist
ReflectionException: Class "" does not exist
ReflectionException: Class "1" does not exist
ReflectionException: Class "" does not exist
Done
6 changes: 3 additions & 3 deletions ext/reflection/tests/027.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ $g->next();

try {
$r->getTrace();
} catch (ReflectionException $e) {
echo $e->getMessage();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot fetch information from a closed Generator
ReflectionException: Cannot fetch information from a closed Generator
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ echo $rc;
$rc = new ReflectionClassConstant(B::class, 'CONST1');
try {
$rc->getValue();
} catch (TypeError $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
echo $rc;
} catch (TypeError $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
object(stdClass)#1 (0) {
}
Constant [ public object CONST1 ] { Object }
Cannot assign stdClass to class constant B::CONST1 of type array
Cannot assign stdClass to class constant B::CONST1 of type array
TypeError: Cannot assign stdClass to class constant B::CONST1 of type array
TypeError: Cannot assign stdClass to class constant B::CONST1 of type array
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class B {

try {
echo new ReflectionClassConstant('B', 'X');
} catch (Error $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Undefined constant self::UNKNOWN
Error: Undefined constant self::UNKNOWN
12 changes: 6 additions & 6 deletions ext/reflection/tests/ReflectionClassConstant_unset_name.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ $rc = new ReflectionClassConstant(Test::class, 'C');
unset($rc->name);
try {
var_dump($rc->getName());
} catch (Error $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
echo $rc, "\n";
} catch (Error $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Typed property ReflectionClassConstant::$name must not be accessed before initialization
Typed property ReflectionClassConstant::$name must not be accessed before initialization
Error: Typed property ReflectionClassConstant::$name must not be accessed before initialization
Error: Typed property ReflectionClassConstant::$name must not be accessed before initialization
Loading
Loading