ID:               46144
 Updated by:       j...@php.net
 Reported By:      Progman2002 at gmx dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

And update the version information to show the proper data if it does 
not work.


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

[2008-11-29 11:04:12] Progman2002 at gmx dot de

reopened as the snapshot doesn't fix the problem

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

[2008-11-29 10:59:24] Progman2002 at gmx dot de

As the paste on the pasteboard is gone I'll add the code here.
-----------

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

$db = @new MySQLi('localhost', '', '', 'test');
if (mysqli_connect_errno()) {
    die('Konnte keine Verbindung zu Datenbank aufbauen, MySQL meldete:
'.mysqli_connect_error());
}
echo 'PHP-Version: '.PHP_VERSION."\n";
echo 'MySQL-Server-Version: '.$db->server_version."\n";
echo 'MySQL-Protocol: '.$db->protocol_version."\n";
$sql = 'CREATE TEMPORARY TABLE SomeTest(UserID INT NOT NULL, RechtID
INT NOT NULL)';
if (!$db->query($sql)) {
    die($db->error);
}
$sql = 'DELETE FROM
            SomeTest
        WHERE
            UserID = ?';
if (!$stmt = $db->prepare($sql)) {
    die($db->error);
}
// note the missing $stmt->close() here
$sql = 'INSERT INTO
            SomeTest(UserID, RechtID)
        WHERE
            (?,?)';
if (!$stmt = $db->prepare($sql)) {
    die($db->error."-".$db->errno."-".$db->info);
}
echo "done";
?>

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

[2008-11-10 15:36:34] Progman2002 at gmx dot de

It doesn't work as expected, still showing "-0-" in the error message
instead of the actually error message like "... syntax error near WHERE
..."

configure line was:
./configure --prefix=/home/progman/phptest/ --disable-all
--with-mysqli

Output was:
PHP-Version: 5.2.7RC4-dev
MySQL-Server-Version: 50042
MySQL-Protocol: 10
-0-

Execution was:
$ ~/phptest/bin/php ~/nopaste_51976.php

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

[2008-09-21 13:49:28] Progman2002 at gmx dot de

Description:
------------
If you create a prepared statement with a DELETE query and tries to
create a second prepared statement with an INSERT query on the same
table without closing the first one the MySQLi::prepare() method failed,
but the fields $error and $errno (and all other related to them) aren't
filled with the error message. This is strange as the prepare() failed
but you dont know why.

The mysql error is shown if I save the second statement into another
variable (like if (!$stmt2 = $db->prepare($sql))) (maybe its related to
bug #44766)

Reproduce code:
---------------
Code is at http://nopaste.php-quake.net/51976

Expected result:
----------------
PHP-Version: 5.2.6-pl7-gentoo
MySQL-Server-Version: 50042
MySQL-Protocol: 10
{Showing a MySQL error which says "Syntax error near WHERE (?,?)" or
says sth. like "unfinished prepare statement before")

Actual result:
--------------
PHP-Version: 5.2.6-pl7-gentoo
MySQL-Server-Version: 50042
MySQL-Protocol: 10
-0-

(so the values are all empty strings or zero)


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


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

Reply via email to