Commit:    497e577846f27ae06d71dd366df0ad99fee9b7f0
Author:    Christoph M. Becker <cmbecke...@gmx.de>         Fri, 11 Dec 2020 
00:35:04 +0100
Parents:   4d1417801dbee4b0fd1471165c9a4ab8cb0ebc31
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=497e577846f27ae06d71dd366df0ad99fee9b7f0

Log:
Allow to access symlinked docs

Since `realpath()` resolves links, symlinked docs as suggested by the
"Setting up Documentation environment" page[1] are incompatible with
the router script.  Of course, the Webserver can be run without the
router script, but in that case shortcuts (e.g. `/json_decode`) won't
work.

Thus, we remove the `realpath()` resolution.  There is no more need
for the `strncmp()` check.  This suggest that we can get rid of the
`$afilename` and `$len` variables; hopefully, they are not used by any
of the included files.

[1] <http://doc.php.net/tutorial/local-setup.php>

Changed paths:
  M  .router.php


Diff:
diff --git a/.router.php b/.router.php
index 354a6e9e9..d40eda604 100644
--- a/.router.php
+++ b/.router.php
@@ -2,15 +2,11 @@
 $_SERVER["SERVER_ADDR"] = $_SERVER["HTTP_HOST"];
 
 $filename = isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : 
$_SERVER["SCRIPT_NAME"];
-$afilename = $_SERVER["DOCUMENT_ROOT"] . $filename;
-$afilename = realpath($afilename);
-$len = strlen($_SERVER["DOCUMENT_ROOT"]);
 
-if (strncmp($_SERVER["DOCUMENT_ROOT"], $afilename, $len) == 0) {
-    if (file_exists($afilename)) {
-        /* This could be an image or whatever, so don't try to compress it */
-        ini_set("zlib.output_compression", 0);
-        return false;
-    }
+if (file_exists($_SERVER["DOCUMENT_ROOT"] . $filename)) {
+    /* This could be an image or whatever, so don't try to compress it */
+    ini_set("zlib.output_compression", 0);
+    return false;
 }
+
 include_once "error.php";


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to