Skip to content

Commit efbbcc4

Browse files
authored
Merge pull request #198 from wp-cli/fix/undefined-index-for-db-socket
2 parents c921f04 + c28bf48 commit efbbcc4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Context/FeatureContext.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,17 @@ function ( $matches ) use ( $phar_path, $shell_path ) {
700700
* Replace variables callback.
701701
*/
702702
private function replace_var( $matches ) {
703-
$cmd = $matches[0];
703+
$str = $matches[0];
704704

705705
foreach ( array_slice( $matches, 1 ) as $key ) {
706-
$cmd = str_replace( '{' . $key . '}', $this->variables[ $key ], $cmd );
706+
$str = str_replace(
707+
'{' . $key . '}',
708+
array_key_exists( $key, $this->variables ) ? $this->variables[ $key ] : '',
709+
$str
710+
);
707711
}
708712

709-
return $cmd;
713+
return $str;
710714
}
711715

712716
/**

0 commit comments

Comments
 (0)