setup-php 2.36.0 → 2.37.1

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.
Files changed (50) hide show
  1. package/README.md +15 -12
  2. package/lib/config.js +5 -2
  3. package/lib/config.js.map +1 -1
  4. package/lib/core.d.ts +8 -0
  5. package/lib/core.js +55 -0
  6. package/lib/core.js.map +1 -0
  7. package/lib/extensions.js +9 -8
  8. package/lib/extensions.js.map +1 -1
  9. package/lib/fetch.js +25 -70
  10. package/lib/fetch.js.map +1 -1
  11. package/lib/install.js +3 -3
  12. package/lib/install.js.map +1 -1
  13. package/lib/tools.d.ts +50 -21
  14. package/lib/tools.js +211 -150
  15. package/lib/tools.js.map +1 -1
  16. package/lib/utils.d.ts +3 -0
  17. package/lib/utils.js +62 -26
  18. package/lib/utils.js.map +1 -1
  19. package/package.json +20 -20
  20. package/src/config.ts +5 -2
  21. package/src/configs/brew_extensions +19 -0
  22. package/src/configs/composer-gh-auth-no-op +3 -0
  23. package/src/configs/composer-gh-auth-warn +1 -0
  24. package/src/configs/os_releases.csv +4 -1
  25. package/src/core.ts +112 -0
  26. package/src/extensions.ts +16 -15
  27. package/src/fetch.ts +28 -42
  28. package/src/install.ts +6 -3
  29. package/src/scripts/darwin.sh +12 -6
  30. package/src/scripts/extensions/couchbase.sh +13 -2
  31. package/src/scripts/extensions/firebird.sh +6 -23
  32. package/src/scripts/extensions/gearman.sh +1 -1
  33. package/src/scripts/extensions/http.ps1 +7 -5
  34. package/src/scripts/extensions/phalcon.ps1 +3 -21
  35. package/src/scripts/extensions/phalcon.sh +2 -0
  36. package/src/scripts/extensions/relay.sh +5 -2
  37. package/src/scripts/extensions/source.sh +3 -1
  38. package/src/scripts/extensions/sqlsrv.ps1 +2 -0
  39. package/src/scripts/extensions/sqlsrv.sh +2 -0
  40. package/src/scripts/linux.sh +49 -9
  41. package/src/scripts/tools/add_tools.ps1 +75 -27
  42. package/src/scripts/tools/add_tools.sh +67 -23
  43. package/src/scripts/tools/blackfire.sh +1 -1
  44. package/src/scripts/tools/brew.sh +130 -0
  45. package/src/scripts/tools/grpc_php_plugin.sh +2 -2
  46. package/src/scripts/tools/ppa.sh +5 -1
  47. package/src/scripts/unix.sh +7 -3
  48. package/src/scripts/win32.ps1 +17 -11
  49. package/src/tools.ts +349 -203
  50. package/src/utils.ts +81 -34
package/src/extensions.ts CHANGED
@@ -35,9 +35,9 @@ export async function addExtensionDarwin(
35
35
  // match 5.3blackfire...8.5blackfire
36
36
  // match 5.3blackfire-(semver)...8.5blackfire-(semver)
37
37
  // match couchbase, event, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
38
- // match 5.3ioncube...8.4ioncube
38
+ // match 5.3ioncube...8.5ioncube
39
39
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
40
- // match 7.0zephir_parser...8.4zephir_parser
40
+ // match 7.0zephir_parser...8.5zephir_parser
41
41
  case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
42
42
  version_extension
43
43
  ):
@@ -47,12 +47,12 @@ export async function addExtensionDarwin(
47
47
  case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
48
48
  extension
49
49
  ):
50
- case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
50
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])ioncube$/.test(version_extension):
51
51
  case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-4])phalcon5?/.test(
52
52
  version_extension
53
53
  ):
54
54
  case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
55
- case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
55
+ case /^(7\.[0-4]|8\.[0-5])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
56
56
  version_extension
57
57
  ):
