svn: /pear/packages/File/trunk/File/ Util.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Fri, 11 Mar 2011 23:16:46 +0000 |
| Subject: | svn: /pear/packages/File/trunk/File/ Util.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-61412@lists.php.net to get a copy of this message | ||
dufuz Fri, 11 Mar 2011 23:16:46 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=309132
Log:
Fix a problem in the realpath function where \ was not being translated over to / on non Windows
systems.
Changed paths:
U pear/packages/File/trunk/File/Util.php
Modified: pear/packages/File/trunk/File/Util.php
===================================================================
--- pear/packages/File/trunk/File/Util.php 2011-03-11 22:32:10 UTC (rev 309131)
+++ pear/packages/File/trunk/File/Util.php 2011-03-11 23:16:46 UTC (rev 309132)
@@ -186,9 +186,9 @@
}
/**
- * Checks for a file's existence, taking the current include path
+ * Checks for a file's existence, taking the current include path
* into consideration
- *
+ *
* This method can be called statically
* (e.g., File_Util::isIncludable('config.php'))
*
@@ -196,7 +196,7 @@
* @param string $sep the directory separator (optional)
* @return string the includable path
* @access public
- * @static
+ * @static
*/
function isIncludable($file, $sep = DIRECTORY_SEPARATOR)
{
@@ -208,9 +208,9 @@
if (file_exists($file)) {
return $file;
}
- return NULL;
+ return null;
}
-
+
/**
* Get path relative to another path
*
@@ -262,8 +262,8 @@
}
$drive = '';
+ $path = preg_replace('/[\\\\\/]/', $separator, $path);
if (FILE_WIN32) {
- $path = preg_replace('/[\\\\\/]/', $separator, $path);
if (preg_match('/([a-zA-Z]\:)(.*)/', $path, $matches)) {
$drive = $matches[1];
$path = $matches[2];
@@ -505,11 +505,11 @@
'peta', 'exa', 'zetta', 'yotta'
);
$max = count($names) - 1;
-
+
for ($a = 0; $size >= $base && $a < $max; $a++) {
$size /= $base;
}
-
+
$name = ($oldStyle || !$useBiBytes)
? $names[$a]
: $names[$a] . 'bi';
@@ -521,10 +521,8 @@
} else {
$name .= $size == 1 ? 'byte' : 'bytes';
}
-
+
return round($size, $decimals) . ' ' . $name;
}
}
-
-?>