setup-php 2.31.0 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ param (
3
3
  [ValidateNotNull()]
4
4
  [ValidateLength(1, [int]::MaxValue)]
5
5
  [string]
6
- $version = '8.2',
6
+ $version = '8.4',
7
7
  [Parameter(Position = 1, Mandatory = $true)]
8
8
  [ValidateNotNull()]
9
9
  [ValidateLength(1, [int]::MaxValue)]
@@ -401,6 +401,15 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
401
401
  }
402
402
  $status = "Installed"
403
403
  $extra_version = ""
404
+ if($version -eq 'pre') {
405
+ if($null -ne $installed) {
406
+ $version = $installed.MajorMinorVersion
407
+ $env:update = 'false'
408
+ } else {
409
+ Add-Log $cross "PHP" "No pre-installed PHP version found"
410
+ Write-Error "No pre-installed PHP version found" -ErrorAction Stop
411
+ }
412
+ }
404
413
  if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
405
414
  if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
406
415
  Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
@@ -434,7 +443,7 @@ if($installed.MajorMinorVersion -ne $version) {
434
443
  Write-Error "Could not setup PHP $version" -ErrorAction Stop
435
444
  }
436
445
  if($version -lt "5.5") {
437
- ('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
446
+ ('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
438
447
  } else {
439
448
  $enable_extensions += ('opcache')
440
449
  }
package/src/utils.ts CHANGED
@@ -436,12 +436,17 @@ export async function readPHPVersion(): Promise<string> {
436
436
  const versionFile =
437
437
  (await getInput('php-version-file', false)) || '.php-version';
438
438
  if (fs.existsSync(versionFile)) {
439
- return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
439
+ const contents: string = fs.readFileSync(versionFile, 'utf8');
440
+ const match: RegExpMatchArray | null = contents.match(
441
+ /^(?:php\s)?(\d+\.\d+\.\d+)$/m
442
+ );
443
+ return match ? match[1] : contents.trim();
440
444
  } else if (versionFile !== '.php-version') {
441
445
  throw new Error(`Could not find '${versionFile}' file.`);
442
446
  }
443
447
 
444
- const composerLock = 'composer.lock';
448
+ const composerProjectDir = await readEnv('COMPOSER_PROJECT_DIR');
449
+ const composerLock = path.join(composerProjectDir, 'composer.lock');
445
450
  if (fs.existsSync(composerLock)) {
446
451
  const lockFileContents = JSON.parse(fs.readFileSync(composerLock, 'utf8'));
447
452
  if (
@@ -452,7 +457,7 @@ export async function readPHPVersion(): Promise<string> {
452
457
  }
453
458
  }
454
459
 
455
- const composerJson = 'composer.json';
460
+ const composerJson = path.join(composerProjectDir, 'composer.json');
456
461
  if (fs.existsSync(composerJson)) {
457
462
  const composerFileContents = JSON.parse(
458
463
  fs.readFileSync(composerJson, 'utf8')