php.net |  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
 [2010-12-09 01:16 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-12 01:51 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2010-12-12 17:17 UTC] kalle@php.net
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-12 17:18 UTC] kalle@php.net
-Status: Assigned +Status: Closed
 [2010-12-12 17:18 UTC] kalle@php.net
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
 [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: http://bugs.php.net/bug.php?id=53649
 [2011-01-07 15:22 UTC] andrey@php.net
Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=307223
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: Mon Dec 30 14:01:28 2024 UTC