Composer Crashes Under Zend Server 8 PHP 5.6

Follow

Applies to:

Zend Server 8.0.2

PHP 5.6

Symptom

When running Composer on PHP 5.6, even on simple new project dependency installation, it crashes after starting up.

Technical

a Recent PHP garbage collection bug is affecting certain PHP environments, which also affects Composer which turns off garbage collection in its code.

Workaround

If you are affected by this bug, you should be able to pass Composer a PHP directive (zend.enable_gc=0) to disable Garbage Collection for the execution, by adding it to the wrapper script.

For example on Windows, a typical composer installer will drop the wrapper in "C:\ProgramData\ComposerSetup\bin\composer.bat".

This is how it would look like after adding the directive to the PHP command:

@ECHO OFF
php -d zend.enable_gc=0 "%~dp0composer.phar" %*

Same workaround can be applied on Linux and Mac using wrapper script, or if you're using PHP-CLI with custom ini, disable GC on the particular ini as ad-hoc solution.

Solution

a Patch has been added to PHP 5.5+5.6 branches, and has been released on update1 of Zend Server 8.0.2.

Patch Reference:

Prevent GC from changing zval or object 'color' before they are actually inserted into possible roots buffer.

Comments