February 15th, 2007
I love The Daily WTF, but live in fear I will write something worthy of it. However in anything, not just programming, brain fudge is somewhat inevitable. So here’s my latest:
class Admin_Controller extends h_Controller { function __construct() { // parent::__construct(); originally here $form = new h_Form_Example(); $this->processor = new h_Form_Processor($form); parent::__construct(); } function GET() { echo $this->processor->display(); } function POST() { } }
This code work in progress. However if you look at the comment I added in the constructor, then you’ll see how it went wrong early on:
I suppose that’s a warning to not create magic behaviour in the constructor. Moving it solved the problem, but I’m going to clear things up by implementing the auto-behaviour in a dispatch method.