From: Robin Fernandes Date: Sun, 28 Dec 2008 19:50:58 +0000 (+0000) Subject: Fix bugs #46900 and #46903. X-Git-Tag: php-5.4.0alpha1~191^2~4725 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c8f0cf3d8d328d7e81acd516a7563f400ed5367;p=php Fix bugs #46900 and #46903. --- diff --git a/main/output.c b/main/output.c index 5a2b8641d3..c5c49c7873 100644 --- a/main/output.c +++ b/main/output.c @@ -983,7 +983,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl ZVAL_LONG(ob_mode, (long) context->op); zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode); -#define PHP_OUTPUT_USER_SUCCESS(retval) (retval && (Z_TYPE_P(retval) != IS_NULL) && (Z_TYPE_P(retval) != IS_BOOL || Z_BVAL_P(retval))) +#define PHP_OUTPUT_USER_SUCCESS(retval) (retval && !(Z_TYPE_P(retval) == IS_BOOL && Z_BVAL_P(retval)==0)) if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL TSRMLS_CC) && PHP_OUTPUT_USER_SUCCESS(retval)) { /* user handler may have returned TRUE */ status = PHP_OUTPUT_HANDLER_NO_DATA; @@ -1342,6 +1342,8 @@ PHP_FUNCTION(ob_start) } if (chunk_size < 0) { chunk_size = 0; + } else if (chunk_size == 1) { + chunk_size = 4096; } if (SUCCESS != php_output_start_user(output_handler, chunk_size, flags TSRMLS_CC)) { diff --git a/tests/output/bug46900.phpt b/tests/output/bug46900.phpt new file mode 100644 index 0000000000..42f65e4342 --- /dev/null +++ b/tests/output/bug46900.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #46900 (Unexpected behaviour in HEAD when output buffer callback returns null) +--FILE-- + +--EXPECTF-- +done \ No newline at end of file diff --git a/tests/output/bug46903.phpt b/tests/output/bug46903.phpt new file mode 100644 index 0000000000..c0933d2b06 --- /dev/null +++ b/tests/output/bug46903.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #46903 (ob_start(): Special $chunk_size value of 1 is not honoured in HEAD) +--FILE-- +1, these two chars should +// come out as part of a single flush: +echo "1"; +echo "2"; +?> +--EXPECTF-- +[1] int(4096) +12 \ No newline at end of file diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt index 03980c2dd9..8454e7d534 100644 --- a/tests/output/ob_014.phpt +++ b/tests/output/ob_014.phpt @@ -2,13 +2,21 @@ output buffering - failure --FILE-- --EXPECTF-- -foo - -Warning: (null)() expects exactly 1 parameter, 2 given in %s on line %d +Array +( + [type] => 2 + [message] => str_rot13() expects exactly 1 parameter, 2 given + [file] => %s + [line] => 7 +) \ No newline at end of file diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt index 6454fcd2e5..4de45396d8 100644 --- a/tests/output/ob_015.phpt +++ b/tests/output/ob_015.phpt @@ -4,8 +4,19 @@ output buffering - failure --EXPECTF-- -foo - -Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d +Array +( + [type] => 2 + [message] => str_rot13() expects exactly 1 parameter, 2 given + [file] => %s + [line] => 7 +) \ No newline at end of file diff --git a/tests/output/ob_start_basic_002.phpt b/tests/output/ob_start_basic_002.phpt index 3ed5b6ebd1..92d9069f32 100644 --- a/tests/output/ob_start_basic_002.phpt +++ b/tests/output/ob_start_basic_002.phpt @@ -1,7 +1,5 @@ --TEST-- ob_start(): Check behaviour with various callback return values. ---XFAIL-- -PHP6 behaves differently from PHP5 when callback returns null. See bug 46900. --FILE--