|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-08-19 10:38 UTC] laruence@php.net
[2012-08-19 10:38 UTC] laruence@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 03:00:01 2025 UTC |
Description: ------------ Creating a plugin from Yaf_Plugin_Abstract and registering it at the dispatcher, will not have the preResponse method executed. Test script: --------------- <?php $config = array( "application" => array( "directory" => realpath(dirname(__FILE__)), "dispatcher" => array( "catchException" => 0, "throwException" => 1, ), "modules" => "module", ), ); class ControllerController extends Yaf_Controller_Abstract { public function indexAction() { Yaf_Dispatcher::getInstance()->disableView(); echo 'indexAction in Controller'; } } class UserPlugin extends Yaf_Plugin_Abstract{ public function preResponse($request, $response) { echo "preResponse in Plugin".PHP_EOL; } } $app = new Yaf_Application($config); $request = new Yaf_Request_Http("/module/controller/index"); $dispatcher = $app->getDispatcher(); $user = new UserPlugin(); $dispatcher->registerPlugin($user); try { $dispatcher->returnResponse(true)->dispatch($request); } catch (Yaf_Exception $e) { echo $e->getMessage(), "\n"; } ?> Expected result: ---------------- preResponse in Plugin indexAction in Controller Actual result: -------------- indexAction in Controller