Skip to content

Commit f2280c8

Browse files
Merge pull request #3889 from wp-cli/sub-sub-directories
Transform sub/sub directories into a proper dbprefix
2 parents 68f685a + d9f1aad commit f2280c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ public function download_wp( $subdir = '' ) {
318318

319319
public function create_config( $subdir = '' ) {
320320
$params = self::$db_settings;
321-
$params['dbprefix'] = $subdir ?: 'wp_';
321+
// Replaces all characters that are not alphanumeric or an underscore into an underscore.
322+
$params['dbprefix'] = $subdir ? preg_replace( '#[^a-zA-Z\_0-9]#', '_', $subdir ) : 'wp_';
322323

323324
$params['skip-salts'] = true;
324325
$this->proc( 'wp core config', $params, $subdir )->run_check();

0 commit comments

Comments
 (0)