ID: 12227 Updated by: [EMAIL PROTECTED] -Summary: Over writing output buffer causes segfault Reported By: [EMAIL PROTECTED] Status: Assigned Bug Type: Output Control Operating System: Linux 2.2.16-SMP PHP Version: 4.2.0-dev Assigned To: yohgaki New Comment:
Anyone who are interested in this problem. here is a patch for this problem. This should solve unwanted free for this specific case. Question is do we really want this? Index: main/output.c =================================================================== RCS file: /repository/php4/main/output.c,v retrieving revision 1.84 diff -u -r1.84 output.c --- main/output.c 7 Feb 2002 02:50:28 -0000 1.84 +++ main/output.c 7 Feb 2002 06:31:35 -0000 @@ -164,7 +164,7 @@ ALLOC_INIT_ZVAL(orig_buffer); ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 0); orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */ - orig_buffer->is_ref=1; + orig_buffer->is_ref=0; ALLOC_INIT_ZVAL(z_status); ZVAL_LONG(z_status, status); Previous Comments: ------------------------------------------------------------------------ [2002-02-05 18:28:22] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [2002-01-02 18:48:32] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] No feedback. Closing. ------------------------------------------------------------------------ [2001-12-12 04:31:14] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/12227 -- Edit this bug report at http://bugs.php.net/?id=12227&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php