#33772 [Ctl]: __destruct is run too early (session_save_handler)

2005-08-09 Thread dmitry
 ID:   33772
 Updated by:   [EMAIL PROTECTED]
 Reported By:  msipria at suomi24 dot fi
 Status:   Critical
 Bug Type: Class/Object related
 Operating System: *
 PHP Version:  5CVS-2005-07-19
 New Comment:

This is chicken/egg problem and it cannot be solved. One expect that
destructors are called before session close the other uses object for
save handlers.


Previous Comments:


[2005-07-21 16:38:11] msipria at suomi24 dot fi

my class isn't extension of mysqli class, it just use it as object, and
with real class i have tryed session_write_close() function but mysql
connection is deat, i don't wanna restor it, i just wanna that it will
be alive at the end like now.



[2005-07-21 00:10:05] toma at smartsemantics dot com

Adding session_write_close() to the __destruct() function will restore
the write, close, and destroy functions to their proper order.

I use a custom session handler that extends my custom mysqli class.  It
automatically checks for lost database connections and attempts
reconnects, etc.

This is still a bug, but the following makes your custom session
handler viable.

public function __destruct(){
@session_write_close();
}

Without session_write_close:
starting session
connecting to database
destroying session
writing session
can't write, database connection does not exist
connecting to database
writing session
closing session

With session_write_close:
starting session
connecting to database
writing session
closing session
destroying session



[2005-07-19 21:20:45] [EMAIL PROTECTED]

I need this fixed too, it's not possible to use e.g. mysqli as save
handler otherwise..




[2005-07-19 16:47:51] msipria at suomi24 dot fi

Description:

I have session handling class and i have db class that i pass to the
session handling class.

As of PHP 5.1.0b1 order of going throu __destructers have been changed,
so at end eaven DB class exsist its __destucter has been runned.

removing __destruct from DB class will not help, coz mysql link has own
__destruct function that it will run.

i realy hope this is bug (that can fix) and it will be fixed, other
whay i'm stuck with 5.0.x or have to re write lots of source code.


Reproduce code:
---
http://www.wiofso.com/~msipria/testi.txt

Expected result:

In PHP 5.0.x (working)

__construct = LINK
open = LINK
read = LINK
write = LINK
close = LINK
__destruct = KILLED LINK

Actual result:
--
In PHP 5.1.0b3 (tested b1-b3) (not working)

__construct = LINK
open = LINK
read = LINK
__destruct = KILLED LINK
write = KILLED LINK
close = KILLED LINK





-- 
Edit this bug report at http://bugs.php.net/?id=33772edit=1


#33772 [Ctl]: __destruct is run too early (session_save_handler)

2005-08-09 Thread sniper
 ID:   33772
 Updated by:   [EMAIL PROTECTED]
 Reported By:  msipria at suomi24 dot fi
 Status:   Critical
 Bug Type: Class/Object related
 Operating System: *
 PHP Version:  5CVS-2005-07-19
 New Comment:

This patch fixes this problem by doing php_session_flush() before any
__destruct()'s are called:

  http://www.php.net/~jani/patches/bug33772.patch

Note: It won't work if you have compiled ext/session as shared. We need
a better solution, I'm submitting this just  as as temporary one.



Previous Comments:


[2005-08-09 14:01:49] [EMAIL PROTECTED]

This is chicken/egg problem and it cannot be solved. One expect that
destructors are called before session close the other uses object for
save handlers.



[2005-07-21 16:38:11] msipria at suomi24 dot fi

my class isn't extension of mysqli class, it just use it as object, and
with real class i have tryed session_write_close() function but mysql
connection is deat, i don't wanna restor it, i just wanna that it will
be alive at the end like now.



[2005-07-21 00:10:05] toma at smartsemantics dot com

Adding session_write_close() to the __destruct() function will restore
the write, close, and destroy functions to their proper order.

I use a custom session handler that extends my custom mysqli class.  It
automatically checks for lost database connections and attempts
reconnects, etc.

This is still a bug, but the following makes your custom session
handler viable.

public function __destruct(){
@session_write_close();
}

Without session_write_close:
starting session
connecting to database
destroying session
writing session
can't write, database connection does not exist
connecting to database
writing session
closing session

With session_write_close:
starting session
connecting to database
writing session
closing session
destroying session



