Edit report at http://bugs.php.net/bug.php?id=53503&edit=1
ID: 53503
Comment by: jeremy dot archuleta at gmail dot com
Reported by: clewis at myfonts dot com
Summary: mysqli::query returns false after successful LOAD
DATA query
Status: Closed
Type: Bug
Package: MySQLi related
Operating System: Linux - CentOS
PHP Version: 5.3.3
Assigned To: kalle
Block user comment: N
Private report: N
New Comment:
This also occurs in the "mysql" package. The bug report I filed
yesterday (before
I saw this) is here: http://bugs.php.net/bug.php?id=53649
Previous Comments:
------------------------------------------------------------------------
[2010-12-12 17:18:22] [email protected]
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
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
The fix will be included in PHP 5.3.5
------------------------------------------------------------------------
[2010-12-12 17:17:53] [email protected]
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=306266
Log: Fixed bug #53503 (mysqli::query returns false after successful LOAD
DATA query)
------------------------------------------------------------------------
[2010-12-09 01:16:44] clewis at myfonts dot com
Description:
------------
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
success.
If the LOAD DATA query is the first query run on a particular mysqli
object, it
works fine.
We are using the mysqlnd lib.
Configuration:
./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";
unlink($tempfile);
Expected result:
----------------
mysqli::query returns result object
Actual result:
--------------
mysqli::query returns false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53503&edit=1