[wp-trac] [WordPress Trac] #60842: PHPunit tests for wp_check_invalid_utf8

WordPress Trac noreply at wordpress.org
Thu Oct 10 08:28:16 UTC 2024


#60842: PHPunit tests for wp_check_invalid_utf8
--------------------------------------+------------------------------
 Reporter:  pbearne                   |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Formatting                |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by debarghyabanerjee):

 While writing the test cases for `wp_check_invalid_utf8` with $strip set
 to true, I found that if we pass any kind of Invalid UTF-8 character, it's
 throwing a Fatal Error, mostly because of this line


 {{{
 if ( $strip && function_exists( 'iconv' ) ) {
                 return iconv( 'utf-8', 'utf-8', $text );
         }
 }}}

 It was mentioned that this is particularly to remove the `bad` characters,
 but passing an invalid `UTF-8` character throws an error.

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


More information about the wp-trac mailing list