Reputation:
we are trying to build an application using the zend framework and have the following problem: "Some controller actions are called twice. This means that the actions gets called, finishes its execution and then gets called again".
We tracked this down by checking entries in a log file. For one request there where 2 entries in the log file.
Do you know anything that might be causing this problem? Is this related with the dispatch process of the Front Controller?
Regards,
Upvotes: 6
Views: 2272
Reputation: 596
I'm using Chrome 17.0.x, Webug and Zend Framework 1.11.1 and still seeing this issue. I disabled Webug as suggested and the Action was only called once.
So, I think this is a bug in Webug.
Upvotes: 1
Reputation: 4905
I found out that action got requested twice when Chrome Extension Webug (FirePHP extension for Google Chrome) was enabled.
Upvotes: 5
Reputation: 11
We were having a similar problem. Some actions were executed twice. After much debugging and googling, found out the problem was a bug in ZFdebug. Installed this patch and everything went back to normal. Hope this helps someone else.
Upvotes: 1
Reputation: 30035
try and use a debugger ( XDebug for example ) to see how your code is runned. focus on the dispatcher, something must have happened and the request action is not set as dispatched so it gets runned again.
Upvotes: 2
Reputation: 2240
It might be a bug. Difficult to tell without more information.
Try logging a backtrace each time the action method is called.
<?php
trigger_error(var_export(debug_backtrace(), true));
trigger_error(var_export($_SERVER, true));
?>
This will give you tons of info in the error-log, so you'll want to export the result to a text-editor and munch through it there. And/or possibly modify the code to print less info.
A couple of things to look for:
If the unique-id is different then you've done two requests to the server. If not, try to figure it out from the backtrace.
Upvotes: 1