Make WordPress Core

Opened 7 weeks ago

Closed 7 weeks ago

#60973 closed defect (bug) (duplicate)

PHP Warning in 6.5.2

Reported by: ivanzhuck's profile ivanzhuck Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:

Description

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.

Change History (1)

#1 @jorbin
7 weeks ago

  • Focuses administration template rest-api removed
  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 5.5.2 deleted

Thanks for the ticket, but this has been reported in #60909

Note: See TracTickets for help on using tickets.