1--TEST-- 2ensure an error is returned when mysqli.allow_local_infile is off 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--INI-- 9mysqli.allow_local_infile=0 10--FILE-- 11<?php 12 require_once("connect.inc"); 13 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { 14 printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 15 } 16 if (!$link->query("DROP TABLE IF EXISTS test")) { 17 printf("[002] [%d] %s\n", $link->errno, $link->error); 18 } 19 if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) { 20 printf("[003] [%d] %s\n", $link->errno, $link->error); 21 } 22 if (FALSE == file_put_contents('bug77956.data', "waa? meukee!")) 23 printf("[004] Failed to create CVS file\n"); 24 if (!$link->query("SELECT 1 FROM DUAL")) 25 printf("[005] [%d] %s\n", $link->errno, $link->error); 26 if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) { 27 printf("[006] [%d] %s\n", $link->errno, $link->error); 28 echo "done"; 29 } else { 30 echo "bug"; 31 } 32 $link->close(); 33?> 34--CLEAN-- 35<?php 36require_once('connect.inc'); 37if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { 38 printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 39 $host, $user, $db, $port, $socket); 40} 41if (!$link->query($link, 'DROP TABLE IF EXISTS test')) { 42 printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 43} 44$link->close(); 45unlink('bug77956.data'); 46?> 47--EXPECTF-- 48Warning: mysqli::query(): LOAD DATA LOCAL INFILE forbidden in %s on line %d 49[006] [2000] LOAD DATA LOCAL INFILE is forbidden, check mysqli.allow_local_infile 50done 51