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

Enhanced Pagination throws notices if Query ID is not defined. #55719

Closed
peterwilsoncc opened this issue Oct 31, 2023 · 0 comments · Fixed by #55720
Closed

Enhanced Pagination throws notices if Query ID is not defined. #55719

peterwilsoncc opened this issue Oct 31, 2023 · 0 comments · Fixed by #55720
Assignees
Labels
[Block] Query Loop Affects the Query Loop Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@peterwilsoncc
Copy link
Contributor

Description

Enhanced pagination of the query block throws notices if the query ID is not defined.

Notice: Undefined index: queryId in .../gutenberg/build/block-library/blocks/query.php on line 150
Notice: Undefined index: queryId in .../gutenberg/build/block-library/blocks/query.php on line 25
Notice: Undefined index: queryId in .../gutenberg/build/block-library/blocks/query.php on line 170

In the Site Editor, it appears this is prevented from happening, so the issue only occurs if the incorrect markup is used in the files of a distributed theme.

I think if the queryId is not defined, then enhanced pagination can be prevented. Generating a queryId could work but may lead to collisions if there are two queries on the page and one of them has the value defined.

Step-by-step reproduction instructions

  1. Enabled debug mode in your wp-config file:
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', true );
  2. Download and activate peters-sample-theme.zip which contains bad markup in templates/index.html
  3. Visit the theme on the front end of the site.
  4. Observe the notices thrown

Screenshots, screen recording, code snippet

Stack trace attached, it's quite a lot because it's generated with xdebug enabled.

debug.log

Environment info

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants