Bug #80063 [NEW]: XMLReader not suppressing warnings

From: Date: Sat, 05 Sep 2020 10:50:50 +0000
Subject: Bug #80063 [NEW]: XMLReader not suppressing warnings
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228895@lists.php.net to get a copy of this message
From:             pmishev at gmail dot com
Operating system: Ubuntu 18.04
PHP version:      7.3.22
Package:          XML Reader
Bug Type:         Bug
Bug description:XMLReader not suppressing warnings

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
(
)


-- 
Edit bug report at https://bugs.php.net/bug.php?id=80063&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80063&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80063&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80063&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80063&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80063&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80063&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80063&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80063&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80063&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80063&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80063&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80063&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80063&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80063&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80063&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80063&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80063&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#228895) next »