mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #4614 from wisoot/patch-1
Fix dispatch filters that have regular string as a key
This commit is contained in:
commit
d34ff71e50
2 changed files with 11 additions and 1 deletions
|
@ -97,7 +97,7 @@ class Dispatcher implements CakeEventListener {
|
|||
|
||||
foreach ($filters as $index => $filter) {
|
||||
$settings = array();
|
||||
if (is_array($filter) && !is_int($index)) {
|
||||
if (is_array($filter) && !is_int($index) && class_exists($index)) {
|
||||
$settings = $filter;
|
||||
$filter = $index;
|
||||
}
|
||||
|
|
|
@ -1328,6 +1328,16 @@ class DispatcherTest extends CakeTestCase {
|
|||
$dispatcher->dispatch($request, $response);
|
||||
$this->assertEquals('Dispatcher.afterDispatch', $request->params['eventName']);
|
||||
|
||||
$dispatcher = new TestDispatcher();
|
||||
Configure::write('Dispatcher.filters', array(
|
||||
'filterTest' => array('callable' => array($dispatcher, 'filterTest'), 'on' => 'before')
|
||||
));
|
||||
|
||||
$request = new CakeRequest('/');
|
||||
$response = $this->getMock('CakeResponse', array('send'));
|
||||
$dispatcher->dispatch($request, $response);
|
||||
$this->assertEquals('Dispatcher.beforeDispatch', $request->params['eventName']);
|
||||
|
||||
// Test that it is possible to skip the route connection process
|
||||
$dispatcher = new TestDispatcher();
|
||||
Configure::write('Dispatcher.filters', array(
|
||||
|
|
Loading…
Reference in a new issue