summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/Auth/OpenID/StoreTest.php23
-rw-r--r--examples/consumer/common.php20
2 files changed, 33 insertions, 10 deletions
diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php
index 7c50e2f..4ff9f22 100644
--- a/Tests/Auth/OpenID/StoreTest.php
+++ b/Tests/Auth/OpenID/StoreTest.php
@@ -23,15 +23,20 @@ require_once 'Auth/OpenID.php';
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 67f4273..fddc1c3 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)) {