diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index 7c50e2fd..4ff9f228 100644 --- a/Tests/Auth/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -23,15 +23,20 @@ function _Auth_OpenID_mkdtemp() { - if (strpos(PHP_OS, 'WIN') === 0) { - $dir = $_ENV['TMP']; - if (!isset($dir)) { - $dir = 'C:\Windows\Temp'; - } - } else { - $dir = @$_ENV['TMPDIR']; - if (!isset($dir)) { - $dir = '/tmp'; + if (function_exists('sys_get_temp_dir')) { + $dir = sys_get_temp_dir(); + } + else { + if (strpos(PHP_OS, 'WIN') === 0) { + $dir = $_ENV['TMP']; + if (!isset($dir)) { + $dir = 'C:\Windows\Temp'; + } + } else { + $dir = @$_ENV['TMPDIR']; + if (!isset($dir)) { + $dir = '/tmp'; + } } } diff --git a/examples/consumer/common.php b/examples/consumer/common.php index 67f42735..fddc1c32 100644 --- a/examples/consumer/common.php +++ b/examples/consumer/common.php @@ -50,7 +50,25 @@ function &getStore() { * created elsewhere. After you're done playing with the example * script, you'll have to remove this directory manually. */ - $store_path = "/tmp/_php_consumer_test"; + $store_path = null; + if (function_exists('sys_get_temp_dir')) { + $store_path = sys_get_temp_dir(); + } + else { + if (strpos(PHP_OS, 'WIN') === 0) { + $store_path = $_ENV['TMP']; + if (!isset($store_path)) { + $dir = 'C:\Windows\Temp'; + } + } + else { + $store_path = @$_ENV['TMPDIR']; + if (!isset($store_path)) { + $store_path = '/tmp'; + } + } + } + $store_path .= DIRECTORY_SEPARATOR . '_php_consumer_test'; if (!file_exists($store_path) && !mkdir($store_path)) {