Bug #12227 Updated: Over writing output buffer causes segfault
| From: | yohgaki@php.net | Date: | Tue, 05 Feb 2002 23:28:22 +0000 |
| Subject: | Bug #12227 Updated: Over writing output buffer causes segfault | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-79290@lists.php.net to get a copy of this message | ||
ID: 12227
Updated by: yohgaki@php.net
-Summary: Output puffering causes Apache to SIGSEGV
Reported By: brueckner@respublica.de
-Status: Analyzed
+Status: Assigned
Bug Type: Output Control
Operating System: Linux 2.2.16-SMP
-PHP Version: 4.0.6
+PHP Version: 4.2.0-dev
Assigned To: yohgaki
New Comment:
Easy one to fix :)
<?php
ob_start("my_flush");
function my_flush($buffer)
{
$buffer = preg_replace("/(<!--REPLACE\\s.*?-->)/e",
"parse(\"\\1\")",
$buffer);
return $buffer;
}
?>
/home/yohgaki/public_html/bugs/12227/bug.php(9) : Warning - String is
not zero-terminated (ZZZZZZZZZZZZZZ
Previous Comments:
------------------------------------------------------------------------
[2002-01-02 18:48:32] yohgaki@php.net
The same issue was submitted recently and it seems there is a problem.
To Reporter: Do not change parameter passed, but assgin to new var and
return new var to prevent segfault for now. Please update PHP Version
if you have tried with newer PHP.
Assigned to myslef so that I don't forget this.
------------------------------------------------------------------------
[2002-01-02 13:58:14] lobbin@php.net
No feedback. Closing.
------------------------------------------------------------------------
[2001-12-12 04:31:14] yohgaki@php.net
I guess you have ob_end_clean() or ob_end_flush() in your auto prepend
file. Do you?
Anyway, does this happen with 4.1.0?
------------------------------------------------------------------------
[2001-07-18 06:13:58] brueckner@respublica.de
One more comment which I forgot before:
This does NOT happen when I do not use auto_prepend_file and call my
function inside the main script instead.
------------------------------------------------------------------------
[2001-07-18 06:07:05] brueckner@respublica.de
When using ob_start() with a script included via auto_prepend_file and
then doing something like this:
ob_start("my_flush");
function my_flush($buffer)
{
$buffer = preg_replace("/(<!--REPLACE\\s.*?-->)/e",
"parse(\"\\1\")",
$buffer);
return $buffer;
}
PHP 4.0.6 SIGSEGV's with this message in the error_log:
[Wed Jul 18 11:55:08 2001] Script: '/home/htdocs/test.php'
---------------------------------------
output.c(235) : Block 0x0824C940 status:
Beginning: Overrun (magic=0x08294990, expected=0x7312F8DC)
End: Unknown
---------------------------------------
./zend_execute.c(334) : Freeing 0x082A8CB4 (28131 bytes),
script=/home/htdocs/test.php
zend_variables.c(117) : Actual location (location was relayed)
[Wed Jul 18 11:55:08 2001] [notice] child pid 30192 exit signal
Segmentation fault (11)
If I replace the line
$buffer = preg_replace("/(<!--REPLACE\\s.*?-->)/e",
"parse(\"\\1\")",
$buffer);
with
$newbuffer = preg_replace("/(<!--REPLACE\\s.*?-->)/e",
"parse(\"\\1\")",
$buffer);
it works fine.
Any ideas for a fix?
Harry
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12227&edit=1