Setup: Sanity check for invalid table prefixes.

There are some table prefixes (for example, `7e1_`), which MySQL will try and parse as values when they're note quoted in backticks. Because not everything remembers to quote their table names, it's best if we just discourage their use during setup.

Fixes #36422.


Built from https://develop.svn.wordpress.org/trunk@37581


git-svn-id: http://core.svn.wordpress.org/trunk@37549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2016-05-27 01:54:28 +00:00
parent 1244eaff8f
commit 58da002b34
2 changed files with 7 additions and 1 deletions

View File

@ -278,6 +278,12 @@ switch($step) {
if ( ! empty( $wpdb->error ) ) if ( ! empty( $wpdb->error ) )
wp_die( $wpdb->error->get_error_message() . $tryagain_link ); wp_die( $wpdb->error->get_error_message() . $tryagain_link );
$wpdb->query( "SELECT $prefix" );
if ( ! $wpdb->last_error ) {
// MySQL was able to parse the prefix as a value, which we don't want. Bail.
wp_die( __( '<strong>ERROR</strong>: "Table Prefix" is invalid.' ) );
}
// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password(). // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
try { try {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|'; $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37580'; $wp_version = '4.6-alpha-37581';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.