PHP  
 PHP_HEAD
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_connect.phpt ('mysql_connect()')

Script

1: <?php
2:
include_once "connect.inc";
3:
4:
$tmp    NULL;
5:
$link   NULL;
6:
7:
// mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]] )
8:
if (NULL !== ($tmp = @mysql_connect($link$link$link$link$link$link)))
9:     
printf("[001] Expecting NULL, got %s/%s\n"gettype($tmp), $tmp);
10:
11:
$myhost = (is_null($socket)) ? ((is_null($port)) ? $host $host ':' $port) : $host ':' $socket;
12: if (!
$link mysql_connect($myhost$user$passwdtrue))
13:     
printf("[002] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14:         
$host$myhost$user$db$port$socket);
15:
16:
mysql_close($link);
17:
18: if (!
$link mysql_connect($myhost$user$passwdtrue))
19:     
printf("[003] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
20:         
$host$myhost$user$db$port$socket);
21:
22:
mysql_close();
23:
24: if (
$link mysql_connect($myhost$user 'unknown_really'$passwd 'non_empty'true))
25:     
printf("[004] Can connect to the server using host=%s/%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
26:         
$host$myhost$user 'unknown_really'$db$port$socket);
27:
28: if (
false !== $link)
29:
printf("[005] Expecting boolean/false, got %s/%s\n"gettype($link), $link);
30:
31:
// Run the following tests without an anoynmous MySQL user and use a password for the test user!
32:
ini_set('mysql.default_socket'$socket);
33: if (!
is_null($socket)) {    
34:     if (!
is_resource($link mysql_connect($host$user$passwdtrue))) {
35:         
printf("[006] Usage of mysql.default_socket failed\n");
36:     } else {
37:         
mysql_close($link);
38:     }
39: }
40:
41: if (!
ini_get('sql.safe_mode')) {
42:
43:     
ini_set('mysql.default_port'$port);
44:     if (!
is_null($port)) {
45:         if (!
is_resource($link mysql_connect($host$user$passwdtrue))) {
46:             
printf("[007] Usage of mysql.default_port failed\n");
47:         } else {
48:             
mysql_close($link);
49:         }
50:     }
51:
52:     
ini_set('mysql.default_password'$passwd);
53:     if (!
is_resource($link mysql_connect($myhost$user))) {
54:         
printf("[008] Usage of mysql.default_password failed\n");
55:     } else {
56:         
mysql_close($link);
57:     }
58:     
ini_set('mysql.default_user'$user);
59:     if (!
is_resource($link mysql_connect($myhost))) {
60:         
printf("[009] Usage of mysql.default_user failed\n");
61:     } else {
62:         
mysql_close($link);
63:     }
64:
65:     
ini_set('mysql.default_host'$myhost);
66:     if (!
is_resource($link mysql_connect())) {
67:         
printf("[010] Usage of mysql.default_host failed\n") ;
68:     } else {
69:         
mysql_close($link);
70:     }
71:
72:     if (!
is_resource($link mysql_connect()) || !is_resource($link2 mysql_connect())) {
73:         
printf("[011] Usage of mysql.default_host failed\n") ;
74:     } else {
75:         
mysql_close();
76:         
mysql_close($link2);
77:     }
78:
79:     if (!
stristr(PHP_OS'win') && !stristr(PHP_OS'netware')) {
80:         
ini_set('mysql.default_port', -1);
81:         if (
putenv(sprintf('MYSQL_TCP_PORT=%d'$port))) {
82:             if (!
is_resource($link mysql_connect())) {
83:                 
printf("[012] Usage of env MYSQL_TCP_PORT failed\n") ;
84:             } else {
85:             
mysql_close($link);
86:         }
87:         } else if (
putenv(sprintf('MYSQL_TCP_PORT=%d'$port 1))) {
88:             if (!
is_resource($link mysql_connect())) {
89:                 
printf("[013] Usage of env MYSQL_TCP_PORT=%d should have failed\n"$port 1) ;
90:                 
mysql_close($link);
91:         }
92:         }
93:     }
94: }
95:
96: print 
"done!";
97:
?>
98:

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

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

Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: YES) 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

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

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

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
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_HEAD/ext/mysql/tests/mysql_connect.php on line 12

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_HEAD/ext/mysql/tests/mysql_connect.php on line 18

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_HEAD/ext/mysql/tests/mysql_connect.php on line 24

Warning: mysql_connect(): Access denied for user 'phpqaunknown_rea'@'localhost' (using password: YES) in /var/php_gcov/PHP_HEAD/ext/mysql/tests/mysql_connect.php on line 24

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_HEAD/ext/mysql/tests/mysql_connect.php on line 34

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_HEAD/ext/mysql/tests/mysql_connect.php on line 45

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_HEAD/ext/mysql/tests/mysql_connect.php on line 53

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_HEAD/ext/mysql/tests/mysql_connect.php on line 59

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_HEAD/ext/mysql/tests/mysql_connect.php on line 66

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_HEAD/ext/mysql/tests/mysql_connect.php on line 72

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_HEAD/ext/mysql/tests/mysql_connect.php on line 72

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_HEAD/ext/mysql/tests/mysql_connect.php on line 82
done!

Diff

022+ 
023+ 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_HEAD/ext/mysql/tests/mysql_connect.php on line 82

 

Generated at Wed, 22 Oct 2014 07:25:05 +0000 (3 days ago)

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