Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4179 invoked from network); 8 Aug 2009 09:47:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2009 09:47:28 -0000 X-Host-Fingerprint: 78.43.121.216 HSI-KBW-078-043-121-216.hsi4.kabel-badenwuerttemberg.de Received: from [78.43.121.216] ([78.43.121.216:2216] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/20-03345-EA94D7A4 for ; Sat, 08 Aug 2009 05:47:27 -0400 Message-ID: <1B.20.03345.EA94D7A4@pb1.pair.com> To: internals@lists.php.net Date: Sat, 08 Aug 2009 11:47:23 +0200 User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 References: <7f3ed2c30907300148k246bb727qe60b888ddfe5523f@mail.gmail.com> In-Reply-To: <7f3ed2c30907300148k246bb727qe60b888ddfe5523f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Posted-By: 78.43.121.216 Subject: Re: [PHP-DEV] Re: RFC: Replacing errors with Exceptions From: mail@dasprids.de (Ben Scholzen 'DASPRiD') Hannes Magnusson wrote on 30.07.2009 10:48: > Are you intentionally ignoring what I've said previously in the thread? > Please stop using SimpleXML as an example. You do not need @. > libxml_use_internal_errors(true); > $sxe = simplexml_load_string(""); > if (!$sxe) { > echo "Failed loading XML\n"; > foreach(libxml_get_errors() as $error) { > echo "\t", $error->message; > } > } > > Outputs: > Failed loading XML > Blank needed here > parsing XML declaration: '?>' expected > Opening and ending tag mismatch: xml line 1 and broken > Premature end of data in tag broken line 1 > > No PHP warnings at all. > > > Again. The examples you are looking for are network issues with > fopen(), file_get_contents() and such things. I tested libxml_use_internal_errors() with XMLReader now, and it doesn't really work as intended. When calling $reader->read(), and reaching an invalid node, there is in fact the error stored in libxml_get_errors(), but PHP additionally still throws a "parse error" warning. When then trying to supress it there with @$reader->reader(), PHP doesn't throw the warning, but libxml also doesn't store the error internally. Passing libxml_noerror or libxml_nowarning to $reader->open() doesn't have any effect at all.