Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Sep 20, 2013
1 parent 2b82b16 commit 406d2ce
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions ext/tests/issue-1258.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--TEST--
Segmentation fault in zim_Phalcon_Mvc_Dispatcher__throwDispatchException - https://github.com/phalcon/cphalcon/issues/1258
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php

class Secure extends Phalcon\Mvc\User\Plugin
{
public function beforeDispatch(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher)
{
$acl = new \Phalcon\Acl\Adapter\Memory();
$acl->setDefaultAction(Phalcon\Acl::ALLOW);
$acl->addRole(new \Phalcon\Acl\Role('test'));

$acl->isAllowed('test' , 'test' , 'test');
$acl->isAllowed('test' , 'test' , 'test');
}
}

$di = new \Phalcon\DI\FactoryDefault();
$di->set(
'dispatcher',
function () use ($di) {
$eventsManager = $di->getShared('eventsManager');

$secure = new \Secure($di);
$eventsManager->attach('dispatch' , $secure);

$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);

return $dispatcher;
}
);

$di['view'] = function(){
return new Phalcon\Mvc\View();
};

$application = new \Phalcon\Mvc\Application($di);
try {
$application->handle()->getContent();
}
catch (Exception $e) {
echo $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
IndexController handler class cannot be loaded

0 comments on commit 406d2ce

Please sign in to comment.