views:

27

answers:

3

Hello guys, Im hours and hours finding why one of my ZEND plugin sometimes running twice (depends on URL)

Note that my plugin has preDispatch and postDispatch methods and when I debugging the code it works like this:

MY_Plugin:preDispatch (echo $_SESSION['DBG'] has value)
MY_Plugin:postDispatch (unset($_SESSION['DBG']))

and then again

MY_Plugin:preDispatch (echo $_SESSION['DBG'] not exist)
MY_Plugin:postDispatch

This is part of bootstrap code

$_SESSION['DBG'] = 'value';
$MYrouter = new MY_Router_MyRouter();
$frontController->setRouter($MYrouter);
$frontController->registerPlugin(new MY_Plugin());

Do you have any suggestion how this could occur or how can I simulate this.

Thanks for any suggestion Cervenak

A: 

The dispatcher loop most likely running twice (the controller is dispatched twice). Possible causes:

  • using action view helper
  • calling _forward
  • redirector action helper
  • manually calling dispatch()
  • dispatch loop aborted and started again (eg. resetting request params)

Also, take a look at this ZF flow diagram (hotlinked from php-professionals.com)

takeshin
A: 

Another reason could be an missing favicon.ico :-)

If the Apache cant find it, it fires a second request.

ArneRie
+1  A: 

Thanks guys for lot of valuable hints.

Now watch my story :)

First I had turned off showing exceptions (parameter False). So I switch them ON to see exception notification.

$frontController->throwExceptions(true);

Than I saw that I dont have uploaded controller and view files. After uploading them ZEND started to work corectly.

Good to know to have this direction set ON during debugging. You could probably save hours.

cervenak