WPINC constant not used in installation script
|Reported by:||tomgrenville||Owned by:|
Hi, this is the first time I've submitted a bug here. Feels nice to be giving something back to the WP community!
The issue occurred when I was setting up a new WP install. Everything except the directory "/wp-includes/" and the two files "/wp-config.php" and "/wp-settings.php" were untouched.
First I worked my way through "/wp-config.php" and then uploaded the entire site. Next I changed the default includes directory in "/wp-settings.php" on line 18 from "wp-includes" to "wpress-includes". I updated the "/wp-includes/" directory to reflect its new name of "wpress-includes" locally. I then saved the file, uploaded it and made the same directory name change on the remote server.
Next I visited "http://mydomain.com/wp-admin/install.php" in my browser expecting to see the regular installation page. Instead I got a 500 error which by its nature told me nothing. I temporarily enabled PHP errors and saw these errors when I reloaded the page:
Warning: require_once(/mypathhere/wp-includes/wp-db.php) [function.require-once]: failed to open stream: No such file or directory in /mypathhere/wp-admin/install.php on line 42 Fatal error: require_once() [function.require]: Failed opening required '/mypathhere/wp-includes/wp-db.php' (include_path='.:/usr/local/php5_3/lib/php') in /mypathhere/wp-admin/install.php on line 42
So I opened the file "/wp-admin/install.php" and went to line 42. There I saw this code:
require_once(dirname(dirname(__FILE__)) . '/wp-includes/wp-db.php');
Which looks like it's trying to include the "wp-includes/wp-db.php" file using the default "/wp-includes/" directory name. Of course this didn't work for me as I had changed the name of that directory!
I then amended the "/wp-admin/install.php" file on line 42 from looking like it does above, to this:
require_once(dirname(dirname(__FILE__)) . '/'. WPINC .'/wp-db.php');
Which used the constant defined in "/wp-settings.php" on line 18 instead of the hard coded "/wp-includes/" directory name.
Then I reloaded the page and I was presented with the regular installation page. Everything else seemed to work.
This has probably never bothered anyone enough to make them write a ticket before, but here I am!
Apologies if this isn't a bug or has been already reported.