-- Petr Spurny (NIDM) <[EMAIL PROTECTED]> wrote
(on Thursday, 18 October 2007, 09:22 AM +0200):
> I'm tryin convert some part of my project which is writed under old ZF
> release (less than 1.0), but I get only this error:
> Fatal error:  Call to a member function notifyPreDispatch() on a non-object
> in D:\workspace\SOC IS\library\Zend\Controller\Action.php on line 492

My guess is that you wrote your controller such that you're overwriting
the __construct() method. If so, rename it to 'init'.

Here's the reason why: Zend_Controller_Action::__construct() has a
complex signature and does a lot under the hood. If you forget to do the
call to parent::__construct(), or forget any of the parameters, you're
going to mangle the functionality, which includes:

  * setting the request and response objects
  * setting the request parameters
  * initializing the helper broker

If you look at the line referenced in Zend_Controller_Action, it's
trying to do an action on the helper broker, which is initialized in the
constructor; the 'call to a member function ... on a non-object' message
indicates it wasn't initialized.

So, again, short answer: in your action controller, rename the
__construct() method to init().

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to