Hi folks
I've built a ZF app using 1.10 for deployment on RHEL server in a corporate client, which has PHP 5.1.6. It won't run.
I googled and now realise it's the version of PHP. I didn't realise ZF had a minimum requirement for PHP 5.2.4, and calls to HeadLink seem to be causing fatal error "Call to undefined method Zend_View_Helper_Placeholder_Container::ksort()":
PHP Fatal error: Call to undefined method Zend_View_Helper_Placeholder_Container::ksort() in /library/ Zend/View/Helper/HeadLink.php on line 321
The client won't upgrade their PHP; I don't want to rewrite the app without ZF, and I'd rather not downgrade ZF to a grossly earlier version.
Is there some patch I can use to add ksort() to ZF 1.10 to get around this? There may be other problems, but this is where I'm stuck right now.
Any advice welcome
Many thanks
Ian
EDIT: As I say in a comment below, I expect many people have hit this before and will keep on doing so as RHEL5 will be a standard in corporate environments for a good time to come. I was hoping for a link to an existing solution rather having to devise one from scratch.
UPDATE: I used the patch linked to in the accepted answer and it fixed the problem for me.
This is adding the following public method to Zend/View/Helper/Placeholder/Container/Abstract.php
/**
* Sort the array by key
*
* @return array
*/
public function ksort()
{
$items = $this->getArrayCopy();
return ksort($items);
}
There was one remaining issue; a PHP notice caused by a string conversion in Zend_View_Helper_Doctype. Comparing this function to similar ones above and below, this seems to be an error in the library
public function isHtml5() {
return (stristr($this->doctype(), '<!DOCTYPE html>') ? true : false);
}
Changed to:
public function isHtml5() {
return (stristr($this->getDoctype(), '<!DOCTYPE html>') ? true : false);
}
Patching the library itself was the last thing I would normally do, but in this case it got me out of a spot. We'll make sure the patch is versioned in the repo and documented obviously for future developers.