|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53503 mysqli::query returns false after successful LOAD DATA query
Submitted: 2010-12-09 01:16 UTC Modified: 2010-12-12 17:18 UTC
From: clewis at myfonts dot com Assigned: kalle (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.3.3 OS: Linux - CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
13 + 25 = ?
Subscribe to this entry?

 [2010-12-09 01:16 UTC] clewis at myfonts dot com

When a LOAD DATA LOCAL INFILE query is run after a previous SELECT query on the 
same mysqli handle, mysqli::query returns false even though the LOAD DATA query 
is successful.

Additionally, PHP outputs two warnings during the mysqli::query call:

PHP Warning:  mysqli::query(): (00000/0):  in /path/to/script.php on line 16

Warning: mysqli::query(): (00000/0):  in /path/to/script.php on line 16

Properties of the mysqli object, such as errorno and affected_rows, indicate 

If the LOAD DATA query is the first query run on a particular mysqli object, it 
works fine.

We are using the mysqlnd lib.


./configure  --prefix=/usr/local --with-xmlrpc --with-apxs2 --with-
mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-curl --with-curlwrappers --
enable-bcmath --with-gd=/usr --with-mcrypt=/usr/local --enable-mbstring --with-
zlib --with-iconv --enable-soap --enable-ftp --without-sqlite --with-xsl --
enable-pcntl --enable-sockets --with-openssl

This may be the same as inactive Bug #47387.

Test script:
$db = new mysqli($host,$user,$pass,$dbname);

$tempfile = tempnam("/tmp","loaddata_");

file_put_contents($tempfile, "1");

$db->query("create table if not exists LoadDataTest (Column1 int unsigned not null primary key)");
$db->query("select * from LoadDataTest limit 1"); //LOAD DATA works properly without this
$result = $db->query("load data local infile '$tempfile' replace into table LoadDataTest (Column1)");

if ($result) print "Load data success.\n";
else print "Error {$db->errno}: {$db->error}\n";


Expected result:
mysqli::query returns result object

Actual result:
mysqli::query returns false


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-12 01:51 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2010-12-12 17:17 UTC]
Automatic comment from SVN on behalf of kalle
Log: Fixed bug #53503 (mysqli::query returns false after successful LOAD DATA query)
 [2010-12-12 17:18 UTC]
-Status: Assigned +Status: Closed
 [2010-12-12 17:18 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

The fix will be included in PHP 5.3.5
 [2011-01-05 20:48 UTC] jeremy dot archuleta at gmail dot com
This also occurs in the "mysql" package. The bug report I filed yesterday (before 
I saw this) is here:
 [2011-01-07 15:22 UTC]
Automatic comment from SVN on behalf of andrey
Log: Proper fix for
Bug #53503      mysqli::query returns false after successful LOAD DATA query
which fixes als #56349, same behavior but in ext/mysql. Both due to a bug
in mysqlnd. Never was a problem with libmysql.
Also fixed the 53503's test case as it always reported PASS, even when there
should have been a failure.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 00:01:33 2024 UTC