Req #76797 [Com]: Ability to access php compiler (deprecated create_function)
| From: | spam2 at rhsoft dot net | Date: | Tue, 13 Nov 2018 21:07:55 +0000 |
| Subject: | Req #76797 [Com]: Ability to access php compiler (deprecated create_function) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217944@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76797&edit=1
ID: 76797
Comment by: spam2 at rhsoft dot net
Reported by: mageia at mokraemer dot de
Summary: Ability to access php compiler (deprecated
create_function)
Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux
PHP Version: 7.2.9
Block user comment: N
Private report: N
New Comment:
don't get me wrong but "Throwable was the solution I didn't see" is a strange
response after "same output for Throwable"
Previous Comments:
------------------------------------------------------------------------
[2018-11-13 19:14:16] mageia at mokraemer dot de
sorry, found my mistake in the testcode :(
Throwable was the solution I didn't see.
Thanks for pointing it out, sorry to bother you.
------------------------------------------------------------------------
[2018-11-13 18:46:24] spam2 at rhsoft dot net
it works, period, refactor and simplify your code, you can catch parse errors as any other
exception, starzing with PHP7 "Throwable"catches *anything* and if that don't happen
you have other problems - this is a bugtracker and not a support forum
---------------------------
[harry@srv-rhsoft:/downloads]$ php test.php
exception catchedParseError Object
(
[message:protected] => syntax error, unexpected end of file
[string:Error:private] =>
[code:protected] => 0
[file:protected] => /mnt/data/downloads/test.php(4) : eval()'d code
[line:protected] => 1
[trace:Error:private] => Array
(
)
[previous:Error:private] =>
)
---------------------------
[harry@srv-rhsoft:/downloads]$ cat test.php
<?php
try
{
$var = eval('nonsense');
}
catch (Throwable $e)
{
echo 'exception catched';
print_r($e);
}
------------------------------------------------------------------------
[2018-11-13 18:29:57] mageia at mokraemer dot de
same output for
Throwable
------------------------------------------------------------------------
[2018-11-13 18:27:58] spam2 at rhsoft dot net
because your code is simply wrong
catch(Throwable $e)
{
}
------------------------------------------------------------------------
[2018-11-13 18:21:50] mageia at mokraemer dot de
Test-Script:
<?php
function shutdown(){
echo 'shutdown';
}
register_shutdown_function('shutdown');
$code = '?;';
try{
$var = eval('function() { ?>' . preg_replace(['|use [\w,\s\\\\]*;|'],
'', $code) . ' <?php } ?>');
} catch (Exception $e){
echo 'exception catched';
print_r($e);
}
$php -v
PHP 7.2.11 (cli)
$php test.php
shutdown
=> I get no exception to catch!
------------------------------------------------------------------------
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=76797
--
Edit this bug report at https://bugs.php.net/bug.php?id=76797&edit=1