From:
Operating system: Linux - CentOS
PHP version: 5.3.3
Package: MySQLi related
Bug Type: Bug
Bug description:mysqli::query returns false after successful LOAD DATA query
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 bug report at http://bugs.php.net/bug.php?id=53503&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53503&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53503&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53503&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53503&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53503&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53503&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53503&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53503&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53503&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53503&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53503&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53503&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53503&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53503&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53503&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53503&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53503&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53503&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53503&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53503&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53503&r=mysqlcfg