[wp-trac] [WordPress Trac] #56188: Attempt to read property "post_type" on null after PHP 8.1

WordPress Trac noreply at wordpress.org
Sun Jun 1 06:31:41 UTC 2025


#56188: Attempt to read property "post_type" on null after PHP 8.1
--------------------------------------+------------------------
 Reporter:  brmartinez                |       Owner:  (none)
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:
Component:  Posts, Post Types         |     Version:
 Severity:  critical                  |  Resolution:  duplicate
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------
Changes (by sabernhardt):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Awaiting Review =>


Old description:

> Hello, I've noticed this error in WordPress since I've installed PHP 8.1.
> Can you fix it?
>
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:17:00 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338
> [09-Jul-2022 16:18:11 UTC] PHP Warning:  Attempt to read property
> "post_type" on null in /home/showmetechcom/public_html/wp-includes/class-
> wp-query.php on line 4338

New description:

 Hello, I've noticed this error in WordPress since I've installed PHP 8.1.
 Can you fix it?

 `[09-Jul-2022 16:16:45 UTC] PHP Warning:  Attempt to read property
 "post_type" on null in /.../wp-includes/class-wp-query.php on line 4338`

--

Comment:

 Duplicate of #29660.

 [54496] edited several query functions to prevent PHP warnings like this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56188#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list