|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2006-10-14 08:50 UTC] chregu@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 08:00:01 2025 UTC | 
Description: ------------ Cannot catch a simple loading error when using simplexml_load_string() loading an invalid xml string. I understand that that E_WARNING, E_ERROR etc are not exceptions but realisticlly, I expect a loading function to throw an exception when it fails to load a object, not a uncatchable "warning". It also be invalid to say this error class is a "warning" as it is most definitely an error. Reproduce code: --------------- <?php try { $x = simplexml_load_string("adfasdf"); print_r($x); } catch (Exception $e) { echo "toast"; } ?> Expected result: ---------------- toast Actual result: -------------- Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in... Warning: simplexml_load_string(): adfasdf in... Warning: simplexml_load_string(): ^ in...