PHP  
 PHP_5_6
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/mysql/tests/mysql_query_load_data_openbasedir.phpt ('LOAD DATA INFILE - open_basedir')

Script

1: <?php
2:
@include_once("connect.inc");
3:
ini_set("open_basedir"__DIR__);
4:
chdir(__DIR__);
5: if (!isset(
$db)) {
6:     
// run-tests, I love you for not allowing me to set ini settings dynamically
7:     
print "[006] [1148] The used command is not allowed with this MySQL version
8: [007] [0]
9: [008] LOAD DATA not run?
10: [010] [1148] The used command is not allowed with this MySQL version
11: done!"
;
12:     die();
13: }
14: require(
'table.inc');
15:
mysql_close($link);
16: if (
$socket)
17:     
$host sprintf("%s:%s"$host$socket);
18: else if (
$port)
19:     
$host sprintf("%s:%s"$host$port);
20:
21: if (!
$link mysql_connect($host$user$passwdtrue128)) {
22:     
printf("[001] Cannot connect using host '%s', user '%s', password '****', [%d] %s\n",
23:         
$host$user$passwd,
24:         
mysql_errno(), mysql_error());
25: }
26:
27: if (!
mysql_select_db($db$link)) {
28:     
printf("[002] [%d] %s\n"mysql_errno($link), mysql_error($link));
29: }
30:
31: if (
file_exists('./simple.csv'))
32:     
unlink('./simple.csv');
33:
34: if (!
$fp fopen('./simple.csv''w'))
35:     
printf("[003] Cannot open CSV file\n");
36:
37: if (
version_compare(PHP_VERSION'5.9.9''>') >= 0) {
38:     if (!
fwrite($fp, (binary)"'97';'x';\n") ||
39:         !
fwrite($fp, (binary)"'98';'y';\n") ||
40:         !
fwrite($fp, (binary)"99;'z';\n")) {
41:         
printf("[004] Cannot write CVS file '%s'\n"$file);
42:     }
43: } else {
44:     if (!
fwrite($fp"97;'x';\n") ||
45:         !
fwrite($fp"98;'y';\n") ||
46:         !
fwrite($fp"99;'z';\n")) {
47:         
printf("[005] Cannot write CVS file '%s'\n"$file);
48:     }
49: }
50:
fclose($fp);
51:
52:
$sql sprintf("LOAD DATA LOCAL INFILE '%s'
53:             INTO TABLE test
54:             FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
55:             LINES TERMINATED BY '\n'"
,
56:             
mysql_real_escape_string(realpath('./simple.csv'), $link));
57:
58: if (!
mysql_query($sql$link))
59:     
printf("[006] [%d] %s\n"mysql_errno($link), mysql_error($link));
60:
61: if (!(
$res mysql_query('SELECT label FROM test WHERE id = 97'$link)) ||
62:         !(
$row mysql_fetch_assoc($res)) ||
63:         !
mysql_free_result($res))
64:     
printf("[007] [%d] '%s'\n"mysql_errno($link), mysql_error($link));
65:
66: if (
$row['label'] != "x")
67:     
printf("[008] LOAD DATA not run?\n");
68:
69: if (!
mysql_query('DELETE FROM test'$link))
70:     
printf("[009] [%d] %s\n"mysql_errno($link), mysql_error($link));
71:
72:
$sql "LOAD DATA LOCAL INFILE '/tmp/idonotexist'
73:             INTO TABLE test
74:             FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
75:             LINES TERMINATED BY '\n'"
;
76:
77: if (!
mysql_query($sql$link))
78:     
printf("[010] [%d] %s\n"mysql_errno($link), mysql_error($link));
79:
80:
mysql_close($link);
81:
unlink("./simple.csv");
82:
83: print 
"done!";
84:
?>
85:

Expected

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[006] [1148] %s
[007] [0] ''
[008] LOAD DATA not run?
[010] [1148] %s
done!

Output

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/php_gcov/PHP_5_6/ext/mysql/tests/connect.inc on line 37

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/php_gcov/PHP_5_6/ext/mysql/tests/mysql_query_load_data_openbasedir.php on line 21
[010] [2000] open_basedir restriction in effect. Unable to open file
done!

Diff

004+ [010] [2000] open_basedir restriction in effect. Unable to open file
004- [006] [1148] %s
005- [007] [0] ''
006- [008] LOAD DATA not run?
007- [010] [1148] %s

 

Generated at Mon, 27 Nov 2017 05:04:32 +0000 (15 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.