|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dweingart at pobox dot com
New email:
PHP Version: OS:


 [2006-03-15 16:52 UTC] dweingart at pobox dot com
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:

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

mysqli_errno returns 2000 (CR_UNKNOWN_ERROR)

Reproduce code:
$mysqli = mysqli_init();
$mysqli->options(MYSQLI_OPT_LOCAL_INFILE, 1);
$connect = $mysqli->real_connect('', 'xxxxxxxx', 'xxxxxxxxx', 'mydb');
$query = "
LOAD DATA LOCAL INFILE '/path/to/nonexistent/file.txt' 
INTO TABLE mytable
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-24 13:11 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 21:01:33 2024 UTC