php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81521 XMLReader::getParserProperty may throw with a valid property
Submitted: 2021-10-12 14:20 UTC Modified: 2021-10-12 14:33 UTC
From: fabien dot villepinte at gmail dot com Assigned:
Status: Closed Package: XML Reader
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabien dot villepinte at gmail dot com
New email:
PHP Version: OS:

 

 [2021-10-12 14:20 UTC] fabien dot villepinte at gmail dot com
Description:
------------
XMLReader::getParserProperty() throws ValueError when the instance is empty, while it should return false.

Test script:
---------------
$reader = new XMLReader();
var_dump($reader->getParserProperty(XMLReader::LOADDTD));

Expected result:
----------------
bool(false)

Actual result:
--------------
Fatal error: Uncaught ValueError: XMLReader::getParserProperty(): Argument #1 ($property) must be a valid parser property in ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-12 14:33 UTC] nikic@php.net
-Status: Open +Status: Verified
 [2021-10-12 14:33 UTC] nikic@php.net
I believe throwing here is correct, it's just the message that is wrong. This doesn't fail because the property is invalid, but because the object hasn't been initialized yet. At that time, setParserProperty/getParserProperty cannot be meaningfully used.
 [2021-10-12 14:44 UTC] git@php.net
Automatic comment on behalf of nikic
Revision: https://github.com/php/php-src/commit/53f89219abdea49099805562d5020d4e21785d55
Log: Fix bug #81521
 [2021-10-12 14:44 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 19 21:03:36 2022 UTC