#33635 [Asn]: "couldn't fetch mysqli" error when attempting to write session data to db
| From: | tony at marston-home dot demon dot co dot uk | Date: | Fri, 15 Jul 2005 07:41:20 +0000 |
| Subject: | #33635 [Asn]: "couldn't fetch mysqli" error when attempting to write session data to db | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81889@lists.php.net to get a copy of this message | ||
ID: 33635
User updated by: tony at marston-home dot demon dot co dot uk
Reported By: tony at marston-home dot demon dot co dot uk
Status: Assigned
Bug Type: MySQLi related
Operating System: Windows XP
PHP Version: 5CVS-2005-07-10 (dev)
Assigned To: georg
New Comment:
This problem only occurs when writing out session data to a database
when the script terminates, and also because I am using a shared
database connection (the one created when the session data was forst
read in).
I conducted a little experiment by replacing the exit function with
session_write_close(), and this did not produce the error. I therefore
strongly suspect that the order of events at script termination has
been altered to:
(a) close all resources
(b) write session data (to database)
This will fail if (b) uses a resource closed in (a)
Previous Comments:
------------------------------------------------------------------------
[2005-07-12 01:08:12] sniper@php.net
Assigned to the author of the extension, who can propably explain this
better..
------------------------------------------------------------------------
[2005-07-11 23:55:55] tony at marston-home dot demon dot co dot uk
You are completely mistaken. I am not mixing both OO and procedural
ways of accessing the DB - all my calls to the mysqli_* functions are
in the procedural style. The fact that I am making these calls inside
my own OO class should be totally irrelevant.
The same code has worked perfectly through php 5.0.0 to 5.0.4, and with
5.0.5-dev only fails when I try to write my session data to the
database. SOMETHING HAS BEEN INTRODUCED IN 5.0.5-dev THAT CAUSES THIS
FAILURE.
My use of static variables follows the documentation for the singleton
pattern at http://www.php.net/manual/en/language.oop5.patterns.php.
It
allows to to call mysqli_connect() only once for a request.
------------------------------------------------------------------------
[2005-07-11 22:48:09] sniper@php.net
Please read the friendly manual about Mysqli. You're trying to mix both
OO and procedural way of accessing the DB. Choose one and stick to
that. (And I don't get the idea of making the connection 'static'
either..especially if you deal with OOP)
------------------------------------------------------------------------
[2005-07-11 12:33:45] tony at marston-home dot demon dot co dot uk
Whoops. That URL should be http://www.tonymarston.net/test.zip
------------------------------------------------------------------------
[2005-07-11 11:59:48] tony at marston-home dot demon dot co dot uk
I have changed the test set as follows:
(a) Everything is in a single file (test.php)
(b) I have removed the PHP 4 code (=& with objects)
(c) I have removed redundant methods.
New test set is available at http://www.tonymarston.net/text.zip
------------------------------------------------------------------------
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/33635
--
Edit this bug report at http://bugs.php.net/?id=33635&edit=1