From 6fff9f4534a1654ae9db22dec951419d7d4106d5 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Thu, 12 Jul 2007 20:04:17 +0000 Subject: [PATCH] Starting to merge the latest set of ext/mysqli tests from the mysqlnd SVN repro into HEAD. Again, it might happen that I crash the set of tests and don't mention one or the other change while merging. Blame me... 1) Note the new environment variables to control the test run 2) Variables $IS_MYSQLND and $MYSQLND_VERSION are for writing portable tests 3) sys_get_temp_dir function is for PHP5/PHP6 portability --- ext/mysqli/tests/connect.inc | 62 +++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc index 16462a1bbd..8b86355564 100644 --- a/ext/mysqli/tests/connect.inc +++ b/ext/mysqli/tests/connect.inc @@ -1,14 +1,54 @@ + $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd"); + if (!$IS_MYSQLND) { + $MYSQLND_VERSION = NULL; + } else { + if (preg_match('@Revision:\s+(\d+)\s*\$@ism', mysqli_get_client_info(), $matches)) { + $MYSQLND_VERSION = (int)$matches[1]; + } else { + $MYSQLND_VERSION = -1; + } + } + + if (!function_exists('sys_get_temp_dir')) { + function sys_get_temp_dir() { + + if (!empty($_ENV['TMP'])) + return realpath( $_ENV['TMP'] ); + if (!empty($_ENV['TMPDIR'])) + return realpath( $_ENV['TMPDIR'] ); + if (!empty($_ENV['TEMP'])) + return realpath( $_ENV['TEMP'] ); + + $temp_file = tempnam(md5(uniqid(rand(), TRUE)), ''); + if ($temp_file) { + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); + return $temp_dir; + } + return FALSE; + } + } +?> \ No newline at end of file -- 2.40.0