mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changing SCRIPT_NAME to PHP_SELF
Several shared hosts have issues with SCRIPT_NAME having an incorrect value. Revert back to using PHP_SELF like in 1.3. Fixes #2437 Fixes #2334 Fixes #2268
This commit is contained in:
parent
3e1c567f08
commit
95ec741b6c
3 changed files with 11 additions and 11 deletions
|
@ -249,7 +249,7 @@ class CakeRequest implements ArrayAccess {
|
|||
}
|
||||
|
||||
if (!$baseUrl) {
|
||||
$base = dirname(env('SCRIPT_NAME'));
|
||||
$base = dirname(env('PHP_SELF'));
|
||||
|
||||
if ($webroot === 'webroot' && $webroot === basename($base)) {
|
||||
$base = dirname($base);
|
||||
|
|
|
@ -891,7 +891,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
Configure::write('App.baseUrl', false);
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
|
||||
$_SERVER['SCRIPT_NAME'] = '/1.2.x.x/app/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/1.2.x.x/app/webroot/index.php';
|
||||
$_SERVER['PATH_INFO'] = '/posts/view/1';
|
||||
|
||||
$request = new CakeRequest();
|
||||
|
@ -901,7 +901,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/app/webroot';
|
||||
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/index.php';
|
||||
$_SERVER['PATH_INFO'] = '/posts/add';
|
||||
$request = new CakeRequest();
|
||||
|
||||
|
@ -910,7 +910,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$this->assertEquals($request->url, 'posts/add');
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/test/';
|
||||
$_SERVER['SCRIPT_NAME'] = '/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/webroot/index.php';
|
||||
$request = new CakeRequest();
|
||||
|
||||
$this->assertEquals('', $request->base);
|
||||
|
@ -918,7 +918,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/some/apps/where';
|
||||
$_SERVER['SCRIPT_NAME'] = '/app/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/app/webroot/index.php';
|
||||
$request = new CakeRequest();
|
||||
|
||||
$this->assertEquals($request->base, '');
|
||||
|
@ -927,7 +927,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
Configure::write('App.dir', 'auth');
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
|
||||
$_SERVER['SCRIPT_NAME'] = '/demos/auth/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/demos/auth/webroot/index.php';
|
||||
|
||||
$request = new CakeRequest();
|
||||
|
||||
|
@ -937,7 +937,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
Configure::write('App.dir', 'code');
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/Library/WebServer/Documents';
|
||||
$_SERVER['SCRIPT_NAME'] = '/clients/PewterReport/code/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/clients/PewterReport/code/webroot/index.php';
|
||||
$request = new CakeRequest();
|
||||
|
||||
$this->assertEquals($request->base, '/clients/PewterReport/code');
|
||||
|
@ -951,7 +951,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
*/
|
||||
public function testBaseUrlwithModRewriteAlias() {
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/home/aplusnur/public_html';
|
||||
$_SERVER['SCRIPT_NAME'] = '/control/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/control/index.php';
|
||||
|
||||
Configure::write('App.base', '/control');
|
||||
|
||||
|
@ -965,7 +965,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
Configure::write('App.webroot', 'newaffiliate');
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html';
|
||||
$_SERVER['SCRIPT_NAME'] = '/newaffiliate/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/newaffiliate/index.php';
|
||||
$request = new CakeRequest();
|
||||
|
||||
$this->assertEquals($request->base, '/newaffiliate');
|
||||
|
@ -1106,7 +1106,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
*/
|
||||
public function testGetParamsWithDot() {
|
||||
$_GET['/posts/index/add_add'] = '';
|
||||
$_SERVER['SCRIPT_NAME'] = '/cake_dev/app/webroot/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php';
|
||||
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/index/add.add';
|
||||
|
||||
$request = new CakeRequest();
|
||||
|
|
|
@ -877,7 +877,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
*/
|
||||
public function testAutomaticPluginDispatch() {
|
||||
$_POST = array();
|
||||
$_SERVER['SCRIPT_NAME'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||
|
||||
Router::reload();
|
||||
$Dispatcher = new TestDispatcher();
|
||||
|
|
Loading…
Reference in a new issue