Skip to content

Commit 65d704c

Browse files
author
Georg Richter
committed
fix and testcase for bug #36745
1 parent bf3a7e1 commit 65d704c

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ PHP NEWS
1919
- Fixed bug #36808 (syslog ident becomes garbage between requests). (Tony)
2020
- Fixed bug #36802 (mysqli_set_charset() crash with a non-open connection).
2121
(Ilia)
22+
- Fixed bug #36745 (No error message when load data local file isn't found).
23+
(Georg)
2224
- Fixed bug #36721 (The SoapServer is not able to send a header that it didn't
2325
receive). (Dmitry)
2426
- Fixed bug #36756 (DOMDocument::removeChild corrupts node). (Rob)

ext/mysqli/mysqli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ int php_local_infile_init(void **ptr, const char *filename, void *userdata)
976976
mysql->li_stream = php_stream_open_wrapper_ex((char *)filename, "r", 0, NULL, context);
977977

978978
if (mysql->li_stream == NULL) {
979+
sprintf((char *)data->error_msg, "Can't find file '%-.64s'.", filename);
979980
return 1;
980981
}
981982

ext/mysqli/tests/bug36745.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
bug #36745 : LOAD DATA LOCAL INFILE doesn't return correct error message
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
include ("connect.inc");
8+
9+
/*** test mysqli_connect 127.0.0.1 ***/
10+
$mysql = mysqli_connect($host, $user, $passwd, "test");
11+
12+
$mysql->query("DROP TABLE IF EXISTS litest");
13+
$mysql->query("CREATE TABLE litest (a VARCHAR(20))");
14+
15+
$mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
16+
var_dump($mysql->error);
17+
18+
$mysql->close();
19+
printf("Done");
20+
?>
21+
--EXPECT--
22+
string(31) "Can't find file 'filenotfound'."
23+
Done

0 commit comments

Comments
 (0)