php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66660 Composer.phar install/update fails
Submitted: 2014-02-07 15:40 UTC Modified: 2014-04-13 08:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: shabazzk at gmail dot com Assigned: tyrael
Status: Closed Package: Reproducible crash
PHP Version: 5.6.0-dev OS:
Private report: No CVE-ID:
 [2014-02-07 15:40 UTC] shabazzk at gmail dot com
Description:
------------
When I try to run "composer install" or "composer update" on a composer project that needs to generate an autoloader; it gets to the point where it needs to generate the autoloader, but the the php CLI crashes. I have not tried this on any system other than windows 7.

Expected result:
----------------
Composer should generate the autoloader, and the php CLI should not crash.

Actual result:
--------------
coming soon...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-07 19:01 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-02-07 19:01 UTC] requinix@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Either ^ that, or file this as a bug with the composer folks instead.
 [2014-02-26 15:59 UTC] e6nian at gmail dot com
I have the same problem ,composer won't work with --optimize
± |master ✗| →  composer dump-autoload --optimize -vvv --ansi --profile
[3.2MB/0.01s] Reading ./composer.json
[3.6MB/0.02s] Executing command (CWD): git describe --exact-match --tags
[3.8MB/0.03s] Executing command (CWD): git branch --no-color --no-abbrev -v
Generating optimized autoload files
Segmentation fault: 11

± |master ✗| → php --version
PHP 5.6.0alpha2 (cli) (built: Feb 23 2014 22:49:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0-dev, Copyright (c) 1998-2014 Zend Technologies

OS Darwin local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
 [2014-03-05 11:58 UTC] shabazzk at gmail dot com
-Status: Feedback +Status: Open -PHP Version: 5.6.0alpha1 +PHP Version: 5.6.0alpha3
 [2014-03-05 11:58 UTC] shabazzk at gmail dot com
PHP crashes when composer.phar tries to generate an auto-load file for me. There may be other times when it crashes. I tried to get a back-trace. But the instructions on how to do that are quite dated. I'm using VS2012, so I did the best I could. I assume since PHP crashes, then it is a bug with PHP, and since composer works fine with 5.5.3.

-- stack call
>	php5.dll!_efree(void * ptr) Line 2440	C
 	php5.dll!zend_strip() Line 214	C
 	php5.dll!zif_php_strip_whitespace(int ht, _zval_struct * return_value, _zval_struct * * return_value_ptr, _zval_struct * this_ptr, int return_value_used) Line 5240	C
 	php5.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data * execute_data) Line 558	C
 	php5.dll!execute_ex(_zend_execute_data * execute_data) Line 363	C
 	php5.dll!zend_execute(_zend_op_array * op_array) Line 388	C
 	php5.dll!zend_execute_scripts(int type, _zval_struct * * retval, int file_count, ...) Line 1330	C
 	php5.dll!php_execute_script(_zend_file_handle * primary_file) Line 2584	C
 [2014-03-05 12:09 UTC] shabazzk at gmail dot com
This may help it bit more:

>	php5.dll!_efree(void * ptr) Line 2440	C
 	php5.dll!zend_strip() Line 214	C
 	php5.dll!zif_php_strip_whitespace(int ht, _zval_struct * return_value, _zval_struct * * return_value_ptr, _zval_struct * this_ptr, int return_value_used) Line 5240	C
 	php5.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data * execute_data) Line 558	C
 	php5.dll!execute_ex(_zend_execute_data * execute_data) Line 363	C
 	php5.dll!zend_execute(_zend_op_array * op_array) Line 388	C
 	php5.dll!zend_execute_scripts(int type, _zval_struct * * retval, int file_count, ...) Line 1330	C
 	php5.dll!php_execute_script(_zend_file_handle * primary_file) Line 2584	C

5615CE5C 00 02                add         byte ptr [edx],al  
  2437: 		AG(mm_heap)->_free(ptr);
  2438: 		return;
  2439: 	}
  2440: 	_zend_mm_free_int(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
5615CE5E 00 73 25             add         byte ptr [ebx+25h],dh  
5615CE61 8B C2                mov         eax,edx  
5615CE63 C1 E8 03             shr         eax,3  
5615CE66 8D 0C 86             lea         ecx,[esi+eax*4]  
5615CE69 8B 41 48             mov         eax,dword ptr [ecx+48h]  
5615CE6C 89 47 08             mov         dword ptr [edi+8],eax  
5615CE6F 89 79 48             mov         dword ptr [ecx+48h],edi  
5615CE72 01 56 4C             add         dword ptr [esi+4Ch],edx  
5615CE75 A1 E4 52 68 56       mov         eax,dword ptr ds:[566852E4h]  
5615CE7A 85 C0                test        eax,eax  
5615CE7C 0F 85 4D 04 00 00    jne         _efree+4AFh (5615D2CFh)  
5615CE82 5F                   pop         edi  
5615CE83 5E                   pop         esi  
  2441: }
