summaryrefslogtreecommitdiff
path: root/tests/classes/ctor_visibility.phpt
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2006-08-07 23:24:33 +0000
committerMarcus Boerger <helly@php.net>2006-08-07 23:24:33 +0000
commitc1c2a0d294cefc136d7eff00b6ef2e60c7ad7f8e (patch)
tree83cb9263d34a4aa2cd671acbc7076f7162426b25 /tests/classes/ctor_visibility.phpt
parent886d302575b64a53a9e80c0cf40a9cef37c46115 (diff)
downloadphp-git-c1c2a0d294cefc136d7eff00b6ef2e60c7ad7f8e.tar.gz
- MFH Fixed Bug #38064 ignored constructor visibility
Diffstat (limited to 'tests/classes/ctor_visibility.phpt')
-rwxr-xr-xtests/classes/ctor_visibility.phpt69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/classes/ctor_visibility.phpt b/tests/classes/ctor_visibility.phpt
new file mode 100755
index 0000000000..afc823cb82
--- /dev/null
+++ b/tests/classes/ctor_visibility.phpt
@@ -0,0 +1,69 @@
+--TEST--
+ZE2 A private constructor cannot be called
+--FILE--
+<?php
+
+class Test
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
+}
+
+class Derived extends Test
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct();
+ }
+
+ static function f()
+ {
+ new Derived;
+ }
+}
+
+Derived::f();
+
+class TestPriv
+{
+ private function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ static function f()
+ {
+ new TestPriv;
+ }
+}
+
+TestPriv::f();
+
+class DerivedPriv extends TestPriv
+{
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct();
+ }
+
+ static function f()
+ {
+ new DerivedPriv;
+ }
+}
+
+DerivedPriv::f();
+
+?>
+===DONE===
+--EXPECTF--
+Derived::__construct()
+Test::__construct()
+TestPriv::__construct()
+DerivedPriv::__construct()
+
+Fatal error: Cannot call private TestPriv::__constrcut() in %sctor_visibility.php on line %d