Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4dc50f8

Browse files
author
iustin
committed
https://bugs.php.net/64566
1 parent 176253e commit 4dc50f8

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

‎src/router.class.php‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ private function init()
6969
}, E_ALL);
7070

7171
$this->request_uri = \filter_input(\INPUT_SERVER, 'REQUEST_URI', \FILTER_SANITIZE_ENCODED);
72-
$this->request_uri = preg_replace('([/\\\]+)', '/', urldecode($this->request_uri));
72+
$this->request_uri = $this->format_unix(urldecode($this->request_uri));
7373

74-
$this->physical_file = preg_replace('([/\\\]+)', '/', $_SERVER['SCRIPT_FILENAME']);
74+
$this->physical_file = $this->format_unix($_SERVER['SCRIPT_FILENAME']);
7575
$this->extension = strrev(strstr(strrev($this->physical_file), '.', TRUE));
7676

7777
$this->last_modified = time();
@@ -239,6 +239,16 @@ function process_request()
239239

240240
}
241241

242+
/**
243+
* Format to UNIX path
244+
* @param string $str
245+
* @return mixed
246+
*/
247+
private function format_unix($str = "")
248+
{
249+
return preg_replace('([/\\\]+)', '/', $str);
250+
}
251+
242252
/**
243253
* Serve your application
244254
*/
@@ -257,6 +267,12 @@ function console_output()
257267
}
258268

259269
chdir($_SERVER['DOCUMENT_ROOT']);
270+
271+
if (ini_get('auto_prepend_file') && !in_array(realpath(ini_get('auto_prepend_file')), get_included_files(), true)) {
272+
273+
include(ini_get('auto_prepend_file'));
274+
275+
}
260276

261277
$uri_path = $this->URI_no_query();
262278
$uri_filepath = $_SERVER['DOCUMENT_ROOT'] . '/' . urldecode(substr($uri_path, 1));
@@ -311,14 +327,14 @@ function console_output()
311327
}
312328

313329
$load_index = $_SERVER['DOCUMENT_ROOT'] . "/" . $this->indexPath;
314-
$load_index = preg_replace('([/\\\]+)', '/', trim($load_index));
330+
$load_index = $this->format_unix(trim($load_index));
315331

316332
/**
317333
* Fix server globals
318334
*/
319-
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . $this->indexPath;
320-
$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR . $this->indexPath;
321-
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $this->indexPath;
335+
$_SERVER['SCRIPT_NAME'] = $this->format_unix(DIRECTORY_SEPARATOR . $this->indexPath);
336+
$_SERVER['PHP_SELF'] = $this->format_unix(DIRECTORY_SEPARATOR . $this->indexPath);
337+
$_SERVER['SCRIPT_FILENAME'] = $this->format_unix($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $this->indexPath);
322338

323339
if (!file_exists($load_index)) {
324340

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /