[wp-trac] [WordPress Trac] #59927: Missing error check in convert_smilies() can cause PHP Fatal error

WordPress Trac noreply at wordpress.org
Tue Nov 28 12:10:08 UTC 2023


#59927: Missing error check in convert_smilies() can cause PHP Fatal error
------------------------------------------------+---------------------
 Reporter:  Ov3rfly                             |       Owner:  (none)
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  6.5
Component:  Formatting                          |     Version:
 Severity:  normal                              |  Resolution:
 Keywords:  php80 needs-unit-tests needs-patch  |     Focuses:
------------------------------------------------+---------------------

Comment (by Ov3rfly):

 @jorbin Suggested fix:

 {{{
 // HTML loop taken from texturize function, could possible be
 consolidated.
 $textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
 // Capture the tags as well as in between.
 if ( $textarr === false ) {
         return $text;   // do nothing
 }
 $stop    = count( $textarr ); // Loop stuff.
 }}}
 Would also suggest an earlier milestone as 6.5, otherwise the issue gets
 burried (again).

 @jrf Good find, seems like the same issue is described there, did search
 but maybe not 3 years back. Would not call it `php80` related though as
 the missing check for `false` is the real problem here, not the change
 from Warning to Fatal since PHP 8.x.

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


More information about the wp-trac mailing list