From cde68f9336187c29ef6d1694b66dd22073baf45e Mon Sep 17 00:00:00 2001 From: markjaquith 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: http://svn.automattic.com/wordpress/trunk@4695 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-settings.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-settings.php b/wp-settings.php index a22273905..f86ae86e7 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';