1
0
Fork 0

Merge branch '2.5'

pull/11459/head
Jordi Boggiano 2023-05-08 14:50:48 +02:00
commit 54808d9bde
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 5 additions and 5 deletions

View File

@ -339,7 +339,8 @@ class Application extends BaseApplication
// Check system temp folder for usability as it can cause weird runtime issues otherwise
Silencer::call(static function () use ($io): void {
$tempfile = sys_get_temp_dir() . '/temp-' . getmypid() . '-' . md5(microtime());
$pid = function_exists('getmypid') ? getmypid() . '-' : '';
$tempfile = sys_get_temp_dir() . '/temp-' . $pid . md5(microtime());
if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
$io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
}

View File

@ -337,8 +337,7 @@ if (PHP_VERSION_ID < 80000) {
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
include("phpvfscomposer://" . $binPathExported);
exit(0);
return include("phpvfscomposer://" . $binPathExported);
}
}
@ -360,7 +359,7 @@ namespace Composer;
$globalsCode
$streamProxyCode
include $binPathExported;
return include $binPathExported;
PROXY;
}

View File

@ -264,7 +264,7 @@ class PluginManager
if ($separatorPos) {
$className = substr($class, $separatorPos + 1);
}
$code = Preg::replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
$code = Preg::replace('{^((?:(?:final|readonly)\s+)*(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
$code = strtr($code, [
'__FILE__' => var_export($path, true),
'__DIR__' => var_export(dirname($path), true),