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:           Feedback
+Status:           Open
 Bug Type:         MySQLi related
 Operating System: Windows XP
 PHP Version:      5CVS-2005-07-10 (dev)
 New Comment:

It simply does not fail when I remove all those classes. That is the
smallest I can possibly make it, and I have been working on it all
afternoon.


Previous Comments:
------------------------------------------------------------------------

[2005-07-10 22:23:14] [EMAIL PROTECTED]

Please, provide a *short* but *complete* reproduce case without all
those numerous classes, includes etc. Thanks.

------------------------------------------------------------------------

[2005-07-10 22:11:19] tony at marston-home dot demon dot co dot uk

The full test set can be downloaded from
http://www.tonymarston.net/test.zip

------------------------------------------------------------------------

[2005-07-10 21:56:10] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2005-07-10 21:54:00] tony at marston-home dot demon dot co dot uk

Description:
------------
In my script I use a custom session handler to write all session data
to the database. Through versions 5.0.0 to 5.0.4 this worked as
expected, but with 5.0.5dev I am now getting an error. It only ever
failos at the end of the script when writing out the session data. It
always fails at the same place by generating a "Couldn't fetch mysqli"
error.

Reproduce code:
---------------
function connect ($dbname)
// establish a connection to the database
{
    global $dbhost, $dbusername, $dbuserpass;

    static $dbconn;
        
    if (!$dbconn) {
        $dbconn = mysqli_connect($dbhost, $dbusername, $dbuserpass);
        if ($dbconn) {
            // use UTF8 for this connection
            $this->query = "SET names 'UTF8'";
            $result = mysqli_query($dbconn, $this->query) or
trigger_error($this, E_USER_ERROR);
        } // if
    } // if
    if (!$dbconn) {    <== FAILS HERE *********************
        return false;
    } elseif (!mysqli_select_db($dbconn, $dbname)) {
        return false;
    } else {
        $this->dbconnect = $dbconn;
        return true;
    } // if
        
} // connect

The full code is available from http://www.tonymarston.net/text.zip.
The script to run is "test.php".

Expected result:
----------------
At that point $dbconn is shown to be "object of mysqli", so it should
not error.

Actual result:
--------------
At the line "if (!$dbconn)" the program jumps immediately to my error
handler with the error "Couldn't fetch mysqli".


------------------------------------------------------------------------


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

Reply via email to