summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/connect.inc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/tests/connect.inc')
-rw-r--r--ext/mysqli/tests/connect.inc79
1 files changed, 42 insertions, 37 deletions
diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc
index ad2428647..48ba893cc 100644
--- a/ext/mysqli/tests/connect.inc
+++ b/ext/mysqli/tests/connect.inc
@@ -74,53 +74,58 @@
}
}
- /**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
- *
- * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
- */
- function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
- global $connect_flags;
+ if (!function_exists('my_mysqli_connect')) {
- $flags = ($enable_env_flags) ? $connect_flags : false;
+ /**
+ * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ *
+ * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
+ */
+ function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+ global $connect_flags;
- if ($flags !== false) {
- $link = mysqli_init();
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
- $link = false;
- } else {
- $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- }
+ $flags = ($enable_env_flags) ? $connect_flags : false;
- return $link;
- }
+ if ($flags !== false) {
+ $link = mysqli_init();
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
+ $link = false;
+ } else {
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ }
- /**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
- *
- * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
- */
- function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
- global $connect_flags;
+ return $link;
+ }
- if ($enable_env_flags)
- $flags & $connect_flags;
+ /**
+ * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ *
+ * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
+ */
+ function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
+ global $connect_flags;
- return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
- }
+ if ($enable_env_flags)
+ $flags & $connect_flags;
- class my_mysqli extends mysqli {
- public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
- global $connect_flags;
+ return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
+ }
- $flags = ($enable_env_flags) ? $connect_flags : false;
+ class my_mysqli extends mysqli {
+ public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+ global $connect_flags;
- if ($flags !== false) {
- parent::init();
- $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
- } else {
- parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ $flags = ($enable_env_flags) ? $connect_flags : false;
+
+ if ($flags !== false) {
+ parent::init();
+ $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
+ } else {
+ parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ }
}
}
+ } else {
+ printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
}
?> \ No newline at end of file