I’m looking at the error.log for my CakePHP application, and seeing that I’m periodically getting this kind of thing:
2011-07-28 14:49:39 Warning: Warning (2): Missing argument 2 for NewsController::item()
in [/app/controllers/news_controller.php, line 771]
Seems fairly straightforward what’s going on here: the item action used to just take an id parameter, and now it wants day, year, month, id. Somewhere there must be a deprecated call to item passing just an id.
Unfortunately, I don’t know where this somewhere is, in my increasingly sprawling application. And the application doesn’t seem to be breaking by not finding news items at any point. So it seems like it might be somewhere really well hidden.
What would be the best strategy for efficiently locating the source of these error messages?
Usually it’s caused by bad link somewhere in your application that didn’t consider the additional parameters and your users clicking on them. For a start, you can start searching for things like
/news/item/throughout your application views folder.EDIT:
Or in your item() method, do a logging like
if(empty($thirdParam) || empty($fourthParam)) $this->log($this->referer);, this way you can look into where the method is accessed from. It might not be always reliable, but yeah worth a try