From:             dweingart at pobox dot com
Operating system: Windows XP
PHP version:      5.1.2
PHP Bug Type:     MySQLi related
Bug description:  No error message when load data local file isn't found

Description:
------------
When issuing a LOAD DATA LOCAL INFILE statement, if the file is missing,
mysqli_error() returns the empty string. The same query issued from the
command line client returns the following message:

ERROR:
File '/path/to/nonexistent/file.txt' not found (Errcode: 2)

mysqli_errno returns 2000 (CR_UNKNOWN_ERROR)

Reproduce code:
---------------
<?php  
$mysqli = mysqli_init();
$mysqli->options(MYSQLI_OPT_LOCAL_INFILE, 1);
$connect = $mysqli->real_connect('xxx.xxx.xxx.xxx', 'xxxxxxxx',
'xxxxxxxxx', 'mydb');
$query = "
LOAD DATA LOCAL INFILE '/path/to/nonexistent/file.txt' 
INTO TABLE mytable
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '\"'
LINES TERMINATED BY '\r\n'
";
$result = $mysqli->query($query);
var_dump($result, $mysqli->errno, $mysqli->error);

// $result: false
// $mysqli->errno: 2000 (unknown error)
// $mysqli->error: "" (empty string)
?>

Expected result:
----------------
I expect to see an error message similar to the one returned by the
command-line client, or at least a message that gives a clearer idea of
what might have gone wrong.

Actual result:
--------------
Error message is the empty string

-- 
Edit bug report at http://bugs.php.net/?id=36745&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36745&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36745&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36745&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36745&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36745&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36745&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36745&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36745&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36745&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36745&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36745&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36745&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36745&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36745&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36745&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36745&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36745&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36745&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36745&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36745&r=mysqlcfg

Reply via email to