5615CE84 59                   pop         ecx  
5615CE85 C3                   ret  
  2437: 		AG(mm_heap)->_free(ptr);
  2438: 		return;
  2439: 	}
  2440: 	_zend_mm_free_int(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
5615CE86 29 56 34             sub         dword ptr [esi+34h],edx  
5615CE89 8B 04 3A             mov         eax,dword ptr [edx+edi]  
5615CE8C 53                   push        ebx  
5615CE8D 8D 1C 3A             lea         ebx,[edx+edi]  
5615CE90 55                   push        ebp  
5615CE91 A8 01                test        al,1  
5615CE93 75 6D                jne         _efree+0E2h (5615CF02h)  
5615CE95 8B 4B 08             mov         ecx,dword ptr [ebx+8]  
5615CE98 8B 6B 0C             mov         ebp,dword ptr [ebx+0Ch]  
5615CE9B 3B CB                cmp         ecx,ebx  
5615CE9D 0F 85 A9 01 00 00    jne         _efree+22Ch (5615D04Ch)  
5615CEA3 3B EB                cmp         ebp,ebx  
5615CEA5 0F 85 2B 04 00 00    jne         _efree+4B6h (5615D2D6h)  
5615CEAB 83 7B 18 00          cmp         dword ptr [ebx+18h],0  
5615CEAF 0F 85 83 03 00 00    jne         _efree+418h (5615D238h)  
  2437: 		AG(mm_heap)->_free(ptr);
  2438: 		return;
  2439: 	}
  2440: 	_zend_mm_free_int(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
 [2014-03-17 04:22 UTC] shabazzk at gmail dot com
-PHP Version: 5.6.0alpha3 +PHP Version: 5.6.0-dev
 [2014-03-17 04:22 UTC] shabazzk at gmail dot com
It is working for me now. I went back and built PHP on Windows 7 with the latest version of PHP from the git repo: git clone -b PHP-5.6 https://github.com/php/php-src

I used these instructions to build on Winodws: http://www.kshabazz.net/build-php-on-windows.html
 [2014-04-13 01:16 UTC] tyrael@php.net
-Status: Open +Status: Feedback
 [2014-04-13 01:16 UTC] tyrael@php.net
could you verify that it is working fine with beta1?
it it does then I will close this issue.
 [2014-04-13 01:32 UTC] tyrael@php.net
based on https://bugs.php.net/bug.php?id=66751 this seems to be unrelated to windows, so I will try reproducing myself(the tests script from that report didn't crash for me).
 [2014-04-13 01:58 UTC] tyrael@php.net
there were a bugreport at the composer guys also:
https://github.com/composer/composer/issues/2774
I can't reproduce that too on my mac, will try with Ubuntu 13.10 as in that bugreport.
 [2014-04-13 01:59 UTC] tyrael@php.net
-Operating System: Windows 7 Enterprise +Operating System:
 [2014-04-13 02:10 UTC] tyrael@php.net
ops, I forgot to remove --enable-maintainer-zts from my configure line, without that I'm able to reproduce the crash even with the simple oneliner from the other report:

# cat test.php
<?php __CLASS__ ?>

# php -r 'php_strip_whitespace(getcwd()."/test.php");'
 [2014-04-13 02:32 UTC] tyrael@php.net
nope, I was too hasty (time to get some sleep), the reproduction script doesn't but reports this in debug mode:
/Users/tyrael/checkouts/php-src.git/Zend/zend_highlight.c(214) : Block 0x10a615048 status:
Invalid pointer: ((size=0x0002b5a5) != (next.prev=0x00000001))
Invalid pointer: ((prev=0x00000001) != (prev.size=0x0002b5a5))

I guess this is what krakjoe also meant when saying he couldn't make it to segfault.
 [2014-04-13 02:49 UTC] tyrael@php.net
-Assigned To: +Assigned To: tyrael
 [2014-04-13 02:49 UTC] tyrael@php.net
replacing efree with STR_FREE seems to resolve the issue, so my hunch is that it is related to the new "empty strings are now interned" feature mentioned in UPGRADING.INTERNALS.
 [2014-04-13 08:18 UTC] krakjoe@php.net
yes, str_efree is correct solution ... do that ...
 [2014-04-13 08:43 UTC] tyrael@php.net
Automatic comment on behalf of tyrael
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20036525e2b5ee7613a6d3ead0270631b23f6a15
Log: Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly
 [2014-04-13 08:43 UTC] tyrael@php.net
-Status: Feedback +Status: Closed
 [2014-04-13 08:46 UTC] tyrael@php.net
Automatic comment on behalf of tyrael
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20036525e2b5ee7613a6d3ead0270631b23f6a15
Log: Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly
 [2014-04-13 08:48 UTC] tyrael@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-04-15 12:04 UTC] ab@php.net
Automatic comment on behalf of tyrael
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20036525e2b5ee7613a6d3ead0270631b23f6a15
Log: Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly
 [2014-04-15 13:05 UTC] ab@php.net
Automatic comment on behalf of tyrael
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20036525e2b5ee7613a6d3ead0270631b23f6a15
Log: Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly
 [2014-05-01 14:59 UTC] tyrael@php.net
Automatic comment on behalf of tyrael
Revision: http://git.php.net/?p=php-src.git;a=commit;h=20036525e2b5ee7613a6d3ead0270631b23f6a15
Log: Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Wed Apr 26 23:01:37 2017 UTC