I have a custom module which needs to fetch data from a webservice with Zend_Http_Client. For each remote entity there is a detail page, therefore I use wildcard loader arguments in this page's menu callback: 'transport/search/detail/%transport'. The wildcard loader function transport_load() however seems to be called before hook_init(), so the Zend autoloader is not initialized yet and instantiating a Zend_Http_Client in this function fails.

Moving the code from zend_init() to zend_boot() also doesn't seem to solve the issue, as I am using the zend module together with the libraries module and I'v put the Zend library in sites/all/libraries where it gets picked up then automatically. I guess the libraries module isn't initialized yet at the point that zend_boot() gets called.

Comments

jlk4p’s picture

Where actually does one place a Zend variable definition so that it doesn't generate an error in your module? I'm trying to create a global variable like this

$_media_sharedshelf_http_client = new Zend_Http_Client(MEDIA_SHAREDSHELF_API_URL, array('keepalive' => true));

and I get a PHP error about the Zend_Http_Client class not found. If I put it in the .module file I get an error. If I put it in an include file I get an error. Where should it actually be going?