Skip to content

Commit f5c6f40

Browse files
committed
Merge branch 'main' into try/os
2 parents 8ececcb + dd7c9f3 commit f5c6f40

File tree

8 files changed

+43
-16
lines changed

8 files changed

+43
-16
lines changed

.github/workflows/copilot-setup-steps.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file
24-
uses: andstor/file-existence-action@v3
24+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
2525
with:
2626
files: "composer.json"
2727

2828
- name: Set up PHP environment
2929
if: steps.check_composer_file.outputs.files_exists == 'true'
30-
uses: shivammathur/setup-php@v2
30+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
3131
with:
3232
php-version: 'latest'
3333
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Install Composer dependencies & cache dependencies
4040
if: steps.check_composer_file.outputs.files_exists == 'true'
41-
uses: ramsey/composer-install@v3
41+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3
4242
env:
4343
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
4444
with:

.github/workflows/issue-triage.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ name: Issue and PR Triage
1313
required: false
1414
type: string
1515

16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
actions: write
20+
contents: read
21+
models: read
22+
1623
jobs:
1724
issue-triage:
1825
uses: wp-cli/.github/.github/workflows/reusable-issue-triage.yml@main

.github/workflows/regenerate-readme.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- "features/**"
1111
- "README.md"
1212

13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
1317
jobs:
1418
regenerate-readme:
1519
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main

.github/workflows/welcome-new-contributors.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- main
88
- master
99

10+
permissions:
11+
pull-requests: write
12+
1013
jobs:
1114
welcome:
1215
uses: wp-cli/.github/.github/workflows/reusable-welcome-new-contributors.yml@main

.typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[default]
2+
extend-ignore-re = [
3+
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",
4+
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on",
5+
"(#|//)\\s*spellchecker:ignore-next-line\\n.*"
6+
]

features/steps.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ Feature: Make sure "Given", "When", "Then" steps work as expected
6868
Then STDOUT should match /\d\.\d/
6969
And STDERR should be empty
7070

71+
Scenario: Nested special variables
72+
Given an empty directory
73+
When I run `echo {INVOKE_WP_CLI_WITH_PHP_ARGS--dopen_basedir={RUN_DIR}} cli info`
74+
Then STDOUT should match /^WP_CLI_PHP_ARGS=-dopen_basedir=.* ?wp cli info/
75+
And STDERR should be empty
76+
77+
When I run `echo {INVOKE_WP_CLI_WITH_PHP_ARGS--dopen_basedir={RUN_DIR}} eval 'echo "{RUN_DIR}";'`
78+
Then STDOUT should match /^WP_CLI_PHP_ARGS=-dopen_basedir=(.*)(.*) ?wp eval echo "\1";/
79+
7180
@require-mysql-or-mariadb
7281
Scenario: SQL related variables
7382
When I run `echo {MYSQL_BINARY}`

phpcs.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!-- Strip the filepaths down to the relevant bit. -->
2323
<arg name="basepath" value="./"/>
2424

25-
<!-- Check up to 8 files simultanously. -->
25+
<!-- Check up to 8 files simultaneously. -->
2626
<arg name="parallel" value="8"/>
2727

2828
<!--

src/Context/FeatureContext.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -785,15 +785,13 @@ private static function terminate_proc( $master_pid ): void {
785785

786786
$output = shell_exec( "ps -o ppid,pid,command | grep $master_pid" );
787787

788-
if ( is_string( $output ) ) {
789-
foreach ( explode( PHP_EOL, $output ) as $line ) {
790-
if ( preg_match( '/^\s*(\d+)\s+(\d+)/', $line, $matches ) ) {
791-
$parent = $matches[1];
792-
$child = $matches[2];
793-
794-
if ( (int) $parent === (int) $master_pid ) {
795-
self::terminate_proc( (int) $child );
796-
}
788+
foreach ( explode( PHP_EOL, $output ? $output : '' ) as $line ) {
789+
if ( preg_match( '/^\s*(\d+)\s+(\d+)/', $line, $matches ) ) {
790+
$parent = $matches[1];
791+
$child = $matches[2];
792+
793+
if ( (int) $parent === (int) $master_pid ) {
794+
self::terminate_proc( (int) $child );
797795
}
798796
}
799797
}
@@ -968,10 +966,10 @@ protected static function bootstrap_feature_context(): void {
968966
* @return string
969967
*/
970968
public function replace_variables( $str ) {
969+
$str = preg_replace_callback( '/\{([A-Z_][A-Z_0-9]*)\}/', [ $this, 'replace_var' ], $str );
971970
if ( false !== strpos( $str, '{INVOKE_WP_CLI_WITH_PHP_ARGS-' ) ) {
972971
$str = $this->replace_invoke_wp_cli_with_php_args( $str );
973972
}
974-
$str = preg_replace_callback( '/\{([A-Z_][A-Z_0-9]*)\}/', [ $this, 'replace_var' ], $str );
975973
if ( false !== strpos( $str, '{WP_VERSION-' ) ) {
976974
$str = $this->replace_wp_versions( $str );
977975
}
@@ -1010,7 +1008,7 @@ private function replace_invoke_wp_cli_with_php_args( $str ) {
10101008
}
10111009

10121010
$str = preg_replace_callback(
1013-
'/{INVOKE_WP_CLI_WITH_PHP_ARGS-([^}]*)}/',
1011+
'/{INVOKE_WP_CLI_WITH_PHP_ARGS-(.*)}/',
10141012
static function ( $matches ) use ( $phar_path, $shell_path ) {
10151013
return $phar_path ? "php {$matches[1]} {$phar_path}" : ( 'WP_CLI_PHP_ARGS=' . escapeshellarg( $matches[1] ) . ' ' . $shell_path );
10161014
},

0 commit comments

Comments
 (0)