Bug #81521 [Ver->Csd]: XMLReader::getParserProperty may throw with a valid property

From: Date: Tue, 12 Oct 2021 14:44:16 +0000
Subject: Bug #81521 [Ver->Csd]: XMLReader::getParserProperty may throw with a valid property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237165@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81521&edit=1 ID: 81521 Updated by: git@php.net Reported by: fabien dot villepinte at gmail dot com Summary: XMLReader::getParserProperty may throw with a valid property -Status: Verified +Status: Closed Type: Bug Package: XML Reader PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: https://github.com/php/php-src/commit/53f89219abdea49099805562d5020d4e21785d55 Log: Fix bug #81521 Previous Comments: ------------------------------------------------------------------------ [2021-10-12 14:33:12] 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:20:57] 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 ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81521&edit=1

« previous php.bugs (#237165) next »