-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix potential fatal error on Interactivity API processing directives … #9641
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
Changes from 1 commit
4d0212d
19f2afb
c4bc65d
20157c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -439,7 +439,12 @@ private function _process_directives( string $html ) { | |||||||||||||
| array_pop( $tag_stack ); | ||||||||||||||
| } | ||||||||||||||
| } else { | ||||||||||||||
| if ( 0 !== count( $p->get_attribute_names_with_prefix( 'data-wp-each-child' ) ) ) { | ||||||||||||||
| $each_child_attrs = $p->get_attribute_names_with_prefix( 'data-wp-each-child' ); | ||||||||||||||
| if ( ! is_countable( $each_child_attrs ) ) { | ||||||||||||||
| continue; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if ( 0 !== count( $each_child_attrs ) ) { | ||||||||||||||
|
||||||||||||||
| if ( ! is_countable( $each_child_attrs ) ) { | |
| continue; | |
| } | |
| if ( 0 !== count( $each_child_attrs ) ) { | |
| if ( null !== $each_child_attrs && 0 !== count( $each_child_attrs ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. I thought it only contained a foreach with another get_attribute_names_with_prefix() but it contains another conditional block.
That other get_attribute_names_with_prefix has the same problem where it lacks a null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer a
nullcheck here, it's more consistent with other HTML API code: