Closed
Description
Description
The following code https://3v4l.org/7iLBU:
<?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
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