Skip to content

Commit

Permalink
Merge pull request #1260 from sjinks/issue-1258
Browse files Browse the repository at this point in the history
[1.3.0] Regression test for Issue #1258
  • Loading branch information
Phalcon committed Sep 20, 2013
2 parents f7a9dc5 + 1317dcc commit 6a0e6d4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ before_script:
- ulimit -c unlimited || true

script:
- (cd ext; NO_INTERACTION=1 make test)
- $(phpenv which php) ./unit-tests/ci/phpunit.php --debug -c unit-tests/phpunit.xml
- PHALCON_NO_RVO=1 $(phpenv which php) ./unit-tests/ci/phpunit.php --debug -c unit-tests/phpunit.xml

Expand Down
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 6a0e6d4

Please sign in to comment.