Page 1 of 1
zend.ze1_compatibility_mode Implicit cloning object??
Posted: Thu Feb 26, 2009 3:51 am
by Chris Corbyn
Strict Standards: Implicit cloning object of class 'Swift_DependencyContainer' because of 'zend.ze1_compatibility_mode' in /path/to/web/webroot/swift/lib/classes/Swift/DependencyContainer.php on line 66
Somebody has posted me a bug. The error they're getting is this.
Should I be concerned? The PHP install is the "hardened" PHP project with the Suhosin patch.
What on earth is zend.ze1_compatibility_mode and why is it choosing to make copies for all of the object references? It sounds like it's some "mode" to make PHP5 behave more like PHP4 but I don't know.
Here's the line it's fatal dying on in this case. It emits the same error for any other line that instantiates an object.
Code: Select all
/**
* Returns a singleton of the DependencyContainer.
* @return Swift_DependencyContainer
*/
public static function getInstance()
{
if (!isset(self::$_instance))
{
self::$_instance = new self(); // <--- THIS LINE
}
return self::$_instance;
}
Re: zend.ze1_compatibility_mode Implicit cloning object??
Posted: Thu Feb 26, 2009 4:01 am
by Chris Corbyn
From Zend Developer Zone:
zend.ze1_compatibility_mode boolean
Enable compatibility mode with Zend Engine 1 (PHP 4). It affects the cloning, casting (objects with no properties cast to FALSE or 0), and comparing of objects. In this mode, objects are passed by value instead of reference by default.
Ugh. PHP, you suck.
I can't possibly run a PHP5 project and offer support to anybody who decides to run with this mode on. So I won't

Re: zend.ze1_compatibility_mode Implicit cloning object??
Posted: Thu Feb 26, 2009 4:55 am
by wodka
Yeah, I just told the hosting provider, that this setting is illogical.
They have separate PHP4, PHP4-suhosin, PHP5, PHP5-suhosin packages, so...
Yeah, this is when saying PHP, you suck is absolutely right!
Re: zend.ze1_compatibility_mode Implicit cloning object??
Posted: Thu Feb 26, 2009 5:41 am
by Chris Corbyn
I can't believe Zend keep choosing to add these crazy php.ini settings. They cause all kinds of problems. They need to make sure every PHP installation exhibits the same behaviour.
I'm still not clear if this is specific to the Hardened PHP Project or to all of PHP.