php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36745 No error message when load data local file isn't found
Submitted: 2006-03-15 16:52 UTC Modified: 2006-03-24 13:11 UTC
From: dweingart at pobox dot com Assigned: georg (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID: None
 [2006-03-15 16:52 UTC] dweingart at pobox dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-24 13:11 UTC] georg@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC