Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"PHP Notice: Trying to get property 'area' of non-object" when creating a new TP from the TP block inside a TP #48596

Closed
Chrystll opened this issue Feb 28, 2023 · 6 comments
Assignees
Labels
[Block] Template Part Affects the Template Parts Block [Type] Bug An existing feature does not function as intended

Comments

@Chrystll
Copy link

Chrystll commented Feb 28, 2023

Description

I get the notice below with WordPress 6.2-beta3-55428 and and Twenty Twenty Three (only) when creating a new TP from the TP block inside a TP.


[PHP Notice:  Trying to get property 'area' of non-object in /wp-single/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php on line 586
[PHP Stack trace:
[PHP   1. {main}() /wp-single/index.php:0
[PHP   2. require() /wp-single/index.php:17
[PHP   3. wp() /wp-single/wp-blog-header.php:16
[PHP   4. WP->main() /wp-single/wp-includes/functions.php:1330
[PHP   5. WP->parse_request() /wp-single/wp-includes/class-wp.php:780
[PHP   6. do_action_ref_array() /wp-single/wp-includes/class-wp.php:399
[PHP   7. WP_Hook->do_action() /wp-single/wp-includes/plugin.php:565
[PHP   8. WP_Hook->apply_filters() /wp-single/wp-includes/class-wp-hook.php:332
[PHP   9. rest_api_loaded() /wp-single/wp-includes/class-wp-hook.php:308
[PHP  10. WP_REST_Server->serve_request() /wp-single/wp-includes/rest-api.php:410
[PHP  11. WP_REST_Server->dispatch() /wp-single/wp-includes/rest-api/class-wp-rest-server.php:442
[PHP  12. WP_REST_Server->respond_to_request() /wp-single/wp-includes/rest-api/class-wp-rest-server.php:1028
[PHP  13. WP_REST_Templates_Controller->create_item() /wp-single/wp-includes/rest-api/class-wp-rest-server.php:1181
[PHP  14. WP_REST_Templates_Controller->prepare_item_for_database() /wp-single/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:400

Step-by-step reproduction instructions

  1. go to /wp-admin/site-editor.php?canvas=view&path=%2Fwp_template_part&postType=wp_template_part then edit the Footer TP for example
  2. add a TP block > choose "start blank" > then create your TP. This action triggers the PHP notice mentioned above.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@kathrynwp kathrynwp added [Block] Template Part Affects the Template Parts Block Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended [Status] Needs More Info Follow-up required in order to be actionable. labels Feb 28, 2023
@kathrynwp
Copy link

Hi there, thanks for the report @Chrystll

Could you please confirm:

  • what version of PHP does this occur with?
  • does this also occur with WP 6.1.1, with Gutenberg 15.2.2 active and/or inactive?
@Chrystll
Copy link
Author

@kathrynwp
It occurs also with WordPress 6.1.1 with Gutenberg 15.2.2 inactive.
My PHP version is 7.2.3

@Mamaduka Mamaduka removed [Status] Needs More Info Follow-up required in order to be actionable. Needs Testing Needs further testing to be confirmed. labels Mar 1, 2023
@Mamaduka
Copy link
Member

Mamaduka commented Mar 1, 2023

I can confirm this notice. It needs to be fixed in the core, but let's keep the issue open for tracking purposes.

@t-hamano
Copy link
Contributor

t-hamano commented Mar 2, 2023

I was also able to reproduce it. The problem appears to occur in the template editor as well.

f3f115c7fa2a3b35a8f3ab146fde7f75.mp4
@t-hamano t-hamano self-assigned this Mar 2, 2023
@t-hamano
Copy link
Contributor

This issue has been resolved in the core and I will close.

https://core.trac.wordpress.org/changeset/56248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Type] Bug An existing feature does not function as intended
4 participants