[web-php] master: Enhancement: Expose happy path (#406)
| From: | Andreas Möller via GitHub | Date: | Wed, 06 Dec 2023 18:44:49 +0000 |
| Subject: | [web-php] master: Enhancement: Expose happy path (#406) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31206@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2023-12-06T18:31:09Z
Commit: https://github.com/php/web-php/commit/ede0692b3ef68003b09054956f3c282dc8a6b3f3
Raw diff: https://github.com/php/web-php/commit/ede0692b3ef68003b09054956f3c282dc8a6b3f3.diff
Enhancement: Expose happy path (#406)
* Enhancement: Expose happy path
* Fix: Require file with absolute path
* Fix: Return null instead of false
Changed paths:
M .router.php
Diff:
diff --git a/.router.php b/.router.php
index 723801a273..e5bac226f5 100644
--- a/.router.php
+++ b/.router.php
@@ -3,10 +3,12 @@
$filename = $_SERVER["PATH_INFO"] ?? $_SERVER["SCRIPT_NAME"];
-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;
+if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $filename)) {
+ require_once __DIR__ . '/error.php';
+
+ return;
}
-include_once "error.php";
+/* This could be an image or whatever, so don't try to compress it */
+ini_set("zlib.output_compression", 0);
+return null;