[wp-trac] [WordPress Trac] #63891: Processing directives function in interactivity API class may cause fatal error

WordPress Trac noreply at wordpress.org
Wed Aug 27 14:46:57 UTC 2025


#63891: Processing directives function in interactivity API class may cause fatal
error
-------------------------------+-----------------------------
 Reporter:  hugosolar          |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Interactivity API  |    Version:  6.8.2
 Severity:  normal             |   Keywords:  needs-patch
  Focuses:  php-compatibility  |
-------------------------------+-----------------------------
 This may be an edge case for posts created with Classic editor or classic
 editor block.
 `_process_directives` function within `WP_Interactivity API` class will
 process html and check for closer tags.
 if there's a wrong tag like </br> (in my case) will result in a TypeError:

 {{{
 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of
 type Countable|array, null given in wp-includes/interactivity-api/class-
 wp-interactivity-api.php on line 442
 }}}

 by checking the line of code, `count()` function is applied to
 `get_attribute_names_with_prefix()` method from `WP_HTML_Tag_Processor`
 which can eventually return `null`

 for newer PHP version (8.0.0 and later) this will throw a fatal error.
 probably worth getting an extra check if the funcion is returning a
 countable variable

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63891>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list