58
58
  add_script += await utils.customPackage(
@@ -85,13 +85,14 @@ export async function addExtensionDarwin(
85
85
  add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
86
86
  return;
87
87
  // match brew extensions
88
- case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|vld|xdebug|xdebug2|yaml|zmq)/.test(
88
+ case /(?<!5\.[3-5])(amqp|apcu|brotli|excimer|expect|gmagick|gnupg|grpc|igbinary|imagick|imap|interbase|mailparse|maxminddb|mcrypt|memcache|memcached|mongodb|mongodb1|msgpack|newrelic|oauth|opentelemetry|pdo_firebird|pinba|protobuf|psr|raphf|rdkafka|redis|scalar_objects|seaslog|snmp|spx|ssh2|swoole|uopz|uploadprogress|uuid|vld|xdebug|xdebug2|xhprof|yaml|zmq|zstd)/.test(
89
89
  version_extension
90
90
  ):
91
91
  case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
92
92
  case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
93
93
  case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
94
94
  case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
95
+ case /^(8\.[0-5])swow$/.test(version_extension):
95
96
  add_script += await utils.joins(
96
97
  '\nadd_brew_extension',
97
98
  ext_name,
@@ -139,23 +140,23 @@ export async function addExtensionWindows(
139
140
  // match 5.3blackfire...8.5blackfire
140
141
  // match 5.3blackfire-(semver)...8.5blackfire-(semver)
141
142
  // match ibm_db2, pdo_ibm, pdo_oci and oci8
142
- // match 5.3ioncube...8.4ioncube
143
+ // match 5.3ioncube...8.5ioncube
143
144
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
144
- // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
145
- // match 7.0zephir_parser...8.4zephir_parser
145
+ // match 7.1pecl_http...8.5pecl_http and 7.1http...8.5http
146
+ // match 7.0zephir_parser...8.5zephir_parser
146
147
  case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])blackfire(-\d+\.\d+\.\d+)?$/.test(
147
148
  version_extension
148
149
  ):
149
150
  case /^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^pdo_firebird$/.test(
150
151
  extension
151
152
  ):
152
- case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
153
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])ioncube$/.test(version_extension):
153
154
  case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
154
155
  version_extension
155
156
  ):
156
- case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
157
+ case /^(7\.[1-4]|8\.[0-5])(pecl_)?http/.test(version_extension):
157
158
  case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
158
- case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
159
+ case /^(7\.[0-4]|8\.[0-5])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
159
160
  version_extension
160
161
  ):
161
162
  add_script += await utils.customPackage(
@@ -272,9 +273,9 @@ export async function addExtensionLinux(
272
273
  // match 5.3blackfire-(semver)...8.5blackfire-(semver)
273
274
  // match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
274
275
  // match couchbase, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
275
- // match 5.3ioncube...8.4ioncube
276
+ // match 5.3ioncube...8.5ioncube
276
277
  // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
277
- // match 7.0zephir_parser...8.4zephir_parser
278
+ // match 7.0zephir_parser...8.5zephir_parser
278
279
  case /^(7\.4|8\.[0-5])relay(-v?\d+\.\d+\.\d+|-nightly)?$/.test(
279
280
  version_extension
280
281
  ):
@@ -288,12 +289,12 @@ export async function addExtensionLinux(
288
289
  extension
289
290
  ):
290
291
  case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
291
- case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
292
+ case /^(5\.[3-6]|7\.[0-4]|8\.[0-5])ioncube$/.test(version_extension):
292
293
  case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
293
294
  version_extension
294
295
  ):
295
296
  case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
296
- case /^(7\.[0-4]|8\.[0-4])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
297
+ case /^(7\.[0-4]|8\.[0-5])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
297
298
  version_extension
298
299
  ):
299
300
  add_script += await utils.customPackage(
package/src/fetch.ts CHANGED
@@ -1,9 +1,10 @@
1
- import {IncomingMessage, OutgoingHttpHeaders} from 'http';
2
- import * as https from 'https';
3
- import * as url from 'url';
1
+ /**
2
+ * Redirect status codes set for O(1) lookup
3
+ */
4
+ const REDIRECT_CODES = new Set([301, 302, 303, 307, 308]);
4
5
 
5
6
  /**
6
- * Function to fetch a URL
7
+ * Function to fetch a URL using native fetch API (Node 24+)
7
8
  *
8
9
  * @param input_url
9
10
  * @param auth_token
@@ -14,43 +15,28 @@ export async function fetch(
14
15
  auth_token?: string,
15
16
  redirect_count = 5
16
17
  ): Promise<Record<string, string>> {
17
- const fetch_promise: Promise<Record<string, string>> = new Promise(
18
- resolve => {
19
- const url_object: url.UrlObject = new url.URL(input_url);
20
- const headers: OutgoingHttpHeaders = {
21
- 'User-Agent': `Mozilla/5.0 (${process.platform} ${process.arch}) setup-php`
22
- };
23
- if (auth_token) {
24
- headers.authorization = 'Bearer ' + auth_token;
25
- }
26
- const options: https.RequestOptions = {
27
- hostname: url_object.hostname,
28
- path: url_object.pathname,
29
- headers: headers,
30
- agent: new https.Agent({keepAlive: false})
31
- };
32
- const req = https.get(options, (res: IncomingMessage) => {
33
- if (res.statusCode === 200) {
34
- let body = '';
35
- res.setEncoding('utf8');
36
- res.on('data', chunk => (body += chunk));
37
- res.on('end', () => resolve({data: `${body}`}));
38
- } else if (
39
- [301, 302, 303, 307, 308].includes(res.statusCode as number)
40
- ) {
41
- if (redirect_count > 0 && res.headers.location) {
42
- fetch(res.headers.location, auth_token, redirect_count--).then(
43
- resolve
44
- );
45
- } else {
46
- resolve({error: `${res.statusCode}: Redirect error`});
47
- }
48
- } else {
49
- resolve({error: `${res.statusCode}: ${res.statusMessage}`});
50
- }
51
- });
52
- req.end();
18
+ const headers: Record<string, string> = {
19
+ 'User-Agent': `Mozilla/5.0 (${process.platform} ${process.arch}) setup-php`
20
+ };
21
+ if (auth_token) {
22
+ headers['Authorization'] = 'Bearer ' + auth_token;
23
+ }
24
+
25
+ try {
26
+ const response = await globalThis.fetch(input_url, {
27
+ headers,
28
+ redirect: redirect_count > 0 ? 'follow' : 'manual'
29
+ });
30
+
31
+ if (response.ok) {
32
+ const data = await response.text();
33
+ return {data};
34
+ } else if (REDIRECT_CODES.has(response.status) && redirect_count <= 0) {
35
+ return {error: `${response.status}: Redirect error`};
36
+ } else {
37
+ return {error: `${response.status}: ${response.statusText}`};
53
38
  }
54
- );
55
- return await fetch_promise;
39
+ } catch (error) {
40
+ return {error: `Fetch error: ${(error as Error).message}`};
41
+ }
56
42
  }
package/src/install.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
3
  import {exec} from '@actions/exec';
4
- import * as core from '@actions/core';
5
4
  import * as config from './config';
5
+ import * as core from './core';
6
6
  import * as coverage from './coverage';
7
7
  import * as extensions from './extensions';
8
8
  import * as tools from './tools';
@@ -18,7 +18,10 @@ export async function getScript(os: string): Promise<string> {
18
18
  const filename = os + (await utils.scriptExtension(os));
19
19
  const script_path = path.join(__dirname, '../src/scripts', filename);
20
20
  const run_path = script_path.replace(os, 'run');
21
- const extension_csv: string = await utils.getInput('extensions', false);
21
+ const extension_csv: string = utils.sanitizeShellInput(
22
+ await utils.getInput('extensions', false),
23
+ true
24
+ );
22
25
  const ini_values_csv: string = await utils.getInput('ini-values', false);
23
26
  const coverage_driver: string = await utils.getInput('coverage', false);
24
27
  const tools_csv: string = await utils.getInput('tools', false);
@@ -28,7 +31,7 @@ export async function getScript(os: string): Promise<string> {
28
31
  const ini_file: string = await utils.parseIniFile(
29
32
  await utils.getInput('ini-file', false)
30
33
  );
31
- let script = await utils.joins('.', script_path, version, ini_file);
34
+ let script = await utils.joins('.', script_path, `'${version}'`, ini_file);
32
35
  if (extension_csv) {
33
36
  script += await extensions.addExtension(extension_csv, version, os);
34
37
  }
@@ -15,7 +15,9 @@ handle_dependency_extensions() {
15
15
  brew_opts=(-sf)
16
16
  patch_abstract_file >/dev/null 2>&1
17
17
  for dependency_extension in "${dependency_extensions[@]}"; do
18
- brew install "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 && copy_brew_extensions "$dependency_extension"
18
+ safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 &&
19
+ brew link --overwrite --force "$dependency_extension@$version" >/dev/null 2>&1 &&
20
+ copy_brew_extensions "$dependency_extension"
19
21
  done
20
22
  fi
21
23
  }
@@ -83,7 +85,11 @@ add_brew_extension() {
83
85
  formula="$(get_renamed_formula "$formula")"
84
86
  update_dependencies >/dev/null 2>&1
85
87
  handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
86
- (brew install "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 && copy_brew_extensions "$formula") || pecl_install "$extension" >/dev/null 2>&1
88
+ (
89
+ safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 &&
90
+ brew link --overwrite --force "$formula@$version" >/dev/null 2>&1 &&
91
+ copy_brew_extensions "$formula"
92
+ ) || pecl_install "$extension" >/dev/null 2>&1
87
93
  add_extension_log "$extension" "Installed and enabled"
88
94
  fi
89
95
  }
@@ -181,14 +187,14 @@ add_php() {
181
187
  fi
182
188
  if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
183
189
  if [ "$action" = "upgrade" ]; then
184
- brew install --only-dependencies "$php_formula"
185
- brew upgrade -f --overwrite "$php_formula"
190
+ safe_brew install --only-dependencies "$php_formula"
191
+ safe_brew upgrade -f --overwrite "$php_formula"
186
192
  else
187
193
  brew unlink "$php_keg"
188
194
  fi
189
195
  else
190
- brew install --only-dependencies "$php_formula"
191
- brew install -f --overwrite "$php_formula" 2>/dev/null || brew upgrade -f --overwrite "$php_formula"
196
+ safe_brew install --only-dependencies "$php_formula"
197
+ safe_brew install --skip-link -f --overwrite "$php_formula" 2>/dev/null || safe_brew upgrade -f --overwrite "$php_formula"
192
198
  fi
193
199
  brew link --force --overwrite "$php_keg" || (sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix" && brew link --force --overwrite "$php_keg")
194
200
  }
@@ -79,9 +79,20 @@ add_couchbase() {
79
79
  add_extension_log "couchbase" "Installed and enabled"
80
80
  fi
81
81
  else
82
- if [ -e "${ext_dir:?}"/libcouchbase_php_core.dylib ]; then
83
- sudo cp "${ext_dir:?}"/libcouchbase_php_core.dylib "${brew_prefix:?}"/lib
82
+ if [ -e "${ext_dir:?}/couchbase.so" ]; then
83
+ couchbase_rpath="$(otool -l "${ext_dir:?}/couchbase.so" 2>/dev/null | awk '$1 == "path" && $2 ~ /\/couchbase@'"${version:?}"'\// {print $2; exit}')"
84
+ couchbase_rpath="${couchbase_rpath/@loader_path/${ext_dir:?}}"
85
+ otool -L "${ext_dir:?}/couchbase.so" 2>/dev/null |
86
+ awk -v rpath="$couchbase_rpath" '/libcouchbase_php.*\.dylib/ {if ($1 ~ /^@rpath\// && rpath != "") {sub(/^@rpath/, rpath, $1)}; print $1}' |
87
+ while read -r dylib; do
88
+ dylib="${dylib/@loader_path/${ext_dir:?}}"
89
+ [ -e "${ext_dir:?}/$(basename "$dylib")" ] || continue
90
+ sudo mkdir -p "$(dirname "$dylib")"
91
+ sudo cp "${ext_dir:?}/$(basename "$dylib")" "$dylib"
92
+ done
84
93
  fi
85
94
  add_brew_extension couchbase extension
95
+ find "${brew_prefix:?}/lib" "${brew_prefix:?}/opt/couchbase@${version:?}" "${brew_prefix:?}/Cellar/couchbase@${version:?}" \
96
+ -name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \; >/dev/null 2>&1
86
97
  fi
87
98
  }
@@ -1,17 +1,3 @@
1
- add_firebird_client_darwin() {
2
- firebird_tag='v5.0.0'
3
- arch_name='x64'
4
- arch="$(uname -m)"
5
- [[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && arch_name='arm64'
6
- pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
7
- [ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
8
- get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name"
9
- sudo installer -pkg /tmp/firebird.pkg -target /
10
- sudo mkdir -p /opt/firebird/include /opt/firebird/lib
11
- sudo cp -a /Library/Frameworks/Firebird.framework/Headers/* /opt/firebird/include/
12
- sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \;
13
- }
14
-
15
1
  add_firebird_helper() {
16
2
  firebird_dir=$1
17
3
  tag="$(php_src_tag)"
@@ -23,22 +9,19 @@ add_firebird_helper() {
23
9
  }
24
10
 
25
11
  add_firebird() {
26
- if [ "$(uname -s )" = "Darwin" ]; then
27
- add_firebird_client_darwin >/dev/null 2>&1
28
- fi
29
12
  enable_extension pdo_firebird extension
30
- status="Enabled"
31
- if ! check_extension pdo_firebird; then
32
- status="Installed and enabled"
13
+ if check_extension pdo_firebird; then
14
+ add_log "${tick:?}" pdo_firebird Enabled
15
+ else
33
16
  if [ "$(uname -s)" = "Linux" ]; then
34
- if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
17
+ if [[ "${version:?}" =~ 5.3|${php_builder_versions:?} ]]; then
35
18
  add_firebird_helper /usr >/dev/null 2>&1
36
19
  else
37
20
  add_pdo_extension firebird >/dev/null 2>&1
38
21
  fi
39
22
  else
40
- add_firebird_helper /opt/firebird >/dev/null 2>&1
23
+ add_brew_extension pdo_firebird extension >/dev/null 2>&1
41
24
  fi
25
+ add_extension_log pdo_firebird "Installed and enabled"
42
26
  fi
43
- add_extension_log pdo_firebird "$status"
44
27
  }
@@ -1,9 +1,9 @@
1
1
  # Helper function to add gearman extension.
2
2
  add_gearman_helper() {
3
- install_packages libgearman-dev
4
3
  enable_extension gearman extension
5
4
  if ! check_extension gearman; then
6
5
  status="Installed and enabled"
6
+ install_packages libgearman-dev
7
7
  if [[ "${version:?}" =~ 5.[3-6] ]]; then
8
8
  pecl_install gearman-1.1.2
9
9
  elif [[ "${version:?}" =~ 7.0 ]]; then
@@ -10,13 +10,15 @@ Function Get-ICUUrl() {
10
10
  [ValidateNotNull()]
11
11
  $vs_version
12
12
  )
13
- $trunk = "https://windows.php.net"
14
- $urls=@("${trunk}/downloads/php-sdk/deps/${vs_version}/${arch}", "${trunk}/downloads/php-sdk/deps/archives/${vs_version}/${arch}")
13
+ $trunk = "https://downloads.php.net"
14
+ $urls=@("${trunk}/~windows/php-sdk/deps/${vs_version}/${arch}/", "${trunk}/~windows/php-sdk/deps/archives/${vs_version}/${arch}/")
15
15
  foreach ($url in $urls) {
16
- $web_content = Get-File -Url $url
16
+ try {
17
+ $web_content = Get-File -Url $url 2>$null
18
+ } catch { continue }
17
19
  foreach ($link in $web_content.Links) {
18
- if ($link -match "/.*ICU-${icu_version}.*/") {
19
- return $trunk + $link.HREF
20
+ if ($link.href -match ".*ICU-${icu_version}.*") {
21
+ return $url + $link.HREF
20
22
  }
21
23
  }
22
24
  }
@@ -19,26 +19,6 @@ Function Get-PhalconReleaseAssetUrl() {
19
19
  $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon_${arch}_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)"
20
20
  } catch { }
21
21
  }
22
- } else {
23
- $nts = if (!$installed.ThreadSafe) { "-nts" } else { "-ts" }
24
- try {
25
- $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
26
- } catch { }
27
- if($null -eq $match) {
28
- try {
29
- $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(php_phalcon-php${version}${nts}-windows.*-x64.zip)"
30
- } catch { }
31
- }
32
- if($null -eq $match) {
33
- try {
34
- $match = (Invoke-RestMethod -Uri "$domain/$releases/tags/v$Semver").assets | Select-String -Pattern "browser_download_url=.*(phalcon-php${version}${nts}-windows.*-x64.zip)"
35
- } catch { }
36
- }
37
- if($null -eq $match) {
38
- try {
39
- $match = (Get-File -Url "$github/$releases/expanded_assets/v$Semver").Links.href | Select-String -Pattern "(phalcon-php${version}${nts}-windows.*-x64.zip)"
40
- } catch { }
41
- }
42
22
  }
43
23
  if($NULL -ne $match) {
44
24
  return "$github/$releases/download/v$Semver/$($match.Matches[0].Groups[1].Value)"
@@ -73,6 +53,8 @@ Function Get-PhalconSemver() {
73
53
  return '4.1.0'
74
54
  } elseif (($extension_version -eq '5') -and ($version -eq '7.4')) {
75
55
  return '5.4.0'
56
+ } elseif (($extension_version -eq '5') -and ($version -eq '8.0')) {
57
+ return '5.10.0'
76
58
  }
77
59
  return Get-PeclPackageVersion phalcon $extension_version stable stable | Select-Object -First 1
78
60
  }
