]> granicus.if.org Git - php/commitdiff
- Fix old behaviour, ob_list_handlers() should always return an array
authorJohannes Schlüter <johannes@php.net>
Sat, 3 Mar 2007 10:27:04 +0000 (10:27 +0000)
committerJohannes Schlüter <johannes@php.net>
Sat, 3 Mar 2007 10:27:04 +0000 (10:27 +0000)
main/output.c
tests/output/ob_020.phpt [new file with mode: 0644]

index 538e8799618a9e9a549be3785eb06ce81d2ae50a..f3aac67ca604f73ea402d218a6c2249803b32b3a 100644 (file)
@@ -1504,11 +1504,13 @@ PHP_FUNCTION(ob_list_handlers)
        if (ZEND_NUM_ARGS()) {
                ZEND_WRONG_PARAM_COUNT();
        }
+
+       array_init(return_value);
+
        if (!OG(active)) {
-               RETURN_FALSE;
+               return;
        }
        
-       array_init(return_value);
        zend_stack_apply_with_argument(OG(handlers), ZEND_STACK_APPLY_BOTTOMUP, php_output_stack_apply_list, return_value);
 }
 /* }}} */
diff --git a/tests/output/ob_020.phpt b/tests/output/ob_020.phpt
new file mode 100644 (file)
index 0000000..05f66cc
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+output buffering - ob_list_handlers
+--FILE--
+<?php
+print_r(ob_list_handlers());
+
+ob_start();
+print_r(ob_list_handlers());
+
+ob_start();
+print_r(ob_list_handlers());
+
+ob_end_flush();
+print_r(ob_list_handlers());
+
+ob_end_flush();
+print_r(ob_list_handlers());
+?>
+--EXPECT--
+Array
+(
+)
+Array
+(
+    [0] => default output handler
+)
+Array
+(
+    [0] => default output handler
+    [1] => default output handler
+)
+Array
+(
+    [0] => default output handler
+)
+Array
+(
+)