Hi Laruence,

ob_gzhandler is only available if php is built --with-zlib
This means that your test can fail with "Warning: ob_start(): function
'ob_gzhandler' not found or invalid function name" on depending on the
configure options.
Could you please add a SKIPIF and skip the test if ob_gzhandler isn't
defined?
thanks!

On Sun, Nov 13, 2011 at 5:11 AM, Xinchen Hui <larue...@php.net> wrote:

> laruence                                 Sun, 13 Nov 2011 04:11:57 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=319117
>
> Log:
> Fixed bug #60282 (Segfault when using ob_gzhandler() with open buffers)
>
> Bug: https://bugs.php.net/60282 (Assigned) Segfault when using
> ob_gzhandler() with open buffers
>
> Changed paths:
>    U   php/php-src/branches/PHP_5_4/NEWS
>    U   php/php-src/branches/PHP_5_4/main/output.c
>    A   php/php-src/branches/PHP_5_4/tests/output/bug60282.phpt
>    U   php/php-src/trunk/main/output.c
>    A   php/php-src/trunk/tests/output/bug60282.phpt
>
> Modified: php/php-src/branches/PHP_5_4/NEWS
> ===================================================================
> --- php/php-src/branches/PHP_5_4/NEWS   2011-11-12 23:01:24 UTC (rev
> 319116)
> +++ php/php-src/branches/PHP_5_4/NEWS   2011-11-13 04:11:57 UTC (rev
> 319117)
> @@ -10,6 +10,10 @@
>   . Fixed bug #59985 (show normal warning text for OCI_NO_DATA)
>     (Chris Jones)
>
> +- Output:
> +  . Fixed bug #60282 (Segfault when using ob_gzhandler() with open
> buffers).
> +    (Laruence)
> +
>  11 Nov 2011, PHP 5.4.0 RC1
>  - General improvements:
>   . Changed silent conversion of array to string to produce a notice.
> (Patrick)
>
> Modified: php/php-src/branches/PHP_5_4/main/output.c
> ===================================================================
> --- php/php-src/branches/PHP_5_4/main/output.c  2011-11-12 23:01:24 UTC
> (rev 319116)
> +++ php/php-src/branches/PHP_5_4/main/output.c  2011-11-13 04:11:57 UTC
> (rev 319117)
> @@ -508,14 +508,14 @@
>  * Check whether a certain output handler is in use */
>  PHPAPI int php_output_handler_started(const char *name, size_t name_len
> TSRMLS_DC)
>  {
> -       php_output_handler **handlers;
> +       php_output_handler ***handlers;
>        int i, count = php_output_get_level(TSRMLS_C);
>
>        if (count) {
> -               handlers = *(php_output_handler ***)
> zend_stack_base(&OG(handlers));
> +               handlers = (php_output_handler ***)
> zend_stack_base(&OG(handlers));
>
>                for (i = 0; i < count; ++i) {
> -                       if (name_len == handlers[i]->name_len &&
> !memcmp(handlers[i]->name, name, name_len)) {
> +                       if (name_len == (*(handlers[i]))->name_len &&
> !memcmp((*(handlers[i]))->name, name, name_len)) {
>                                return 1;
>                        }
>                }
>
> Added: php/php-src/branches/PHP_5_4/tests/output/bug60282.phpt
> ===================================================================
> --- php/php-src/branches/PHP_5_4/tests/output/bug60282.phpt
>               (rev 0)
> +++ php/php-src/branches/PHP_5_4/tests/output/bug60282.phpt     2011-11-13
> 04:11:57 UTC (rev 319117)
> @@ -0,0 +1,10 @@
> +--TEST--
> +Bug #60282 (Segfault when using ob_gzhandler() with open buffers)
> +--FILE--
> +<?php
> +ob_start();
> +ob_start();
> +ob_start('ob_gzhandler');
> +echo "done";
> +--EXPECT--
> +done
>
> Modified: php/php-src/trunk/main/output.c
> ===================================================================
> --- php/php-src/trunk/main/output.c     2011-11-12 23:01:24 UTC (rev
> 319116)
> +++ php/php-src/trunk/main/output.c     2011-11-13 04:11:57 UTC (rev
> 319117)
> @@ -508,14 +508,14 @@
>  * Check whether a certain output handler is in use */
>  PHPAPI int php_output_handler_started(const char *name, size_t name_len
> TSRMLS_DC)
>  {
> -       php_output_handler **handlers;
> +       php_output_handler ***handlers;
>        int i, count = php_output_get_level(TSRMLS_C);
>
>        if (count) {
> -               handlers = *(php_output_handler ***)
> zend_stack_base(&OG(handlers));
> +               handlers = (php_output_handler ***)
> zend_stack_base(&OG(handlers));
>
>                for (i = 0; i < count; ++i) {
> -                       if (name_len == handlers[i]->name_len &&
> !memcmp(handlers[i]->name, name, name_len)) {
> +                       if (name_len == (*(handlers[i]))->name_len &&
> !memcmp((*(handlers[i]))->name, name, name_len)) {
>                                return 1;
>                        }
>                }
>
> Added: php/php-src/trunk/tests/output/bug60282.phpt
> ===================================================================
> --- php/php-src/trunk/tests/output/bug60282.phpt
>      (rev 0)
> +++ php/php-src/trunk/tests/output/bug60282.phpt        2011-11-13
> 04:11:57 UTC (rev 319117)
> @@ -0,0 +1,10 @@
> +--TEST--
> +Bug #60282 (Segfault when using ob_gzhandler() with open buffers)
> +--FILE--
> +<?php
> +ob_start();
> +ob_start();
> +ob_start('ob_gzhandler');
> +echo "done";
> +--EXPECT--
> +done
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to