php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61482 php-cli crashes during 'nmake snap'
Submitted: 2012-03-22 22:33 UTC Modified: 2012-03-23 06:10 UTC
From: mattficken@php.net Assigned: stas (profile)
Status: Closed Package: PHAR related
PHP Version: 5.4.0 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mattficken@php.net
New email:
PHP Version: OS:

 

 [2012-03-22 22:33 UTC] mattficken@php.net
Description:
------------
Compiling latest revision from git repo...

Using Windows 7sp1x64, VC9 compiler x86 xp release

Ran nmake snap...

When it gets to 'creating phar.phar.bat' stage php cli crashes.

Here is the backtrace:

php5.dll!zval_mark_grey(_zval_struct * pz=0x010f0060)  Line 425	C
php5.dll!gc_mark_roots()  Line 501 + 0x6 bytes	C
php5.dll!gc_collect_cycles()  Line 794	C
php5.dll!zend_deactivate()  Line 962	C
php5.dll!php_request_shutdown(void * dummy=0x00000000)  Line 1784	C
php.exe!do_cli(int argc=13, char * * argv=0x00151b10)  Line 1169 + 0x8 bytes	C
php.exe!main(int argc=13, char * * argv=0x00151b10)  Line 1358	C
php.exe!__tmainCRTStartup()  Line 586 + 0x17 bytes	C
kernel32.dll!7616339a() 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-22 22:56 UTC] mattficken@php.net
Test Script (stripped down win32/build/mkdist.php):
<?php 

// FYI: nmake snap runs mkdist.php with these args
//
// c:\php-sdk\git\php-src>C:\php-sdk\git\obj\Release\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php "C:\php-sdk\git\obj\Release" "C:\php-sdk\git\php-src\no" "php5.dll" "php-cgi.exe php.exe php-win.exe php5embed.lib" "php_mbstring.dll php_shmop.dll php_sockets.dll php_sqlite3.dll php_exif.dll php_pdo_mysql.dll php_pdo_odbc.dll php_pdo_sqlite.dll " " " "no"

// php build directory
$build_dir = "C:\php-sdk\git\obj\Release";

$dist_dir = $build_dir . "/php-" . phpversion();
$test_dir = $build_dir . "/php-test-pack-" . phpversion();
$pecl_dir = $build_dir . "/pecl-" . phpversion();

@mkdir($dist_dir);
@mkdir("$dist_dir/ext");
@mkdir("$dist_dir/dev");
@mkdir("$dist_dir/extras");
@mkdir($pecl_dir);


function make_phar_dot_phar($dist_dir)
{
	if (!extension_loaded('phar')) {
		return;
	}

	$path_to_phar = realpath(__DIR__ . '/../../ext/phar');

	echo "Generating pharcommand.phar\n";
	$phar = new Phar($dist_dir . '/pharcommand.phar', 0, 'pharcommand');

	foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
		if ($file->isDir() || $file == 'phar.php') {
			continue;
		}

		echo 'adding ', $file, "\n";
		$phar[(string) $file] = file_get_contents($path_to_phar.  '/phar/' . $file);
	}

	$phar->setSignatureAlgorithm(Phar::SHA1);
	$stub = file($path_to_phar . '/phar/phar.php');

	unset($stub[0]); // remove hashbang
	$phar->setStub(implode('', $stub));

	echo "Creating phar.phar.bat\n";
	file_put_contents($dist_dir . '/phar.phar.bat', "%~dp0php.exe %~dp0pharcommand.phar %*\r\n");
}


make_phar_dot_phar($dist_dir);
?>
 [2012-03-22 23:03 UTC] mattficken@php.net
looks like it fails on the first call to file_get_contents() in make_phar_dot_phar().

the first and only arg to file_get_contents() is "c:\php-sdk\git\php-src\ext\phar\phar\clicommand.inc".
 [2012-03-23 00:47 UTC] stas@php.net
Happens to me with 5.4 branch too. If I remove make_phar_dot_phar(), it does not 
happen, so definitely has something to do with phar.
 [2012-03-23 05:23 UTC] stas@php.net
This commandline reliably reproduces it:


Release\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php 
Release C:\Projects\win32build php5.dll php-cgi.exe php.exe php_intl.dll 
php_pdo_mysql.dll    no
 [2012-03-23 05:24 UTC] mattficken@php.net
With proper quotes:


Release\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php 
"Release" "C:\Projects\win32build" "php5.dll" "php-cgi.exe php.exe" "php_intl.dll 
php_pdo_mysql.dll " " " "no"
 [2012-03-23 05:24 UTC] stas@php.net
git bisect says commit 714f1ff4b37c5101b3c61ea108a3d415f41e50df is to blame. 
Reverting it seems to fix the issue.
 [2012-03-23 05:31 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 [2012-03-23 05:31 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 [2012-03-23 05:32 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 [2012-03-23 06:10 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2012-03-23 06:10 UTC] stas@php.net
This bug has been fixed in SVN.

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.

Should be fine now.
 [2012-03-23 11:35 UTC] cataphract@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3960def881c5e29daa18c914cf95e1e978db053b
Log: Fixed bug #61482, caused by the fix to bug #61418.
 [2012-03-23 11:35 UTC] cataphract@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85725337d5aa7d6cbe69be8c4ce83656f0aca885
Log: Revert &quot;Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482&quot;
 [2012-03-29 04:23 UTC] cataphract@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3960def881c5e29daa18c914cf95e1e978db053b
Log: Fixed bug #61482, caused by the fix to bug #61418.
 [2012-03-29 04:23 UTC] cataphract@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85725337d5aa7d6cbe69be8c4ce83656f0aca885
Log: Revert &quot;Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482&quot;
 [2012-03-29 04:24 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3960def881c5e29daa18c914cf95e1e978db053b
Log: Fixed bug #61482, caused by the fix to bug #61418.
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=85725337d5aa7d6cbe69be8c4ce83656f0aca885
Log: Revert &quot;Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482&quot;
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 [2014-10-07 23:39 UTC] stas@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3960def881c5e29daa18c914cf95e1e978db053b
Log: Fixed bug #61482, caused by the fix to bug #61418.
 [2014-10-07 23:39 UTC] stas@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=85725337d5aa7d6cbe69be8c4ce83656f0aca885
Log: Revert &quot;Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482&quot;
 [2014-10-07 23:39 UTC] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=a89c4a34ee55686ab1430a5060e1460335fc5203
Log: Revert &quot;- Fixed bug #61418 (Segmentation fault when DirectoryIterator's or&quot; - causes bug #61482
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC