]> granicus.if.org Git - php/commitdiff
add tests for fixed bugs
authorStanislav Malyshev <stas@php.net>
Mon, 16 Jun 2003 09:20:42 +0000 (09:20 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 16 Jun 2003 09:20:42 +0000 (09:20 +0000)
tests/lang/bug18872.phpt [new file with mode: 0644]
tests/lang/bug23279.phpt [new file with mode: 0644]
tests/lang/bug23384.phpt [new file with mode: 0644]

diff --git a/tests/lang/bug18872.phpt b/tests/lang/bug18872.phpt
new file mode 100644 (file)
index 0000000..2e3dc22
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #18872 (class constant used as default parameter)
+--FILE--
+<?php   
+class FooBar {   
+       const BIFF = 3;   
+}   
+   
+function foo($biff = FooBar::BIFF) {   
+       echo $biff . "\n";   
+}   
+   
+foo();   
+foo();   
+?>   
+--EXPECT--
+3
+3
diff --git a/tests/lang/bug23279.phpt b/tests/lang/bug23279.phpt
new file mode 100644 (file)
index 0000000..78d7850
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Bug #23279 (exception handler stops after first function call)
+--FILE--
+<?php
+ob_start();
+set_exception_handler('redirect_on_error');
+echo "Hello World\n";
+throw new Exception;
+
+function redirect_on_error($e) {
+    ob_end_clean();
+    echo "Goodbye Cruel World\n";
+}
+?>
+--EXPECT--
+Goodbye Cruel World
diff --git a/tests/lang/bug23384.phpt b/tests/lang/bug23384.phpt
new file mode 100644 (file)
index 0000000..e6184c4
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Bug #23384 (use of class constants in statics)
+--FILE--
+<?php
+define('TEN', 10);
+class Foo {
+    const HUN = 100;
+    function test($x = Foo::HUN) {
+        static $arr2 = array(TEN => 'ten');
+        static $arr = array(Foo::HUN => 'ten');
+
+        print_r($arr);
+        print_r($arr2);
+        print_r($x);
+    }
+}
+
+Foo::test();   
+echo Foo::HUN."\n";
+?>
+--EXPECT--
+Array
+(
+    [100] => ten
+)
+Array
+(
+    [10] => ten
+)
+100100