EllisLab/CodeIgniter — pull request #1352 by sourcejedi (2012-05-11 16:38:40+00:00)
Title: 404 and router fixes

Don't create the controller twice when using 404_override

That's the main commit anyway. While I was rearranging this, I tried to avoid breaking anything. Since the boundary of what would work as expected was a little ragged, I had to shore it up a bit first :).

2.1.0 tried to make it safe to create the controller twice. However I still noticed a problem when loading models in the constructor of MY_Controller (using db auto-connect). This caused an error "Undefined property: Page_Not_Found::$db" in system/core/Model.php.

I wouldn't be surprised if there were other lurking issues with the same root cause. (E.g. I notice the hooks called "pre_controller" and "post_controller". Those names could be misleading, in the case where the controller was created twice).