1
0
Fork 0

Add workaround for php bug 64634 in copy

pull/1840/merge
Jordi Boggiano 2013-04-28 17:03:05 +02:00
parent 33af9eea95
commit 566313834a
2 changed files with 19 additions and 1 deletions

View File

@ -186,7 +186,15 @@ EOF;
}
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath));
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
// use stream_copy_to_stream instead of copy
// to work around https://bugs.php.net/bug.php?id=64634
$sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
$targetLoader = fopen($targetDir.'/ClassLoader.php', 'w+');
stream_copy_to_stream($sourceLoader, $targetLoader);
fclose($sourceLoader);
fclose($targetLoader);
unset($sourceLoader, $targetLoader);
$this->eventDispatcher->dispatch(ScriptEvents::POST_AUTOLOAD_DUMP);
}

View File

@ -177,6 +177,16 @@ class ConsoleIO implements IOInterface
// handle code running from a phar
if ('phar:' === substr(__FILE__, 0, 5)) {
$tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
// use stream_copy_to_stream instead of copy
// to work around https://bugs.php.net/bug.php?id=64634
$source = fopen(__DIR__.'\\hiddeninput.exe', 'r');
$target = fopen($tmpExe, 'w+');
stream_copy_to_stream($source, $target);
fclose($source);
fclose($target);
unset($source, $target);
copy($exe, $tmpExe);
$exe = $tmpExe;
}