2008-12-08 Dean McNamee <deanm@chromium.org>
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Dec 2008 10:20:57 +0000 (10:20 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Dec 2008 10:20:57 +0000 (10:20 +0000)
        Reviewed by Darin Adler.

        Always append a trailing slash when using PHP's sys_get_temp_dir().

        This allows these tests to run on Linux, where this API returns the
        directory without a trailing slash.

        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php:
        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php:
        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache.php:
        * http/tests/xmlhttprequest/resources/portabilityLayer.php:
        * http/tests/xmlhttprequest/resources/reset-temp-file.php:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39202 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php
LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php
LayoutTests/http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache.php
LayoutTests/http/tests/xmlhttprequest/resources/portabilityLayer.php
LayoutTests/http/tests/xmlhttprequest/resources/reset-temp-file.php

index 87c7ac5..f642505 100644 (file)
@@ -1,3 +1,18 @@
+2008-12-08  Dean McNamee  <deanm@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Always append a trailing slash when using PHP's sys_get_temp_dir().
+
+        This allows these tests to run on Linux, where this API returns the
+        directory without a trailing slash.
+
+        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-invalidation.php:
+        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php:
+        * http/tests/xmlhttprequest/resources/access-control-basic-preflight-cache.php:
+        * http/tests/xmlhttprequest/resources/portabilityLayer.php:
+        * http/tests/xmlhttprequest/resources/reset-temp-file.php:
+
 2008-12-10  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
 
         Rubber-stamped by George Staikos.
index 96758a8..3374866 100755 (executable)
@@ -1,8 +1,7 @@
 <?php
 require_once 'portabilityLayer.php';
 
-$tempDir = sys_get_temp_dir();
-$tmpFile = $tempDir . $_GET['filename'];
+$tmpFile = sys_get_temp_dir() . '/' . $_GET['filename'];
 
 function fail()
 {
index 2cfbdae..c6f5896 100755 (executable)
@@ -1,8 +1,7 @@
 <?php
 require_once 'portabilityLayer.php';
 
-$tempDir = sys_get_temp_dir();
-$tmpFile = $tempDir . $_GET['filename'];
+$tmpFile = sys_get_temp_dir() . '/' . $_GET['filename'];
 
 function fail()
 {
index 5ce4f80..8502ea0 100755 (executable)
@@ -2,15 +2,19 @@
 
 if (!function_exists('sys_get_temp_dir')) {
     // Based on http://www.phpit.net/article/creating-zip-tar-archives-dynamically-php/2/
+    // If the builtin PHP sys_get_temp_dir doesn't exist, we replace it with one that will
+    // try to guess from the environment.  Since sys_get_temp_dir() doesn't return a trailing
+    // slash on all system (see comment at http://us.php.net/sys_get_temp_dir), we don't
+    // append a trailing slash, and expect callers to append one when needed.
     function sys_get_temp_dir()
     {
         // Try to get from environment variable
         if (!empty($_ENV['TMP'])) {
-            return realpath($_ENV['TMP']) . "/";
+            return realpath($_ENV['TMP']);
         } else if (!empty($_ENV['TMPDIR']) ) {
-            return realpath($_ENV['TMPDIR']) . "/";
+            return realpath($_ENV['TMPDIR']);
         } else if ( !empty($_ENV['TEMP'])) {
-            return realpath( $_ENV['TEMP']) . "/";
+            return realpath( $_ENV['TEMP']);
         }
         return FALSE;
     }
index 097084a..de5a827 100755 (executable)
@@ -1,7 +1,6 @@
 <?php
 require_once 'portabilityLayer.php';
 
-$tempDir = sys_get_temp_dir();
-$tmpFile = $tempDir . $_GET['filename'];
+$tmpFile = sys_get_temp_dir() . '/' . $_GET['filename'];
 unlink($tmpFile)
 ?>