|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-17 03:46 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 13:00:01 2025 UTC |
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 !)