[wp-trac] [WordPress Trac] #60973: PHP Warning in 6.5.2

WordPress Trac noreply at wordpress.org
Wed Apr 10 01:15:43 UTC 2024


#60973: PHP Warning in 6.5.2
------------------------------------------------+--------------------------
 Reporter:  ivanzhuck                           |      Owner:  (none)
     Type:  defect (bug)                        |     Status:  new
 Priority:  normal                              |  Milestone:  Awaiting
                                                |  Review
Component:  Editor                              |    Version:  5.5.2
 Severity:  normal                              |   Keywords:  needs-patch
  Focuses:  administration, template, rest-api  |
------------------------------------------------+--------------------------
 Hi,

 if your site uses a classic theme which doesn't have directory
 'templates', the method
 'WP_REST_Templates_Controller::prepare_item_for_response' throws warnings
 like these:

 {{{
 PHP Warning: Attempt to read property "id" on null in /var/www/site/web/wp
 /wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php on
 line 647
 PHP Warning: Attempt to read property "theme" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 651
 PHP Warning: Attempt to read property "content" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 658
 PHP Warning: Attempt to read property "content" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 662
 PHP Warning: Attempt to read property "slug" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 666
 PHP Warning: Attempt to read property "source" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 670
 PHP Warning: Attempt to read property "origin" on null in
 /var/www/site/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-
 templates-controller.php on line 674
 }}}

 At the first time, the issue was detected in the version 5.2 and related
 with the ticked: https://core.trac.wordpress.org/ticket/60915 which marked
 as 'fixed'.

 How to reproduce:


 1. Install classic theme which doesn't have directory 'templates', but
 uses 'wp block editor'.
 2. Open editor for any post.
 3. The block editor calls rest api method '/wp-
 json/wp/v2/templates/lookup'.
 4. While the method is working it throws warnings.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60973>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list