Thanks you for report :)
Could you apply attached patch. It should fix the problem.
Please let me know if this patch fixed it or not.

--
Yasuo Ohgaki

[EMAIL PROTECTED] wrote:

> ID: 13078
> User updated by: [EMAIL PROTECTED]
> Reported By: [EMAIL PROTECTED]
> Status: Critical
> Bug Type: Session related
> Operating System: FreeBSD 4.x
> PHP Version: 4.0.6, 4.1.0
> New Comment:
> 
> Sorry, but further testing revealed when sess_read
> 
>   return NULL;
> 
> for when nothing was found caused problems sometimes, not always!
> 
> However
> 
>   return '';
> 
> seems to work all of the time!  
> 
> Looks like sess_write has to return a '' (null string) It cannot return NULL, nor it 
>return false;
> 
> Otherise sess_write will never be called!
> ---ends---
> 
> Previous Comments:
> ------------------------------------------------------------------------
> 
> [2001-12-14 00:19:21] [EMAIL PROTECTED]
> 
> Problem solved in 4.1.0 (release).
> 
> All thanks to [EMAIL PROTECTED] for pointing me to his very well written code!
> 
> I found the reason my sess_write was never called with register_globals = off was 
>because my sess_read function was something like this:
> 
>    sess_read( $key)
>    ...
>    if I find stuff for $key from PostgreSQL {
>       return $valuesfound;
>    }
>    else {
>       return false;
>    }
> 
> The problem was with "return false;"
> After changing:
> 
>     return false;
> 
> to
>     return NULL;
> 
> things worked.
> 
> Don't know why the "return false" worked with "register_globals=on" and 
>"register_global=off" requires sess_read to return NULL if nothing was found...
> 
> THANKS again to [EMAIL PROTECTED] for his code and my apologise for wasting people's 
>time.
> 
> Please feel free to close this bug report.  I am not closing it because 
>[EMAIL PROTECTED] brought up something which I don't know about nor can I duplicate. 
> ---ends---
> 
>       
> 
> ------------------------------------------------------------------------
> 
> [2001-12-13 22:04:18] [EMAIL PROTECTED]
> 
> Just to note that I can not reproduce this with latest CVS.
> 
> --Jani
> 
> 
> ------------------------------------------------------------------------
> 
> [2001-12-13 05:55:59] [EMAIL PROTECTED]
> 
> PHP 4.1.0 (release)
> 
> TEST SCRIPT:
> <?php
>     session_start();
>     $_SESSION['test'] = 'YES';
>     echo ini_get('register_globals');
> ?>
> 
> SESSION FILE CONTENTS:
> 
> With register_globals = 1:
> <empty>
> 
> With register_globals = 0:
> test|s:3:"YES";
> 
> ------------------------------------------------------------------------
> 
> [2001-12-13 05:14:14] [EMAIL PROTECTED]
> 
> Yes, I have problems with or without session_register/unregister.
> 
> In fact, I first tried:
> 
>    $_SESSION["varname"] = "somevaluehere";
> 
> to see if it was saved. But it was NOT.  So, I tried this:
> 
>    session_register("varname");
>    $_SESSION["varname"] = "somevaluehere";
> 
> thinking it would help.  Anyhow, none of the above worked.  
> 
> Once again, if 
> 
>    register_globals=on
> 
> then, everything is fine.
> ---ends---
> 
> ------------------------------------------------------------------------
> 
> [2001-12-13 04:52:52] [EMAIL PROTECTED]
> 
> When you use $_SESSION or $HTTP_SESSION_VARS, you don't need 
>session_register/unregister to save session vars.
> Do you have problem still when you don't use session_register/unregister?
> 
> 
> ------------------------------------------------------------------------
> 
> 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/?id=13078
> 
> 
> Edit this bug report at http://bugs.php.net/?id=13078&edit=1
> 
> 



-- 
Yasuo Ohgaki

Index: mod_user.c
===================================================================
RCS file: /repository/php4/ext/session/mod_user.c,v
retrieving revision 1.17
diff -u -r1.17 mod_user.c
--- mod_user.c  30 Jul 2001 08:24:34 -0000      1.17
+++ mod_user.c  14 Dec 2001 07:33:21 -0000
@@ -125,16 +125,17 @@
        SESS_ZVAL_STRING(key, args[0]);
 
        retval = ps_call_handler(PSF(read), 1, args);
-       
+
        if (retval) {
-               if (retval->type == IS_STRING) {
+               convert_to_string_ex(&retval);
+               if (retval->value.str.len) {
                        *val = estrndup(retval->value.str.val, retval->value.str.len);
                        *vallen = retval->value.str.len;
                        ret = SUCCESS;
                }
                zval_ptr_dtor(&retval);
        }
-
+       
        return ret;
 }
 

-- 
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