No error message when load data local file isn't found
| 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
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-03-24 13:11 UTC] georg@php.net
[2015-07-10 11:33 UTC] spam2 at rhsoft dot net