php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65705 simplexml_load_string does not honor error_reporting settting
Submitted: 2013-09-19 08:34 UTC Modified: 2013-09-24 15:01 UTC
From: oskar dot mothander at gmail dot com Assigned:
Status: Closed Package: SimpleXML related
PHP Version: 5.4.19 OS: Windows 7 (64)
Private report: No CVE-ID: None
 [2013-09-19 08:34 UTC] oskar dot mothander at gmail dot com
Description:
------------
Calling simplexml_load_string() on invalid xml will output Warnings even though 
you've been a good developer and turned these OFF on live environment.

Using "libxml_use_internal_errors(true);" fixes the problem but shouldn't be 
nessesary. 

This caused my site to display Warnings live.

Affected versions: 
PHP 5.4.3 (not in the list above?)
PHP 5.3.8 (VC9 X86 32bit thread safe) + PEAR


Test script:
---------------
ini_set("display_errors", false);
simplexml_load_string('<apa>');
// Will still output Warnings even though they are off.

Expected result:
----------------
Empty result

Actual result:
--------------
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: 
parser error : Premature end of data in tag apa line 1 on line 2

Warning: simplexml_load_string() [function.simplexml-load-string]: <apa> on line 2

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-22 22:47 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2013-09-22 22:47 UTC] aharvey@php.net
I can't reproduce this: setting display_errors to false or removing E_WARNING 
from error_reporting() quiets the warnings as expected for me.

Do you have any extensions loaded that may interfere with error reporting, such 
as xdebug or scream? (You can check this via phpinfo().) If not, does this still 
occur on a current version of PHP (ie 5.4.20 or 5.5.4)?
 [2013-09-24 15:01 UTC] oskar dot mothander at gmail dot com
-Status: Feedback +Status: Closed
 [2013-09-24 15:01 UTC] oskar dot mothander at gmail dot com
My misstake I think
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 14:01:30 2024 UTC