Opened 11 years ago
Closed 9 years ago
#27729 closed defect (bug) (wontfix)
error when wordpress is installed in separate directory then started in site root from function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8.1 |
Component: | Bootstrap/Load | Keywords: | close |
Focuses: | Cc: |
Description (last modified by )
When wordpress is installed in it's own directory and is started within a function in "index.php" in site root, these errors occur:
This fatal error occurs in WP 3.8.1:
[08-Apr-2014 19:34:50 UTC] PHP Fatal error: Call to a member function main() on a non-object in .../mywordpress/wp-includes/functions.php on line 808
In WP 3.9-beta3, the error changes to this non-fatal error:
[08-Apr-2014 19:53:51 UTC] PHP Warning: in_array() expects parameter 2 to be array, null given in .../mywordpress/wp-includes/kses.php on line 1176
Code samples:
index.php (no error):
<?php require("mywordpress/index.php");?>
index.php (error):
<?php function site_startup(){ require("mywordpress/index.php"); } site_startup(); exit; ?>
Tested with PHP 5.4 on Windows (PC XAMPP server) and Linux (Bluehost.com server).
Change History (5)
Note: See
TracTickets for help on using
tickets.
Hi Helened,
Why are you trying to include this file inside the function? Doing this will make WordPress execute like this -
That means the entire scope of WordPress will come into this function.
From the discussion on PHP's
require()
documentation page - http://www.php.net/manual/en/function.require.php#87191