ZF-7594: Fatal error: Call to a member function getHeader()

Issue Type: Bug Created: 2009-08-14T05:31:47.000+0000 Last Updated: 2009-08-27T14:23:16.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: Holger Schäfer (hschaefer123) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Rest_Route

Related issues: - ZF-7655

Attachments: - ZF-7594 request object


Using the Zend_Rest_Route throws fatal error PHP Fatal error: Call to a member function getHeader() on a non-object in ...\Zend\Rest\Route.php on line 165

i commented this part out to get the rest working

<pre class="highlight">
      } elseif ( $this->_request->getHeader('X-HTTP-Method-Override') ) {
      $values[$this->_actionKey] = strtolower($this->_request->getHeader('X-HTTP-Method-Override'));

The problem remains under php 5.2.10 under Windows XP Apache 2.2 as module.

(Info: inside creating issues the component selector does not show all components, so i decided to chose unknown)


Posted by Satoru Yoshida (satoruyoshida) on 2009-08-21T19:08:16.000+0000

Set component and change assinee

Posted by Luke Crouch (lcrouch) on 2009-08-25T13:53:15.000+0000

Can you show me the setup code you used to construct the Route object? I need a way to duplicate the issue with a test so I can fix it reliably.

Thanks, -L

Posted by Holger Schäfer (hschaefer123) on 2009-08-26T00:23:32.000+0000

I'm using the Zend_Application with my own run method inside the Bootstrap adding the Zend_Rest_Route for my test controller 'member' inside the default module:

public function run() { $front = $this->getResource('FrontController'); $default = $front->getDefaultModule(); if (null === $front->getControllerDirectory($default)) { throw new Zend_Application_Bootstrap_Exception( 'No default controller directory registered with front controller' ); }

    try {        
        $front = Zend_Controller_Front::getInstance();
    $restRoute = new Zend_Rest_Route($front, array(), array(
            'default' => array('member')
   $front->getRouter()->addRoute('rest', $restRoute);

        $front->setParam('bootstrap', $this)    

    } catch (Exception $e) {
        echo $e->getMessage();

Posted by Holger Schäfer (hschaefer123) on 2009-08-26T00:25:38.000+0000

This is the $request object from inside Zend_Rest_Route->match($request)

Posted by Matthew Weier O'Phinney (matthew) on 2009-08-27T12:22:01.000+0000

Fixed in trunk and 1.9 release branch.

Posted by Luke Crouch (lcrouch) on 2009-08-27T14:23:15.000+0000

Thanks MWO. Did we need a test case for it? I had the same fix ready to go but had trouble reproducing in a test case. :(

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.