1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Enhancement: Expose happy path (#406)

* Enhancement: Expose happy path

* Fix: Require file with absolute path

* Fix: Return null instead of false
This commit is contained in:
Andreas Möller
2023-12-06 19:31:09 +01:00
committed by GitHub
parent 2b708363b5
commit ede0692b3e

View File

@@ -3,10 +3,12 @@ $_SERVER["SERVER_ADDR"] = $_SERVER["HTTP_HOST"];
$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;