php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80063 XMLReader not suppressing warnings
Submitted: 2020-09-05 10:50 UTC Modified: -
From: pmishev at gmail dot com Assigned:
Status: Open Package: XML Reader
PHP Version: 7.3.22 OS: Ubuntu 18.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pmishev at gmail dot com
New email:
PHP Version: OS:

 

 [2020-09-05 10:50 UTC] pmishev at gmail dot com
Description:
------------
Warnings when opening an non-existing XML file are not being suppressed.

Neither libxml_use_internal_errors(true), nor setting LIBXML_NOERROR | LIBXML_NOWARNING has any effect whatsoever.

The problem seems related to https://bugs.php.net/bug.php?id=64230

Test script:
---------------
<?php

$xml = 'compress.zlib://inexisting_file.xml.gz';

libxml_use_internal_errors(true);

$reader = new XMLReader();
$reader->open($xml, null, LIBXML_NOERROR | LIBXML_NOWARNING);

$reader->read();

print_r(libxml_get_errors());


Expected result:
----------------
No PHP warnings thrown, and an error showing up in print_r


Actual result:
--------------
PHP Warning:  XMLReader::open(compress.zlib://inexisting_file.xml.gz): failed to open stream: operation failed in test.php on line 8
PHP Warning:  XMLReader::open(): Unable to open source data in test.php on line 8
PHP Warning:  XMLReader::read(): Load Data before trying to read in test.php on line 10
Array
(
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 03:01:24 2020 UTC