Zend Framework

Fatal error: Call to a member function getHeader()

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Rest_Route
  • Labels:
    None

Description

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

/* UOPS ERROR
      } 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)

Issue Links

Activity

Hide
Satoru Yoshida added a comment -

Set component and change assinee

Show
Satoru Yoshida added a comment - Set component and change assinee
Hide
Luke Crouch added a comment -

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

Show
Luke Crouch added a comment - 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
Hide
Holger Schäfer added a comment -

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) ->dispatch(); } catch (Exception $e) { echo $e->getMessage(); }
}

Show
Holger Schäfer added a comment - 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) ->dispatch(); } catch (Exception $e) { echo $e->getMessage(); } }
Hide
Holger Schäfer added a comment -

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

Show
Holger Schäfer added a comment - This is the $request object from inside Zend_Rest_Route->match($request)
Hide
Matthew Weier O'Phinney added a comment -

Fixed in trunk and 1.9 release branch.

Show
Matthew Weier O'Phinney added a comment - Fixed in trunk and 1.9 release branch.
Hide
Luke Crouch added a comment -

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.

Show
Luke Crouch added a comment - 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.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: