Make WordPress Core

Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#42960 closed enhancement (invalid)

get_page_permastruct call causes 500 error.

Reported by: wcwilson1950's profile wcwilson1950 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords: reporter-feedback close
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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)

blebootcamp_error_logs-2017-12-21_20-26-04.txt (75.9 KB) - added by wcwilson1950 6 years ago.
Production error log with error.

Download all attachments as: .zip

Change History (5)

@wcwilson1950
6 years ago

Production error log with error.

#1 @dd32
6 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.

#2 @pento
5 years ago

  • Version trunk deleted

#3 @hellofromTonya
3 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.

#4 @SergeyBiryukov
3 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.