mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix incorrect exception type when double slash paths are used.
Fixes #3838
This commit is contained in:
parent
e23c4ffad9
commit
f8c6138ad7
2 changed files with 18 additions and 1 deletions
|
@ -124,7 +124,7 @@ class AssetDispatcher extends DispatcherFilter {
|
|||
}
|
||||
|
||||
$plugin = Inflector::camelize($parts[0]);
|
||||
if (CakePlugin::loaded($plugin)) {
|
||||
if ($plugin && CakePlugin::loaded($plugin)) {
|
||||
unset($parts[0]);
|
||||
$fileFragment = urldecode(implode(DS, $parts));
|
||||
$pluginWebroot = CakePlugin::path($plugin) . 'webroot' . DS;
|
||||
|
|
|
@ -121,4 +121,21 @@ class AssetDispatcherTest extends CakeTestCase {
|
|||
$this->assertSame($response, $filter->beforeDispatch($event));
|
||||
$this->assertEquals($time->format('D, j M Y H:i:s') . ' GMT', $response->modified());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that no exceptions are thrown for //index.php type urls.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test404OnDoubleSlash() {
|
||||
$filter = new AssetDispatcher();
|
||||
|
||||
$response = $this->getMock('CakeResponse', array('_sendHeader'));
|
||||
$request = new CakeRequest('//index.php');
|
||||
$event = new CakeEvent('Dispatcher.beforeRequest', $this, compact('request', 'response'));
|
||||
|
||||
$this->assertNull($filter->beforeDispatch($event));
|
||||
$this->assertFalse($event->isStopped());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue