com web/php: Maybe some mirrors are using symlinks for the docroot, thats why its failing?: cached.php
| From: | Hannes Magnusson | Date: | Fri, 22 Nov 2013 08:48:56 +0000 |
| Subject: | com web/php: Maybe some mirrors are using symlinks for the docroot, thats why its failing?: cached.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-17193@lists.php.net to get a copy of this message | ||
Commit: c7cdf751580bbb796e6772b58cefc4334690d64a
Author: Hannes Magnusson <bjori@mongodb.com> Fri, 22 Nov 2013 00:48:56 -0800
Parents: 1d2a2e9ef64493c102768296907b3eaf2860728f
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=c7cdf751580bbb796e6772b58cefc4334690d64a
Log:
Maybe some mirrors are using symlinks for the docroot, thats why its failing?
Changed paths:
M cached.php
Diff:
diff --git a/cached.php b/cached.php
index 0de9e2d...3d6305b 100644
--- a/cached.php
+++ b/cached.php
@@ -6,11 +6,12 @@ if (!isset($_GET["f"])) {
header("Location: http://php.net/");
exit;
}
-$abs = $_SERVER["DOCUMENT_ROOT"]. "/" .(string)$_GET["f"];
+$pwd = realpath($_SERVER["DOCUMENT_ROOT"]);
+$abs = $pwd. "/" .(string)$_GET["f"];
$abs = realpath($abs);
-if (strncmp($abs, $_SERVER["DOCUMENT_ROOT"], strlen($_SERVER["DOCUMENT_ROOT"]))
!= 0) {
- header("Location: http://php.net");
+if (strncmp($abs, $pwd, strlen($pwd)) != 0) {
+ header("Location: http://php.net/$abs");
exit;
}