From: phil at adigital dot com dot mx
Operating system: linux red hat
PHP version: 5.0.0RC1
PHP Bug Type: Zend Engine 2 problem
Bug description: try-catch doesnt really catch ?
Description:
------------
It seems that try-catch only catch the exception that USER program into
its code with a throw...
I hope this is a transitional state, since the most usefull and
interesting catches that you can get are definitively "WARNINGS" and
"FATAL ERRORS" taht PHP itself can give. see example below
I hope all PHP functions (i-e- Zend 2 engine) will be able to catch
WARNINGS and FATAL ERRORS somehow, or said on other words, that any PHP
functions will use Throw *any exceptions*
Thx
Reproduce code:
---------------
error_reporting(E_ALL);
try
{
print $variable_not_set;
// syntax error eval
$toeval = "print \"Hola exec 1;";
eval($toeval);
$toeval = "print \$not_set_variable;";
eval($toeval);
}
catch (Exception $exception)
{
echo "CATCHED EXCEPTION: ".$exception;
}
Expected result:
----------------
this is supposed to catch the warning of non existing variable, the syntax
error of evaluated expresion and the warning of not set variable into
evaluate expresion.
It doesn't catch anything !
(cf: Java does !)
--
Edit bug report at http://bugs.php.net/?id=28033&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28033&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28033&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28033&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28033&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28033&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28033&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28033&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28033&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28033&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28033&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28033&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28033&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28033&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28033&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28033&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28033&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28033&r=float