From: thbley at gmail dot com
Operating system: Win32 / XP SP2
PHP version: 5.1.6
PHP Bug Type: MySQLi related
Bug description: Can't access database in custom session handler with MySQLi
Description:
------------
MySQLi connection is broken when using a custom session handler. When
using MySQL extension there is no problem.
Reproduce code:
---------------
<?php
$GLOBALS["DB"] = mysqli_connect("localhost","root","");
session_set_save_handler("_login_session_none","_login_session_none","_login_session_none","_login_session_write","_login_session_none","_login_session_none");
session_start();
echo mysqli_query($GLOBALS["DB"],"show status")."OK\n";
function _login_session_none($param1="", $param2="") {
return true;
}
function _login_session_write($id,$val) {
echo mysqli_query($GLOBALS["DB"],"show status");
}
?>
Expected result:
----------------
Object id #2OK
Object id #2O
Actual result:
--------------
Object id #2OK
Warning: mysqli_query() [function.mysqli-query]: Couldn't fetch mysqli in
H:\sgs\src\test_mysqli.php on line 14
--
Edit bug report at http://bugs.php.net/?id=38854&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38854&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38854&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38854&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38854&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38854&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38854&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38854&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38854&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38854&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38854&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38854&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38854&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38854&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38854&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38854&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38854&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38854&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38854&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38854&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38854&r=mysqlcfg