Bug #12561 Updated: RE: Bug # 12180
| From: | sniper@php.net | Date: | Fri, 03 Aug 2001 20:17:00 +0000 |
| Subject: | Bug #12561 Updated: RE: Bug # 12180 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-62011@lists.php.net to get a copy of this message | ||
ID: 12561
Updated by: sniper
Reported By: tnovak@lightspeedresearch.com
Old Status: Open
Status: Closed
Bug Type: Output Control
Operating System: Redhat Linux, SunOS, ...
PHP Version: 4.0.6
New Comment:
Like you said, fixed in CVS. :)
Previous Comments:
------------------------------------------------------------------------
[2001-08-03 16:05:07] tnovak@lightspeedresearch.com
Ergh, why isn't there a useful way to reply to bugs?
Anyway... regarding bug #12180, this bug occurs because the pseudo-function smart_str_0 apparently
isn't quite so smart :) In ext/standard/url_scanner_ex.c, it's being called with the
parameter &ctx->result; ctx->result.c is unitialized (and ctx->result.len==0) IF the
following conditions exist:
- you are using output buffering
- you are using sessions
- you haven't outputted anything
- you don't call ob_end_clean()
This can be replicated with the script:
<? ob_start(); session_start() ?>
I made a quick patch to ext/standard/php_smart_str.h to solve this problem, then realized that it
had already been fixed in the latest CVS version (200108031035). So, I made another patch which
adds 2 lines of code to ext/standard/url_scanner_ex.c based on that CVS snapshot:
====== cut ======
diff -ur php-4.0.6.orig/ext/standard/url_scanner_ex.c php-4.0.6/ext/standard/url_scanner_ex.c
--- php-4.0.6.orig/ext/standard/url_scanner_ex.c Thu Jun 21 02:29:04 2001
+++ php-4.0.6/ext/standard/url_scanner_ex.c Fri Aug 3 14:29:20 2001
@@ -667,6 +667,8 @@
mainloop(ctx, src, srclen);
*newlen = ctx->result.len;
+ if (!ctx->result.c)
+ smart_str_appendl(&ctx->result, "", 0);
smart_str_0(&ctx->result);
ctx->result.len = 0;
return ctx->result.c;
====== cut ======
You can either patch up 4.0.6 with this, or just use the latest dev snapshot. I chose to stick with
the patched released version, since who knows what bugs have since been introduced into the CVS
tree... :)
-Tony Novak
Application Developer, Lightspeed Research LLC
tnovak@lightspeedresearch.com
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12561&edit=1