From:             [EMAIL PROTECTED]
Operating system: Redhat Linux, SunOS, ...
PHP version:      4.0.6
PHP Bug Type:     Output Control
Bug description:  RE: Bug # 12180

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
[EMAIL PROTECTED]
-- 
Edit bug report at: http://bugs.php.net/?id=12561&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to