Solved! Thanks a lot!

It was so "simply" - renaming __construct() to init() solved problem
actually. Lost three days on this error :-(
I was looking into Zend_Controller_Action and see initializing helper broker
but I'm pretty new in ZF and I'm understanding it not so fast as I wish.

Thanks lot for help and this nice piece of software :-)

Petr Spurny


-----Original Message-----
From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 18, 2007 2:19 PM
To: [email protected]
Subject: Re: [fw-general] Fatal error: Call to a member
functionnotifyPreDispatch() on a non-object

-- 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