From:             
Operating system: MacOS
PHP version:      5.4.0RC1
Package:          Output Control
Bug Type:         Bug
Bug description:Segfault when using ob_gzhandler() with open buffers

Description:
------------
When creating multiple output buffers, and then switching the output
callback, 
PHP5.4RC1 segfaults.  The same code works without any problems in
PHP5.3.8.

zlib version: 1.2.5

Test script and gdb trace included below.


Test script:
---------------
--Test script--
<?php
ob_start();
ob_start();
echo "here\n";

ob_start('ob_gzhandler');

--gdb backtrace--
#0  0x000000010043cf24 in php_output_handler_started (name=0x10063c343
"zlib output compression", name_len=23) at
/Users/markstory/Sites/php/php-src/main/output.c:518
518                             if (name_len == handlers[i]->name_len && 
!memcmp(handlers[i]->name,
name, name_len)) {
(gdb) bt
#0  0x000000010043cf24 in php_output_handler_started (name=0x10063c343
"zlib output compression", name_len=23) at
/Users/markstory/Sites/php/php-src/main/output.c:518
#1  0x000000010043cf97 in php_output_handler_conflict
(handler_new=0x1012d12d0 "ob_gzhandler", handler_new_len=12,
handler_set=0x10063c343 "zlib output compression", handler_set_len=23) at
/Users/markstory/Sites/php/php-src/main/output.c:532
#2  0x0000000100167c9a in php_zlib_output_conflict_check
(handler_name=0x1012d12d0 "ob_gzhandler", handler_name_len=12) at
/Users/markstory/Sites/php/php-src/ext/zlib/zlib.c:56
#3  0x000000010043ce05 in php_output_handler_start (handler=0x1012d04e8) at
/Users/markstory/Sites/php/php-src/main/output.c:484
#4  0x000000010043ca25 in php_output_start_user
(output_handler=0x1012cda68, chunk_size=0, flags=112) at
/Users/markstory/Sites/php/php-src/main/output.c:382
#5  0x000000010043ec2b in zif_ob_start (ht=1, return_value=0x1012cd9f0,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at
/Users/markstory/Sites/php/php-src/main/output.c:1252
#6  0x00000001004fcb30 in zend_do_fcall_common_helper_SPEC
(execute_data=0x1012980d8) at zend_vm_execute.h:642
#7  0x0000000100504658 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0x1012980d8) at zend_vm_execute.h:2215
#8  0x00000001004fb282 in execute (op_array=0x1012cf938) at
zend_vm_execute.h:410
#9  0x00000001004bd643 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /Users/markstory/Sites/php/php-src/Zend/zend.c:1272
#10 0x00000001004246c2 in php_execute_script (primary_file=0x7fff5fbff3b0)
at /Users/markstory/Sites/php/php-src/main/main.c:2414
#11 0x0000000100608d13 in do_cli (argc=2, argv=0x7fff5fbff690) at
/Users/markstory/Sites/php/php-src/sapi/cli/php_cli.c:983
#12 0x000000010060a069 in main (argc=2, argv=0x7fff5fbff690) at
/Users/markstory/Sites/php/php-src/sapi/cli/php_cli.c:1356


Expected result:
----------------
here should be output.

Actual result:
--------------
Segmentation Fault

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60282&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60282&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60282&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60282&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60282&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60282&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60282&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60282&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60282&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60282&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60282&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60282&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60282&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60282&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60282&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60282&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60282&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60282&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60282&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60282&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60282&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60282&r=mysqlcfg

Reply via email to