[2005-07-19 21:20:45] [EMAIL PROTECTED]

I need this fixed too, it's not possible to use e.g. mysqli as save
handler otherwise..




[2005-07-19 16:47:51] msipria at suomi24 dot fi

Description:

I have session handling class and i have db class that i pass to the
session handling class.

As of PHP 5.1.0b1 order of going throu __destructers have been changed,
so at end eaven DB class exsist its __destucter has been runned.

removing __destruct from DB class will not help, coz mysql link has own
__destruct function that it will run.

i realy hope this is bug (that can fix) and it will be fixed, other
whay i'm stuck with 5.0.x or have to re write lots of source code.


Reproduce code:
---
http://www.wiofso.com/~msipria/testi.txt

Expected result:

In PHP 5.0.x (working)

__construct = LINK
open = LINK
read = LINK
write = LINK
close = LINK
__destruct = KILLED LINK

Actual result:
--
In PHP 5.1.0b3 (tested b1-b3) (not working)

__construct = LINK
open = LINK
read = LINK
__destruct = KILLED LINK
write = KILLED LINK
close = KILLED LINK





-- 
Edit this bug report at http://bugs.php.net/?id=33772edit=1


#33772 [Ctl]: __destruct is run too early (session_save_handler)

2005-07-28 Thread sniper
 ID:   33772
 Updated by:   [EMAIL PROTECTED]
 Reported By:  msipria at suomi24 dot fi
 Status:   Critical
 Bug Type: Class/Object related
 Operating System: *
 PHP Version:  5CVS-2005-07-19
 New Comment:

See also: #33910



Previous Comments:


[2005-07-21 16:38:11] msipria at suomi24 dot fi

my class isn't extension of mysqli class, it just use it as object, and
with real class i have tryed session_write_close() function but mysql
connection is deat, i don't wanna restor it, i just wanna that it will
be alive at the end like now.



[2005-07-21 00:10:05] toma at smartsemantics dot com

Adding session_write_close() to the __destruct() function will restore
the write, close, and destroy functions to their proper order.

I use a custom session handler that extends my custom mysqli class.  It
automatically checks for lost database connections and attempts
reconnects, etc.

This is still a bug, but the following makes your custom session
handler viable.

public function __destruct(){
@session_write_close();
}

Without session_write_close:
starting session
connecting to database
destroying session
writing session
can't write, database connection does not exist
connecting to database
writing session
closing session

With session_write_close:
starting session
connecting to database
writing session
closing session
destroying session



[2005-07-19 21:20:45] [EMAIL PROTECTED]

I need this fixed too, it's not possible to use e.g. mysqli as save
handler otherwise..




[2005-07-19 16:47:51] msipria at suomi24 dot fi

Description:

I have session handling class and i have db class that i pass to the
session handling class.

As of PHP 5.1.0b1 order of going throu __destructers have been changed,
so at end eaven DB class exsist its __destucter has been runned.

removing __destruct from DB class will not help, coz mysql link has own
__destruct function that it will run.

i realy hope this is bug (that can fix) and it will be fixed, other
whay i'm stuck with 5.0.x or have to re write lots of source code.


Reproduce code:
---
http://www.wiofso.com/~msipria/testi.txt

Expected result:

In PHP 5.0.x (working)

__construct = LINK
open = LINK
read = LINK
write = LINK
close = LINK
__destruct = KILLED LINK

Actual result:
--
In PHP 5.1.0b3 (tested b1-b3) (not working)

__construct = LINK
open = LINK
read = LINK
__destruct = KILLED LINK
write = KILLED LINK
close = KILLED LINK





-- 
Edit this bug report at http://bugs.php.net/?id=33772edit=1


#33772 [Ctl]: __destruct is run too early (session_save_handler)

2005-07-28 Thread sniper
 ID:   33772
 Updated by:   [EMAIL PROTECTED]
 Reported By:  msipria at suomi24 dot fi
 Status:   Critical
 Bug Type: Class/Object related
 Operating System: *
 PHP Version:  5CVS-2005-07-19
 New Comment:

See also bug #33910




Previous Comments:


[2005-07-21 16:38:11] msipria at suomi24 dot fi

my class isn't extension of mysqli class, it just use it as object, and
with real class i have tryed session_write_close() function but mysql
connection is deat, i don't wanna restor it, i just wanna that it will
be alive at the end like now.



