summaryrefslogtreecommitdiff
path: root/tests/classes/property_override_public_protected.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/classes/property_override_public_protected.phpt')
-rw-r--r--tests/classes/property_override_public_protected.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/classes/property_override_public_protected.phpt b/tests/classes/property_override_public_protected.phpt
new file mode 100644
index 0000000..68fdf82
--- /dev/null
+++ b/tests/classes/property_override_public_protected.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Redeclare inherited public property as protected.
+--FILE--
+<?php
+ class A
+ {
+ public $p = "A::p";
+ function showA()
+ {
+ echo $this->p . "\n";
+ }
+ }
+
+ class B extends A
+ {
+ protected $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
+