2010年3月18日星期四

[fw-mvc] Re: [fw-general] Action gets called twice

Most of the time this is due to a missing stylesheet, javascript, or image. I would take a look at your layout (or login page) for a broken/missing reference.

It could also be a stylesheet that has an invalid background URL. Make sure all background image URLs start with "/" e.g. "/images/background.png" instead of "images/background.png".

I hope this helps.

--
Hector


On Thu, Mar 18, 2010 at 6:29 AM, Patrick Figel <patfigel@gmail.com> wrote:
Hi,

I just found out that all actions in our application get called twice.

There's a related issue on stackoverflow:
http://stackoverflow.com/questions/721205/Zend-Framework-Action-Gets-Called-Twice

Disabling all controller plugins which could force a redirect,
removing all _forwards etc., didn't solve the issue.

Like that guy on stackoverflow, I'm using Zend_Controller_Router_Route:

       $route = new Zend_Controller_Router_Route(
           ':language/:region/:controller/:action/*',
           array(
               'language'   => 'de',
               'region' => 'at',
               'controller' => 'index',
               'action'     => 'index'
           )
       );

I tried to debug this by writing debug_backtrace's output to the log
and found this after _one_ request:

#0  LoginController->indexAction() called at
[*\library\Zend\Controller\Action.php:513]
#1  Zend_Controller_Action->dispatch(indexAction) called at
[*\library\Zend\Controller\Dispatcher\Standard.php:289]
#2  Zend_Controller_Dispatcher_Standard->dispatch(Zend_Controller_Request_Http
Object ([] => Array ([0] => _GET,[1] => _POST),[] =>
*/public/index.php/de/at/login/index/,[] => */public/index.php,[] =>
,[] => /de/at/login/index/,[] => Array ([language] => de,[region] =>
at,[controller] => login,[action] => index),[] => ,[] => Array (),[]
=> 1,[] => default,[] => module,[] => login,[] => controller,[] =>
index,[] => action), Zend_Controller_Response_Http Object ([] => Array
(),[] => Array (),[] => Array (),[] => Array (),[] => 200,[] => ,[] =>
,[headersSentThrowsException] => 1)) called at
[*\library\Zend\Controller\Front.php:954]
#3  Zend_Controller_Front->dispatch() called at
[*\library\Zend\Application\Bootstrap\Bootstrap.php:97]
#4  Zend_Application_Bootstrap_Bootstrap->run() called at
[*\library\Zend\Application.php:366]
#5  Zend_Application->run() called at [*\public\index.php:45]
------
#0  LoginController->indexAction() called at
[*\library\Zend\Controller\Action.php:513]
#1  Zend_Controller_Action->dispatch(indexAction) called at
[*\library\Zend\Controller\Dispatcher\Standard.php:289]
#2  Zend_Controller_Dispatcher_Standard->dispatch(Zend_Controller_Request_Http
Object ([] => Array ([0] => _GET,[1] => _POST),[] =>
*/public/index.php/de/at/login/index/,[] => */public/index.php,[] =>
,[] => /de/at/login/index/,[] => Array ([language] => de,[region] =>
at,[controller] => login,[action] => index),[] => ,[] => Array (),[]
=> 1,[] => default,[] => module,[] => login,[] => controller,[] =>
index,[] => action), Zend_Controller_Response_Http Object ([] => Array
(),[] => Array (),[] => Array (),[] => Array (),[] => 200,[] => ,[] =>
,[headersSentThrowsException] => 1)) called at
[*\library\Zend\Controller\Front.php:954]
#3  Zend_Controller_Front->dispatch() called at
[*\library\Zend\Application\Bootstrap\Bootstrap.php:97]
#4  Zend_Application_Bootstrap_Bootstrap->run() called at
[*\library\Zend\Application.php:366]
#5  Zend_Application->run() called at [*\public\index.php:45]

I added sleep(5) to the action and logged $_SERVER[''REQUEST_TIME']:
array (
 ...
 'REQUEST_TIME' => 1268918186,
 ...
)

array (
 ...
 'REQUEST_TIME' => 1268918191,
 ...
)

The app is running on Win2k3/IIS 6 with Zend Server CE 4.0/PHP 5.3

Any idea?

Thanks,

没有评论: