#23249 closed defect (bug) (invalid)
WPINC constant not used in installation script
Reported by: | tomgrenville | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5 |
Component: | Upgrade/Install | Keywords: | |
Focuses: | Cc: |
Description
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.
Change History (3)
#2
@
12 years ago
- Resolution set to invalid
- Status changed from new to closed
Ah, ok. My bad.
I seemed to remember reading somewhere in the WP forums that you could change the "wp-includes" directory name to something else in an attempt to increase security through obscurity. As such I thought that was why there was a constant defined in "wp-settings.php" (so people could change it).
If that's the case then I guess there's no reason to leave this ticket open any longer. I think I may have misunderstood a few things here and it looks like there is no bug! Apologies.
#3
@
12 years ago
- Milestone Awaiting Review deleted
Correct, we don't support renaming wp-includes. WPINC is simply a shorter reference. A lot of constants in WordPress can be specified (many are found in wp-includes/default-constants.php), and when that occurs we first check that the constant is not defined before defining it (not the case for WPINC).
I don't think we support renaming
wp-includes
. There are quite a few places in core where it's mentioned directly.