[wp-trac] [WordPress Trac] #62639: Block Hooks: Wrongly typed context when updating wp_navigation post meta

WordPress Trac noreply at wordpress.org
Thu Dec 5 11:17:52 UTC 2024


#62639: Block Hooks: Wrongly typed context when updating wp_navigation post meta
------------------------------------------------+--------------------------
 Reporter:  Bernhard Reiter                     |       Owner:  Bernhard
                                                |  Reiter
     Type:  defect (bug)                        |      Status:  closed
 Priority:  normal                              |   Milestone:  6.7.2
Component:  General                             |     Version:  trunk
 Severity:  normal                              |  Resolution:  fixed
 Keywords:  has-patch fixed-major dev-reviewed  |     Focuses:
------------------------------------------------+--------------------------
Changes (by cbravobernal):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59487" 59487]:
 {{{
 #!CommitTicketReference repository="" revision="59487"
 Block Hooks: Fix context in update_ignored_hooked_blocks_postmeta.

 Ensure that the `$context` arg passed from
 `update_ignored_hooked_blocks_postmeta` to `apply_block_hooks_to_content`
 (and from there, to filters such as `hooked_block_types` and
 `hooked_block`) has the correct type (`WP_Post`).


 Filters hooked to `hooked_block_types` etc can typically include checks
 that conditionally insert a hooked block depending on `$context`. Prior to
 this changeset, a check like `if ( $context instanceof WP_Post )` would
 incorrectly fail, as `$context` would be a `stdClass` instance rather han
 a `WP_Post`. As a consequence, a hooked block inside of a Navigation post
 object that was modified by the user would not be marked as ignored by
 `update_ignored_hooked_blocks_postmeta`, and thus be erroneosly re-
 inserted by the Block Hooks algorithm.

 Reviewed by cbravobernal.
 Merges [59482] to the 6.7 branch.

 Props bernhard-reiter.
 Fixes #62639.
 }}}

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


More information about the wp-trac mailing list