From 4a33cd168795282718c7324c7c3741ea280810d4 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Sun, 7 Jan 2007 09:41:32 +0000 Subject: [PATCH] Exit gracefully with a warning if the table_prefix uses disallowed chars. fixes #3537 git-svn-id: https://develop.svn.wordpress.org/trunk@4695 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-settings.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-settings.php b/wp-settings.php index a22273905a..f86ae86e71 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -100,6 +100,9 @@ else // $table_prefix is deprecated as of 2.1 $wpdb->prefix = $table_prefix; +if ( preg_match('|[^a-z0-9_]|i', $wpdb->prefix) && !file_exists(ABSPATH . 'wp-content/db.php') ) + die(__('ERROR: $table_prefix in wp-config.php can only contain numbers, letters, and underscores.')); + // Table names $wpdb->posts = $wpdb->prefix . 'posts'; $wpdb->users = $wpdb->prefix . 'users';