summaryrefslogtreecommitdiff
path: root/tests/classes/property_override_public_private.phpt
blob: 581d663b6083cd204db3790c0b66071422416ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--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