]> granicus.if.org Git - php/commitdiff
fix and testcase for bug #36745
authorGeorg Richter <georg@php.net>
Fri, 24 Mar 2006 12:10:39 +0000 (12:10 +0000)
committerGeorg Richter <georg@php.net>
Fri, 24 Mar 2006 12:10:39 +0000 (12:10 +0000)
NEWS
ext/mysqli/mysqli.c
ext/mysqli/tests/bug36745.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 6ba095405149a555441a8ec7b9788ed2af019fd6..e1a85de6271adef6aa3fea80ed52dcd7c02414ff 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ PHP                                                                        NEWS
 - Fixed bug #36808 (syslog ident becomes garbage between requests). (Tony)
 - Fixed bug #36802 (mysqli_set_charset() crash with a non-open connection).
   (Ilia)
+- Fixed bug #36745 (No error message when load data local file isn't found).
+  (Georg)
 - Fixed bug #36721 (The SoapServer is not able to send a header that it didn't
   receive). (Dmitry)
 - Fixed bug #36756 (DOMDocument::removeChild corrupts node). (Rob)
index 4531bb07e2670937cef076ac076dd4ea53c64ff3..3e369922c855d4f1f83ddafa2cd85a7712e3f7cb 100644 (file)
@@ -976,6 +976,7 @@ int php_local_infile_init(void **ptr, const char *filename, void *userdata)
        mysql->li_stream = php_stream_open_wrapper_ex((char *)filename, "r", 0, NULL, context);
 
        if (mysql->li_stream == NULL) {
+               sprintf((char *)data->error_msg, "Can't find file '%-.64s'.", filename);        
                return 1;
        }
 
diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt
new file mode 100644 (file)
index 0000000..7bbfe81
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+bug #36745 : LOAD DATA LOCAL INFILE doesn't return correct error message                                            
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+       include ("connect.inc");
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $mysql = mysqli_connect($host, $user, $passwd, "test");
+
+       $mysql->query("DROP TABLE IF EXISTS litest");
+       $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
+
+       $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
+       var_dump($mysql->error);
+
+       $mysql->close();
+       printf("Done");
+?>
+--EXPECT--
+string(31) "Can't find file 'filenotfound'."
+Done