php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35666 ob_start crash
Submitted: 2005-12-14 06:04 UTC Modified: 2005-12-14 06:27 UTC
From: zhonghaijun at yahoo dot com dot cn Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5CVS-2005-12-14 (CVS) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zhonghaijun at yahoo dot com dot cn
New email:
PHP Version: OS:

 

 [2005-12-14 06:04 UTC] zhonghaijun at yahoo dot com dot cn
Description:
------------
Ob_start crash

Seems dead loop when I debugged the programme



Reproduce code:
---------------
<?php

function callback($buffer)
{
	ob_clean();
	return $buffer."\n";
}
var_dump(ob_start("callback", 2));
echo "\nHi!abc";
?>

Expected result:
----------------
Hi!abc

Actual result:
--------------
segment fault

BT
(gdb) bt
#0  zend_call_function (fci=0xbf0a5080, fci_cache=0x0)
    at /home/junz/src/PHP/v506/SRC/Zend/zend_execute_API.c:577
#1  0x08073aae in call_user_function_ex (function_table=0x0, object_pp=0x0,
    function_name=0x0, retval_ptr_ptr=0x0, param_count=0, params=0x0, no_separation=0,
    symbol_table=0x0) at /home/junz/src/PHP/v506/SRC/Zend/zend_execute_API.c:559
#2  0x08166745 in php_end_ob_buffer (send_buffer=0 '\0', just_flush=1 '\001')
    at /home/junz/src/PHP/v506/SRC/main/output.c:240
#3  0x081673a8 in zif_ob_clean (ht=0, return_value=0x8584ebc, this_ptr=0x0,
    return_value_used=0) at /home/junz/src/PHP/v506/SRC/main/output.c:788
#4  0x081b0ee6 in zend_do_fcall_common_helper (execute_data=0xbf0a5260, opline=0x82a51bc,
    op_array=0x82a53b8) at /home/junz/src/PHP/v506/SRC/Zend/zend_execute.c:2761
#5  0x081adb49 in execute (op_array=0x82a53b8)
    at /home/junz/src/PHP/v506/SRC/Zend/zend_execute.c:1438
#6  0x08074198 in zend_call_function (fci=0xbf0a53b0, fci_cache=0x0)
    at /home/junz/src/PHP/v506/SRC/Zend/zend_execute_API.c:875
#7  0x08073aae in call_user_function_ex (function_table=0x0, object_pp=0x0,
    function_name=0x0, retval_ptr_ptr=0x0, param_count=0, params=0x0, no_separation=0,
    symbol_table=0x0) at /home/junz/src/PHP/v506/SRC/Zend/zend_execute_API.c:559
#8  0x08166745 in php_end_ob_buffer (send_buffer=0 '\0', just_flush=1 '\001')
    at /home/junz/src/PHP/v506/SRC/main/output.c:240
#9  0x081673a8 in zif_ob_clean (ht=0, return_value=0x8584d94, this_ptr=0x0,
    return_value_used=0) at /home/junz/src/PHP/v506/SRC/main/output.c:788
#10 0x081b0ee6 in zend_do_fcall_common_helper (execute_data=0xbf0a5590, opline=0x82a51bc,
    op_array=0x82a53b8) at /home/junz/src/PHP/v506/SRC/Zend/zend_execute.c:2761
#11 0x081adb49 in execute (op_array=0x82a53b8)
    at /home/junz/src/PHP/v506/SRC/Zend/zend_execute.c:1438
#12 0x08074198 in zend_call_function (fci=0xbf0a56e0, fci_cache=0x0)
    at /home/junz/src/PHP/v506/SRC/Zend/zend_execute_API.c:875
#13 0x08073aae in call_user_function_ex (function_table=0x0, object_pp=0x0,
    function_name=0x0, retval_ptr_ptr=0x0, param_count=0, params=0x0, no_separation=0,
and so many records below....

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-14 06:27 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

RTFM:

"ob_end_clean(), ob_end_flush(), ob_clean(), ob_flush() and ob_start()  may not be called from a callback function. If you call them from callback function, the behavior is undefined."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 08:01:29 2025 UTC