svn: /php/php-src/ branches/PHP_5_3/ext/mysql/tests/connect.inc trunk/ext/mysql/tests/connect.inc
| From: | Ulf Wendel | Date: | Tue, 20 Oct 2009 08:23:06 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/mysql/tests/connect.inc trunk/ext/mysql/tests/connect.inc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60731@lists.php.net to get a copy of this message | ||
uw Tue, 20 Oct 2009 08:23:06 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289786
Log:
Bail if connect.inc gets included twice. Including twice is most likely a 'bug'. See also
http://news.php.net/php.cvs/60720
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
U php/php-src/trunk/ext/mysql/tests/connect.inc
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2009-10-20 00:43:30 UTC (rev 289785)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2009-10-20 08:23:06 UTC (rev 289786)
@@ -19,30 +19,34 @@
}
}
-/* wrapper to simplify test porting */
-function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) {
- global $connect_flags;
+if (!function_exists('my_mysql_connect')) {
+ /* wrapper to simplify test porting */
+ function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) {
+ global $connect_flags;
- $flags = ($flags === NULL) ? $connect_flags : $flags;
+ $flags = ($flags === NULL) ? $connect_flags : $flags;
- if ($socket)
- $host = sprintf("%s:%s", $host, $socket);
- else if ($port)
- $host = sprintf("%s:%s", $host, $port);
+ if ($socket)
+ $host = sprintf("%s:%s", $host, $socket);
+ else if ($port)
+ $host = sprintf("%s:%s", $host, $port);
- if (!$link = mysql_connect($host, $user, $passwd, true, $flags)) {
- printf("[000-a] Cannot connect using host '%s', user '%s', password
'****', [%d] %s\n",
- $host, $user, $passwd,
- mysql_errno(), mysql_error());
- return false;
- }
+ if (!$link = mysql_connect($host, $user, $passwd, true, $flags)) {
+ printf("[000-a] Cannot connect using host '%s', user '%s', password
'****', [%d] %s\n",
+ $host, $user, $passwd,
+ mysql_errno(), mysql_error());
+ return false;
+ }
- if (!mysql_select_db($db, $link)) {
- printf("[000-b] [%d] %s\n", mysql_errno($link), mysql_error($link));
- return false;
+ if (!mysql_select_db($db, $link)) {
+ printf("[000-b] [%d] %s\n", mysql_errno($link), mysql_error($link));
+ return false;
+ }
+
+ return $link;
}
-
- return $link;
+} else {
+ printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
}
/*
Modified: php/php-src/trunk/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/trunk/ext/mysql/tests/connect.inc 2009-10-20 00:43:30 UTC (rev 289785)
+++ php/php-src/trunk/ext/mysql/tests/connect.inc 2009-10-20 08:23:06 UTC (rev 289786)
@@ -19,30 +19,34 @@
}
}
-/* wrapper to simplify test porting */
-function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) {
- global $connect_flags;
+if (!function_exists('my_mysql_connect')) {
+ /* wrapper to simplify test porting */
+ function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) {
+ global $connect_flags;
- $flags = ($flags === NULL) ? $connect_flags : $flags;
+ $flags = ($flags === NULL) ? $connect_flags : $flags;
- if ($socket)
- $host = sprintf("%s:%s", $host, $socket);
- else if ($port)
- $host = sprintf("%s:%s", $host, $port);
+ if ($socket)
+ $host = sprintf("%s:%s", $host, $socket);
+ else if ($port)
+ $host = sprintf("%s:%s", $host, $port);
- if (!$link = mysql_connect($host, $user, $passwd, true, $flags)) {
- printf("[000-a] Cannot connect using host '%s', user '%s', password
'****', [%d] %s\n",
- $host, $user, $passwd,
- mysql_errno(), mysql_error());
- return false;
- }
+ if (!$link = mysql_connect($host, $user, $passwd, true, $flags)) {
+ printf("[000-a] Cannot connect using host '%s', user '%s', password
'****', [%d] %s\n",
+ $host, $user, $passwd,
+ mysql_errno(), mysql_error());
+ return false;
+ }
- if (!mysql_select_db($db, $link)) {
- printf("[000-b] [%d] %s\n", mysql_errno($link), mysql_error($link));
- return false;
+ if (!mysql_select_db($db, $link)) {
+ printf("[000-b] [%d] %s\n", mysql_errno($link), mysql_error($link));
+ return false;
+ }
+
+ return $link;
}
-
- return $link;
+} else {
+ printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
}
/*