I am integrating third party code into the web application I am writing in Zend Framework.
The code I want to integrate declares variables as global. It works on its own, but not when I include it within Zend Framework. Initially I suspected that there is something in Zend Framework that is disabling the declaration of global variables. I have the following test code in a controller:
public function testglobalAction()
{
$a = 1;
function b()
{
global $a;
echo $a*2;
}
b();
}
When I ran it prints out 0, as opposed to 2. On top of that running the same code on its own in the same web server prints out 2.
I understand that I could replace all the global instances to use Zend Registry. However, a grep showed me that there are roughly 700 lines I have to change, so it is not feasible at the moment.
Does anyone know how I can solve this problem?