Commit:    f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5
Author:    Michael Wallner <m...@php.net>         Fri, 4 Oct 2013 11:22:17 +0200
Parents:   dc3d360a0ff8c17cb2ce2030813d30b578249be9
Branches:  PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=f6ff3a28d60c24dea2a05344d9b7eb823f09b4e5

Log:
Fixed bug #64230 (XMLReader does not suppress errors)

Bugs:
https://bugs.php.net/64230

Changed paths:
  M  NEWS
  M  ext/xmlreader/php_xmlreader.c
  A  ext/xmlreader/tests/bug64230.phpt


Diff:
diff --git a/NEWS b/NEWS
index ffde301..9963714 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP                                                             
           NEWS
 
 - XMLReader:
   . Fixed bug #51936 (Crash with clone XMLReader). (Mike)
+  . Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
 
 
 ?? ??? 2013, PHP 5.4.21
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 8b80320..adf2821 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -805,7 +805,6 @@ PHP_METHOD(xmlreader, read)
        if (intern != NULL && intern->ptr != NULL) {
                retval = xmlTextReaderRead(intern->ptr);
                if (retval == -1) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
                        RETURN_FALSE;
                } else {
                        RETURN_BOOL(retval);
@@ -847,7 +846,6 @@ PHP_METHOD(xmlreader, next)
                        retval = xmlTextReaderNext(intern->ptr); 
                }
                if (retval == -1) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error 
Occurred while reading");
                        RETURN_FALSE;
                } else {
                        RETURN_BOOL(retval);
diff --git a/ext/xmlreader/tests/bug64230.phpt 
b/ext/xmlreader/tests/bug64230.phpt
new file mode 100644
index 0000000..0b07092
--- /dev/null
+++ b/ext/xmlreader/tests/bug64230.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #64230 (XMLReader does not suppress errors)
+--SKIPIF--
+<?php
+extension_loaded("xmlreader") or die("skip requires xmlreader");
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+function show_internal_errors() {
+       foreach (libxml_get_errors() as $error) {
+               printf("Internal: %s\n", $error->message);
+       }
+       libxml_clear_errors();
+}
+
+echo "Internal errors TRUE\n";
+libxml_use_internal_errors(true);
+
+$x = new XMLReader;
+$x->xml("<root att/>");
+$x->read();
+
+show_internal_errors();
+
+echo "Internal errors FALSE\n";
+libxml_use_internal_errors(false);
+
+$x = new XMLReader;
+$x->xml("<root att/>");
+$x->read();
+
+show_internal_errors();
+
+?>
+Done
+--EXPECTF--
+Test
+Internal errors TRUE
+Internal: Specification mandate value for attribute att
+
+Internal errors FALSE
+
+Warning: XMLReader::read(): %s: parser error : Specification mandate value for 
attribute att in %s on line %d
+
+Warning: XMLReader::read(): <root att/> in %s on line %d
+
+Warning: XMLReader::read():          ^ in %s on line %d
+Done


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to