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

From: Date: Tue, 12 Oct 2021 14:33:12 +0000
Subject: Bug #81521 [Opn->Ver]: XMLReader::getParserProperty may throw with a valid property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237164@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: nikic@php.net Reported by: fabien dot villepinte at gmail dot com Summary: XMLReader::getParserProperty may throw with a valid property -Status: Open +Status: Verified Type: Bug Package: XML Reader PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#237164) next »