[php-src] Issue #14183: XMLReader::open() can't be overridden

From: Date: Thu, 09 May 2024 09:24:43 +0000
Subject: [php-src] Issue #14183: XMLReader::open() can't be overridden
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246884@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14183 Author: dzentota ### Description The following code https://3v4l.org/7iLBU: ```php <?php namespace My; class XMLReader extends \XMLReader { public static function open(string $uri, string $encoding = null, int $flags = 0): bool|\XMLReader { echo 'overridden', PHP_EOL; return true; } } XMLReader::open('asdf'); $o = new XMLReader; $o->open('asdf'); ``` Resulted in this output: ``` overridden Warning: XMLReader::open(): Unable to open source data ``` But I expected this output instead: ``` overridden overridden ``` If I do NOT extend \XMLReader then everything works as expected https://3v4l.org/SKAba ```php <?php namespace My; class XMLReader { public static function open(string $uri, string $encoding = null, int $flags = 0): bool|\XMLReader { echo 'overridden', PHP_EOL; return true; } } XMLReader::open('asdf'); $o = new XMLReader; $o->open('asdf'); ``` Output: ``` overridden overridden ``` ### PHP Version PHP 8.0+ ### Operating System _No response_

« previous php.bugs (#246884) next »