Bug #60620 [Csd]: ReflectionFunction Internal Error provocation
| From: | cmb@php.net | Date: | Wed, 13 Sep 2017 21:44:26 +0000 |
| Subject: | Bug #60620 [Csd]: ReflectionFunction Internal Error provocation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211142@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60620&edit=1
ID: 60620
Updated by: cmb@php.net
Reported by: hanskrentel at yahoo dot de
Summary: ReflectionFunction Internal Error provocation
Status: Closed
Type: Bug
Package: Reflection related
Operating System: win
PHP Version: 5.3.8
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> no idea what you are talking about - you can catch it - PERIOD
I'm talking about the distinction between Throwables and fatal
(i.e. unrecoverable) errors. The latter can't be caught, and never
will, because they left the engine in a broken state (for
instance, memory errors). There are most likely still cases where
an extension raises a fatal error instead of throwing a Throwable,
even though that could be changed. This has to be addressed on a
case-by-case basis unless somebody takes the time to manually
inspect the complete PHP sources.
> [â¦] instead fix the remainin crap [â¦]
I suggest to read <https://bugs.php.net/how-to-report.php>. :)
Previous Comments:
------------------------------------------------------------------------
[2017-09-13 20:56:55] spam2 at rhsoft dot net
and with PHP7 and catch(Throwable) you can even catch parse errors of includes, calls to functions
which don't exist and so on - so please don't edcuate me instead fix the remainin crap
which is still not catchabale like WSDL/SOAP
------------------------------------------------------------------------
[2017-09-13 20:54:11] spam2 at rhsoft dot net
> No, that is not possible. A TypeError isn't a fatal error, though
no idea what you are talking about - you can catch it - PERIOD
the only crap you still can't catch is https://bugs.php.net/bug.php?id=73451
[harry@srv-rhsoft:/downloads]$ php test.php
CATCHED: TypeError: Argument 1 passed to test() must be of the type string, integer given, called in
/mnt/data/downloads/test.php on line 4 and defined in /mnt/data/downloads/test.php:11 Stack trace:
#0 /mnt/data/downloads/test.php(4): test(1) #1 {main}
[harry@srv-rhsoft:/downloads]$ cat test.php
<?php declare(strict_types=1);
try
{
test(1);
}
catch(Throwable $exception)
{
$exception = str_replace("\n", ' ', (string)$exception);
echo "CATCHED: $exception\n";
}
function test(string $x)
{
}
------------------------------------------------------------------------
[2017-09-13 20:44:49] cmb@php.net
> you can catch fatal errors starzing with PHP 7.0
No, that is not possible. A TypeError isn't a fatal error, though.
------------------------------------------------------------------------
[2017-09-13 17:59:37] spam2 at rhsoft dot net
that below is part of my fuzzy-call-suite for string params with work with 7.0/7.1/7.2 perfectly -
you can catch fatal errors starzing with PHP 7.0
try
{
$params[] = $reflection_param->getDefaultValue();
}
catch(Throwable $exception)
{
$params[] = bin2hex(random_bytes(5));
}
------------------------------------------------------------------------
[2017-09-13 17:22:21] cmb@php.net
As of PHP 7.0.0 a TypeError is thrown, if the parameter is not a
string, see <https://3v4l.org/DuLJt>.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=60620
--
Edit this bug report at https://bugs.php.net/bug.php?id=60620&edit=1