@@ -80,7 +62,7 @@ Function Get-PhalconSemver() {
80
62
  # Function to install phalcon
81
63
  Function Add-PhalconHelper() {
82
64
  $semver = Get-PhalconSemver
83
- if ($extension_version -eq '3') {
65
+ if ($extension_version -match '[3-4]') {
84
66
  Add-PhalconFromGitHub $semver
85
67
  } else {
86
68
  Add-Extension -Extension phalcon -Stability stable -Extension_version $semver
@@ -3,6 +3,8 @@ get_phalcon_version() {
3
3
  if [ "$extension" = "phalcon5" ]; then
4
4
  if [ "${version:?}" = "7.4" ]; then
5
5
  echo '5.4.0'
6
+ elif [ "${version:?}" = "8.0" ]; then
7
+ echo '5.10.0'
6
8
  else
7
9
  get_pecl_version phalcon stable 5
8
10
  fi
@@ -36,7 +36,10 @@ get_openssl_suffix() {
36
36
  change_library_paths() {
37
37
  if [ "$os" = "Darwin" ]; then
38
38
  otool -L "${ext_dir:?}"/relay.so | grep -q 'ssl.1' && openssl_version='1.1' || openssl_version='3'
39
- [ -e "${brew_prefix:?}"/opt/openssl@"$openssl_version" ] || brew install openssl@"$openssl_version"
39
+ [ -e "${brew_prefix:?}"/opt/openssl@"$openssl_version" ] || {
40
+ safe_brew install --skip-link openssl@"$openssl_version" &&
41
+ brew link --overwrite --force openssl@"$openssl_version"
42
+ }
40
43
  dylibs="$(otool -L "${ext_dir:?}"/relay.so | grep -Eo '.*\.dylib' | cut -f1 -d ' ')"
41
44
  install_name_tool -change "$(echo "${dylibs}" | grep -E "libzstd.*dylib" | xargs)" "$brew_prefix"/opt/zstd/lib/libzstd.dylib "$ext_dir"/relay.so
42
45
  install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so
@@ -54,7 +57,7 @@ add_relay_dependencies() {
54
57
  if [ "$os" = "Darwin" ]; then
55
58
  . "${0%/*}"/tools/brew.sh
56
59
  configure_brew
57
- brew install lz4 hiredis zstd concurrencykit
60
+ safe_brew install lz4 hiredis zstd concurrencykit
58
61
  fi
59
62
  }
60
63
 
@@ -60,9 +60,11 @@ add_linux_libs() {
60
60
  add_darwin_libs() {
61
61
  local lib=$1
62
62
  if ! check_lib "$lib"; then
63
- brew install "$lib" >/dev/null 2>&1 || true
64
63
  if [[ "$lib" = *@* ]]; then
64
+ safe_brew install --skip-link "$lib" >/dev/null 2>&1 || true
65
65
  brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
66
+ else
67
+ safe_brew install "$lib" >/dev/null 2>&1 || true
66
68
  fi
67
69
  fi
68
70
  add_lib_log "$lib"
@@ -9,6 +9,8 @@ Function Get-SqlsrvReleaseVersion() {
9
9
  return '5.10.1'
10
10
  } elseif ($version -eq '8.0') {
11
11
  return '5.11.1'
12
+ } elseif ($version -match '8.[1-2]') {
13
+ return '5.12.0'
12
14
  } else {
13
15
  return 'latest'
14
16
  }
@@ -6,6 +6,8 @@ get_sqlsrv_version() {
6
6
  echo '5.10.1'
7
7
  elif [[ "${version:?}" =~ 8.0 ]]; then
8
8
  echo '5.11.1'
9
+ elif [[ "${version:?}" =~ 8.[1-2] ]]; then
10
+ echo '5.12.0'
9
11
  else
10
12
  # Return an empty string so that pecl will install the latest version.
11
13
  echo ''
@@ -127,6 +127,51 @@ setup_cached_versions() {
127
127
  run_script "php-ubuntu" "$version" "${debug:?}" "${ts:?}"
128
128
  }
129
129
 
130
+ # Function to get the link path for an alternative.
131
+ alternative_link() {
132
+ case "$1" in
133
+ php-cgi-bin) echo "/usr/lib/cgi-bin/php" ;;
134
+ php-fpm) echo "/usr/sbin/php-fpm" ;;
135
+ php-fpm.sock) echo "/run/php/php-fpm.sock" ;;
136
+ *) echo "/usr/bin/$1" ;;
137
+ esac
138
+ }
139
+
140
+ # Function to get the target path for an alternative.
141
+ alternative_target() {
142
+ case "$1" in
143
+ php-cgi-bin) echo "/usr/lib/cgi-bin/php$version" ;;
144
+ php-fpm) echo "/usr/sbin/php-fpm$version" ;;
145
+ php-fpm.sock) echo "/run/php/php$version-fpm.sock" ;;
146
+ *) echo "/usr/bin/$1$version" ;;
147
+ esac
148
+ }
149
+
150
+ # Function to register an alternative if the versioned binary exists but is missing.
151
+ register_alternative() {
152
+ local tool=$1
153
+ local link target priority state_file
154
+ target="$(alternative_target "$tool")"
155
+ [ -e "$target" ] || return 0
156
+ state_file="/var/lib/dpkg/alternatives/$tool"
157
+ if sudo test -r "$state_file" && sudo grep -Fxq "$target" "$state_file"; then
158
+ return 0
159
+ fi
160
+ link="$(alternative_link "$tool")"
161
+ priority="${version//./}"
162
+ sudo update-alternatives --install "$link" "$tool" "$target" "$priority" >/dev/null 2>&1
163
+ }
164
+
165
+ # Function to register and switch an alternative.
166
+ set_alternative() {
167
+ local tool=$1
168
+ local target
169
+ target="$(alternative_target "$tool")"
170
+ [ -e "$target" ] || return 0
171
+ register_alternative "$tool" || return 1
172
+ sudo update-alternatives --set "$tool" "$target" >/dev/null 2>&1
173
+ }
174
+
130
175
  # Function to add PECL.
131
176
  add_pecl() {
132
177
  add_devtools phpize >/dev/null 2>&1
@@ -143,16 +188,11 @@ switch_version() {
143
188
  tools=("$@")
144
189
  to_wait=()
145
190
  if ! (( ${#tools[@]} )); then
146
- tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
147
- [ -e /usr/lib/cgi-bin/php"$version" ] && sudo update-alternatives --set php-cgi-bin /usr/lib/cgi-bin/php"$version" & to_wait+=($!)
148
- [ -e /usr/sbin/php-fpm"$version" ] && sudo update-alternatives --set php-fpm /usr/sbin/php-fpm"$version" & to_wait+=($!)
149
- [ -e /run/php/php"$version"-fpm.sock ] && sudo update-alternatives --set php-fpm.sock /run/php/php"$version"-fpm.sock & to_wait+=($!)
191
+ tools+=(php-cgi-bin php-fpm php-fpm.sock pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
150
192
  fi
151
193
  for tool in "${tools[@]}"; do
152
- if [ -e "/usr/bin/$tool$version" ]; then
153
- sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" &
154
- to_wait+=($!)
155
- fi
194
+ set_alternative "$tool" &
195
+ to_wait+=($!)
156
196
  done
157
197
  wait "${to_wait[@]}"
158
198
  }
@@ -187,7 +227,7 @@ update_php() {
187
227
  # Function to install PHP.
188
228
  add_php() {
189
229
  if [ "${runner:?}" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
190
- if [[ "$version" =~ ${nightly_versions:?} || "$ts" = "zts" ]]; then
230
+ if [[ "$version" =~ ${php_builder_versions:?} || "$ts" = "zts" ]]; then
191
231
  setup_php_builder
192
232
  else
193
233
  add_packaged_php