Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@
// Don't validate the TLS certificate. Useful for local environments.
$contents = file_get_contents( $runner_vars['WPT_PREPARE_DIR'] . '/wp-tests-config-sample.php' );

/*
* Give the generated config its own random salts instead of the sample's
* placeholder phrases. WordPress treats the placeholder as undefined and
* generates salts in the database on first use, so this is not a security
* fix. It makes the generated config follow its own instructions and saves
* the test install from priming salt options. Each placeholder gets a fresh
* value, and hex keeps the value safe inside the single quotes.
*/
$contents = preg_replace_callback(
"/'put your unique phrase here'/",
function () {
return "'" . bin2hex( random_bytes( 32 ) ) . "'";
},
$contents
);

/*
* Prepare a script for logging system information.
*
Expand Down
Loading