]> granicus.if.org Git - php/commitdiff
Add test against mixing static/non static methods
authorMarcus Boerger <helly@php.net>
Sun, 24 Nov 2002 15:50:28 +0000 (15:50 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 24 Nov 2002 15:50:28 +0000 (15:50 +0000)
tests/classes/static_mix_1.phpt [new file with mode: 0644]
tests/classes/static_mix_2.phpt [new file with mode: 0644]

diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt
new file mode 100644 (file)
index 0000000..47950b3
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+You cannot overload astatic methods with a non static methods
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+
+class pass {
+       static function show() {
+               echo "Call to function pass::show()\n";
+       }
+}
+
+class fail extends pass {
+       function show() {
+               echo "Call to function fail::show()\n";
+       }
+}
+
+pass::show();
+fail::show();
+
+echo "Done\n"; // shouldn't be displayed of cause
+?>
+--EXPECTF--
+Fatal error: Cannot make static method pass::show() non static in class fail in %s on line %d
\ No newline at end of file
diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt
new file mode 100644 (file)
index 0000000..949b9a1
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+You cannot overload a non static methods with a static methods
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+
+class pass {
+       function show() {
+               echo "Call to function pass::show()\n";
+       }
+}
+
+class fail extends pass {
+       static function show() {
+               echo "Call to function fail::show()\n";
+       }
+}
+
+$t = new pass();
+$t->show();
+fail::show();
+
+echo "Done\n"; // shouldn't be displayed of cause
+?>
+--EXPECTF--
+Fatal error: Cannot make non static method pass::show() static in class fail in %s on line %d
\ No newline at end of file