[2005-07-21 00:10:05] toma at smartsemantics dot com

Adding session_write_close() to the __destruct() function will restore
the write, close, and destroy functions to their proper order.

I use a custom session handler that extends my custom mysqli class.  It
automatically checks for lost database connections and attempts
reconnects, etc.

This is still a bug, but the following makes your custom session
handler viable.

public function __destruct(){
@session_write_close();
}

Without session_write_close:
starting session
connecting to database
destroying session
writing session
can't write, database connection does not exist
connecting to database
writing session
closing session

With session_write_close:
starting session
connecting to database
writing session
closing session
destroying session



[2005-07-19 21:20:45] [EMAIL PROTECTED]

I need this fixed too, it's not possible to use e.g. mysqli as save
handler otherwise..




[2005-07-19 16:47:51] msipria at suomi24 dot fi

Description:

I have session handling class and i have db class that i pass to the
session handling class.

As of PHP 5.1.0b1 order of going throu __destructers have been changed,
so at end eaven DB class exsist its __destucter has been runned.

removing __destruct from DB class will not help, coz mysql link has own
__destruct function that it will run.

i realy hope this is bug (that can fix) and it will be fixed, other
whay i'm stuck with 5.0.x or have to re write lots of source code.


Reproduce code:
---
http://www.wiofso.com/~msipria/testi.txt

Expected result:

In PHP 5.0.x (working)

__construct = LINK
open = LINK
read = LINK
write = LINK
close = LINK
__destruct = KILLED LINK

Actual result:
--
In PHP 5.1.0b3 (tested b1-b3) (not working)

__construct = LINK
open = LINK
read = LINK
__destruct = KILLED LINK
write = KILLED LINK
close = KILLED LINK





-- 
Edit this bug report at http://bugs.php.net/?id=33772edit=1


#33772 [Ctl]: __destruct is run too early (session_save_handler)

2005-07-21 Thread msipria at suomi24 dot fi
 ID:   33772
 User updated by:  msipria at suomi24 dot fi
 Reported By:  msipria at suomi24 dot fi
 Status:   Critical
 Bug Type: Class/Object related
 Operating System: *
 PHP Version:  5CVS-2005-07-19
 New Comment:

my class isn't extension of mysqli class, it just use it as object, and
with real class i have tryed session_write_close() function but mysql
connection is deat, i don't wanna restor it, i just wanna that it will
be alive at the end like now.


Previous Comments:


[2005-07-21 00:10:05] toma at smartsemantics dot com

Adding session_write_close() to the __destruct() function will restore
the write, close, and destroy functions to their proper order.

I use a custom session handler that extends my custom mysqli class.  It
automatically checks for lost database connections and attempts
reconnects, etc.

This is still a bug, but the following makes your custom session
handler viable.

public function __destruct(){
@session_write_close();
}

Without session_write_close:
starting session
connecting to database
destroying session
writing session
can't write, database connection does not exist
connecting to database
writing session
closing session

With session_write_close:
starting session
connecting to database
writing session
closing session
destroying session



[2005-07-19 21:20:45] [EMAIL PROTECTED]

I need this fixed too, it's not possible to use e.g. mysqli as save
handler otherwise..




[2005-07-19 16:47:51] msipria at suomi24 dot fi

Description:

I have session handling class and i have db class that i pass to the
session handling class.

As of PHP 5.1.0b1 order of going throu __destructers have been changed,
so at end eaven DB class exsist its __destucter has been runned.

removing __destruct from DB class will not help, coz mysql link has own
__destruct function that it will run.

i realy hope this is bug (that can fix) and it will be fixed, other
whay i'm stuck with 5.0.x or have to re write lots of source code.


Reproduce code:
---
http://www.wiofso.com/~msipria/testi.txt

Expected result:

In PHP 5.0.x (working)

__construct = LINK
open = LINK
read = LINK
write = LINK
close = LINK
__destruct = KILLED LINK

Actual result:
--
In PHP 5.1.0b3 (tested b1-b3) (not working)

__construct = LINK
open = LINK
read = LINK
__destruct = KILLED LINK
write = KILLED LINK
close = KILLED LINK





-- 
Edit this bug report at http://bugs.php.net/?id=33772edit=1