CodeSOD: Default Actions
Bleu supports a Pimcore-based PHP site. Pimcore is a rather sprawling enterprise system for PHP. Like many Model-View-Controller type frameworks, maps HTTP requests to actions on controllers. Bleu's team has several "default" actions configured on their controllers. Let's take a look at a few of them.
public function searchAction(){ // TODO: replace with actual search // instead of static page showing all important subpages.}
We open with a search feature that's worse than Confluence's. But at least there's a plan to make it better, though I suspect that TODO will outlive me.
public function ajaxAction(){ if ( $this->_request->isXmlHttpRequest() ) { echo 'ssss'; } die('ddd');}
This site looks at Ajax requests and hisses at them, then drops dead.
public function errorAction(){ header('HTTP/1.1 404 Not Found'); $this->disableLayout(); // where did i go?}
For any error, we return a 404. That won't make diagnosing problems hard in the future, it's not like HTTP error codes exist for a reason or anything.
But what happens when we have an actual 404?
public function notFoundAction(){ $this->setLayout('error'); // this will never happen.}
Oh, that's good to know. It's impossible.
Now, Bleu didn't provide any of the mappings which show how these actions are actually connected to HTTP requests, but these are their "default" actions, so they are actually mapped to HTTP requests. Whether notFound is actually tied to 404 errors, I'm just guessing at- but it is used, so if it's used for something different, that's it's own WTF.
[Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.