php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44766 error in prepare but mysqli_error is empty
Submitted: 2008-04-17 19:40 UTC Modified: 2008-07-22 01:00 UTC
From: cap at unagon dot com Assigned: uw (profile)
Status: No Feedback Package: MySQLi related
PHP Version: 5.2.5 OS: Redhat 3 Enterprise
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-04-17 19:40 UTC] cap at unagon dot com
Description:
------------
if there is an obvious error in a prepare statement, the error is recognized correctly but mysqli_error is the empty string

Reproduce code:
---------------
     $stmt=DB::$mysqli->prepare ('INSERT INTO TYPES (TYPENAME,TYPESPEC) VALUES (?,?,ppp)');
      if (!$stmt) {throw new Exception ("Error: Prepare failed in registerType: ".(DB::$mysqli->error));}   

Expected result:
----------------
Expecting an exception to be thrwon with a text containing some meaningful error description

Actual result:
--------------
Exception is thrown, but error is empty and errno is 0.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-14 16:50 UTC] uw@php.net
Can't repeat. You are not giving a repeatable code example. Please provide an example that uses nothing but ext/mysqli API calls, for example:

	$mysqli = mysqli_init();
	$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
	$mysqli->query('DROP TABLE IF EXISTS test');
	$mysqli->query('CREATE TABLE test(id INT, label CHAR(2))');
	$stmt = $mysqli->prepare('INSERT INTO test(id, label) VALUES (?, ?, bogus)');
	var_dump($stmt);
	var_dump($mysqli->errno);
	var_dump($mysqli->error);
	$mysqli->close();


The above code works fine. It returns something like this:

bool(false)
int(1136)
string(47) "Column count doesn't match value count at row 1"

Also, please add the MySQL version to the bug report. Thanks!
 [2008-07-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-05-18 02:43 UTC] felix9x at yahoo dot com
Probably same as Bug# 46144.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC