mirror of
https://github.com/php/php-src.git
synced 2025-08-17 14:38:49 +02:00
dirname() should not normalize paths
This is the BC piece with the case where dirname() is used with an URL.
This commit is contained in:
parent
403f352482
commit
ec78507bd4
3 changed files with 31 additions and 3 deletions
|
@ -45,9 +45,9 @@ while ($tmp > $base) {
|
||||||
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath"
|
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath"
|
||||||
bool(true)
|
bool(true)
|
||||||
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
|
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
|
||||||
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library"
|
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
|
||||||
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath"
|
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath"
|
||||||
bool(true)
|
bool(true)
|
||||||
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
|
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
|
||||||
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library"
|
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
|
||||||
===DONE===
|
===DONE===
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
--TEST--
|
||||||
|
Test dirname() function : regression with path normalization
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||||
|
die("skip Only valid for Windows");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$s = '/php_sanity/sanity.php?';
|
||||||
|
while (dirname($s) == "/php_sanity" && strlen($s) < 10000) {
|
||||||
|
$s .= str_repeat('X', 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($s) >= 10000) {
|
||||||
|
echo "OK\n";
|
||||||
|
} else {
|
||||||
|
print "ERROR: " . PHP_EOL;
|
||||||
|
var_dump(dirname($s));
|
||||||
|
var_dump(strlen($s));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
===DONE===
|
||||||
|
--EXPECT--
|
||||||
|
OK
|
||||||
|
===DONE===
|
|
@ -445,7 +445,8 @@ PW32IO size_t php_win32_ioutil_dirname(char *path, size_t len)
|
||||||
|
|
||||||
start = path;
|
start = path;
|
||||||
|
|
||||||
startw = pathw = php_win32_ioutil_conv_any_to_w(path, len, &pathw_len);
|
/* Don't really care about the path normalization, pure parsing here. */
|
||||||
|
startw = pathw = php_win32_cp_conv_any_to_w(path, len, &pathw_len);
|
||||||
if (!pathw) {
|
if (!pathw) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue