#42960 closed enhancement (invalid)
get_page_permastruct call causes 500 error.
Reported by: | wcwilson1950 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Rewrite Rules | Keywords: | reporter-feedback close |
Focuses: | Cc: |
Description (last modified by )
This was discussed in #7589. I can't seem to find the plugin that is causing this problem. Obviously somebody is making the call to get_page_permastruct before $wp_rewrite is being initialized; in my case it's on logout and trying to redirect to the logout page.
It would be a help to wrap the call to $wp_rewrite->get_page_permastruct() on line 356, with an if statement that tests for null $wp_rewrite. The rest of the code functions if that approach is taken.
if (!empty($wp_rewrite)) { $link = $wp_rewrite->get_page_permastruct(); }
Attachments (1)
Change History (5)
#1
@
7 years ago
- Keywords reporter-feedback close added
Before we consider changing this, we'd need to know what/where is calling the function.
You may wish to add logging into the function on your site to detect it:
if ( empty($wp_rewrite) ) { trigger_error( __FUNCTION__ . " Called too early by " . wp_debug_backtrace_summary(), E_USER_ERROR ); }
However, In general, we wouldn't change this as in this case, a PHP fatal error is the correct result. Fix the plugin/theme/other code which is calling the function too early instead.
Unless the error is being generated by a use-case which is significantly common, we're not going to change it.
#3
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Hello @wcwilson1950 and Welcome to Trac!
I'm closing this ticket you opened. Why? It's been over 3 years since feedback was requested and the ticket was marked as a close
candidate.
However, please feel free to reopen and provide us with feedback. Cheers.
Production error log with error.