[BUGFIX] Detect unix-styled absolute paths on Windows systems 21/24721/3
authorNicole Cordes <typo3@cordes.co>
Mon, 14 Oct 2013 08:12:34 +0000 (10:12 +0200)
committerNicole Cordes <typo3@cordes.co>
Mon, 14 Oct 2013 09:38:58 +0000 (11:38 +0200)
Currently PathUtility::isAbsolutePath and GeneralUtility::isAbsPath
only the for ":\" to detect absolute paths on Windows systems. This
patch provides even ":/" as unix-styled paths are mostly used now.

Resolves: #52773
Releases: 6.2, 6.1, 6.0
Change-Id: I1e132bbe74394861af4bf02a22287c9496953150
Reviewed-on: https://review.typo3.org/24721
Reviewed-by: Thomas Maroschik
Reviewed-by: Wouter Wolters
Reviewed-by: Sascha Egerer
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Classes/Utility/PathUtility.php

index 5436ca6..0b25c21 100644 (file)
@@ -3554,7 +3554,7 @@ Connection: close
         */
        static public function isAbsPath($path) {
                // On Windows also a path starting with a drive letter is absolute: X:/
-               if (TYPO3_OS === 'WIN' && substr($path, 1, 2) === ':/') {
+               if (TYPO3_OS === 'WIN' && (substr($path, 1, 2) === ':/' || substr($path, 1, 2) === ':\\')) {
                        return TRUE;
                }
                // Path starting with a / is always absolute, on every system
index 6d8c332..ad6ac54 100644 (file)
@@ -201,7 +201,7 @@ class PathUtility {
         */
        static public function isAbsolutePath($path) {
                // On Windows also a path starting with a drive letter is absolute: X:/
-               if (static::isWindows() && substr($path, 1, 2) === ':/') {
+               if (static::isWindows() && (substr($path, 1, 2) === ':/' || substr($path, 1, 2) === ':\\')) {
                        return TRUE;
                }
                // Path starting with a / is always absolute, on every system