forked from phpbb/phpbb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request phpbb#6553 from marc1706/ticket/17201
[ticket/17201] Do not run dirname() on dir path during install redirect
- Loading branch information
Showing
3 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* | ||
* This file is part of the phpBB Forum Software package. | ||
* | ||
* @copyright (c) phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
* For full copyright and license information, please see | ||
* the docs/CREDITS.txt file. | ||
* | ||
*/ | ||
|
||
class phpbb_get_install_redirect_test extends phpbb_test_case | ||
{ | ||
public function data_redirect(): array | ||
{ | ||
return [ | ||
[ | ||
['REQUEST_URI' => '/foo/bar/'], | ||
'/foo/bar/install/app.php', | ||
], | ||
[ | ||
['REQUEST_URI' => '/foo/bar/index.php'], | ||
'/foo/bar/install/app.php', | ||
], | ||
[ | ||
['REQUEST_URI' => '/foo/bar'], | ||
'/foo/install/app.php', | ||
], | ||
[ | ||
['REQUEST_URI' => '/foo/'], | ||
'/foo/install/app.php', | ||
], | ||
[ | ||
['REQUEST_URI' => '/foo/index.php'], | ||
'/foo/install/app.php', | ||
], | ||
[ | ||
[ | ||
'REQUEST_URI' => '/foo/bar/', | ||
'PHP_SELF' => '/foo/bar/index.php' | ||
], | ||
'/foo/bar/install/app.php', | ||
], | ||
[ | ||
[ | ||
'REQUEST_URI' => '', | ||
'PHP_SELF' => '/foo/bar/index.php' | ||
], | ||
'/foo/bar/install/app.php', | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @backupGlobals enabled | ||
* @dataProvider data_redirect | ||
*/ | ||
public function test_install_redirect($server_vars, $expected) | ||
{ | ||
$phpbb_root_path = '/'; | ||
$phpEx = 'php'; | ||
|
||
$_SERVER = array_merge($_SERVER, $server_vars); | ||
$this->assertEquals($expected, phpbb_get_install_redirect($phpbb_root_path, $phpEx)); | ||
} | ||
} |