php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62862 Yaf_Plugin_Abstract::preResponse method is never executed
Submitted: 2012-08-19 05:06 UTC Modified: 2012-08-19 10:38 UTC
From: mzsolti at gmail dot com Assigned:
Status: Not a bug Package: yaf (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mzsolti at gmail dot com
New email:
PHP Version: OS:

 

 [2012-08-19 05:06 UTC] mzsolti at gmail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-19 10:38 UTC] laruence@php.net
preResponse is same as dispatchLoopShutdown,  so, it was removed later...  should 
be a doc problem
 [2012-08-19 10:38 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC