WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#28728 closed defect (bug) (duplicate)

null post object bug back in 4.0-alpha-20140702

Reported by: lilaeamedia Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Query Keywords: reporter-feedback
Focuses: Cc:

Description

This is a follow-up to #21394.

query.php throws a notice when is_front_page is used prior to post selection.

Offending line is wp-includes/query.php:4543:

$page_obj = $this->get_queried_object();

Fixed by wrapping in

if ($page_obj = $this->get_queried_object()) { ... }

You may have better solution.

Change History (3)

#1 @lilaeamedia
5 years ago

Stream of notices as a result:

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4244

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4246

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4248

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4244

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4246

Notice: Trying to get property of non-object in /home/lilaeaco/public_html/test/web/wp-includes/query.php on line 4248

#2 @johnbillion
5 years ago

  • Keywords reporter-feedback added
  • Version changed from trunk to 1.5

Thanks for the report lilaeamedia.

The offending is_page() function has been this way since r1728 about a decade ago.

Can you provide some code to reproduce the issue please? If you attempt to call is_front_page() before the posts selection you should see a message stating is_front_page was called incorrectly.

#3 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #21790.

Note: See TracTickets for help on using tickets.