php-src/tests/classes/property_override_publicStatic_protectedStatic.phpt
Nikita Popov 380e705fc2 Use consistent line numbers for early binding errors
Non-early-bound classes report inheritance errors at the first line
of the class, if no better line information is available (we should
really store line numbers for properties at least...) Early bound
classes report it at the last line of the class instead.

Make the error reporting consistent by always reporting at the
first line.
2021-07-28 12:35:20 +02:00

30 lines
521 B
PHP

--TEST--
Redeclare inherited public static property as protected static.
--FILE--
<?php
class A
{
public static $p = "A::p (static)";
static function showA()
{
echo self::$p . "\n";
}
}
class B extends A
{
protected static $p = "B::p (static)";
static function showB()
{
echo self::$p . "\n";
}
}
A::showA();
B::showA();
B::showB();
?>
--EXPECTF--
Fatal error: Access level to B::$p must be public (as in class A) in %s on line 11