mirror of
https://github.com/php/php-src.git
synced 2024-12-28 11:20:29 +08:00
35 lines
498 B
PHP
35 lines
498 B
PHP
--TEST--
|
|
Redeclare inherited public property as private.
|
|
--FILE--
|
|
<?php
|
|
class A
|
|
{
|
|
public $p = "A::p";
|
|
function showA()
|
|
{
|
|
echo $this->p . "\n";
|
|
}
|
|
}
|
|
|
|
class B extends A
|
|
{
|
|
private $p = "B::p";
|
|
function showB()
|
|
{
|
|
echo $this->p . "\n";
|
|
}
|
|
}
|
|
|
|
|
|
$a = new A;
|
|
$a->showA();
|
|
|
|
$b = new B;
|
|
$b->showA();
|
|
$b->showB();
|
|
?>
|
|
--EXPECTF--
|
|
|
|
Fatal error: Access level to B::$p must be public (as in class A) in %s on line 18
|
|
|