Re: [PHP] Help with custom session handler

2001-07-08 Thread Sascha Schumann

> There is a serious bug in PHP that seems to lead to inconsistent handling
> of memory allocation that affects code that uses functions like strtok from
> inside session handler functions.

That is a *very* inaccurate description.

It affects only session handler functions which are called
during the request shutdown (write, close).  It does not
affect the other four handlers.

Second, it is not a general problem with memory allocations.
Strtok just assumed that it would not be called after request
shutdown.  The attached patch should fix that.

- Sascha Experience IRCG
  http://schumann.cx/http://schumann.cx/ircg


Index: basic_functions.c
===
RCS file: /repository/php4/ext/standard/basic_functions.c,v
retrieving revision 1.355
diff -u -r1.355 basic_functions.c
--- basic_functions.c   2001/07/04 10:10:29 1.355
+++ basic_functions.c   2001/07/08 23:09:25
@@ -885,6 +885,7 @@
BLS_FETCH();
 
STR_FREE(BG(strtok_string));
+   BG(strtok_string) = NULL;
 #ifdef HAVE_PUTENV
zend_hash_destroy(&BG(putenv_ht));
 #endif


-- 
PHP General 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]


Re: [PHP] Help with custom session handler

2001-07-08 Thread Manuel Lemos

Hello Aral,

On 30-Jun-01 13:05:40, you wrote:

>I'm writing a custom session handler that saves sessions using Manuel Lemos'
>excellent Metabase library. The problem is, although I've got the
>session_set_save_handler function pointing to the correct start, end, read,
>write, destroy and garbage collection functions, when I call session_start
>and session_register, the "write" function does not get called (the only
>function that gets called is the "read" function.)

There is a serious bug in PHP that seems to lead to inconsistent handling
of memory allocation that affects code that uses functions like strtok from
inside session handler functions.

A new version of Metabase that does not use strtok was uploaded to the PHP
Classes site.  Everybody that uses Metabase for session handling is
encouraged to download this version because PHP trashes the memory and
eventually crashes you Web server when the strtok function is used.

http://phpclasses.UpperDesign.com/browse.html/package/20


Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--


-- 
PHP General 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]




[PHP] Help with custom session handler

2001-06-30 Thread Aral Balkan

I'm writing a custom session handler that saves sessions using Manuel Lemos'
excellent Metabase library. The problem is, although I've got the
session_set_save_handler function pointing to the correct start, end, read,
write, destroy and garbage collection functions, when I call session_start
and session_register, the "write" function does not get called (the only
function that gets called is the "read" function.)

I read on a post at PHPBuilder that the write function cannot output to the
browser so just to make sure I logged my debug code to a global variable and
it really is not getting called.

I'd really appreciate any suggestions you might have -- it's got me stumped!

Thanks, Aral :)
__
([EMAIL PROTECTED])
New Media Producer, Kismia, Inc.
([EMAIL PROTECTED])
Adj. Prof., American University
¯¯



-- 
PHP General 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]