[wp-trac] Re: [WordPress Trac] #9616: Trunk throws warnings on php4 sites

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 24 09:22:53 GMT 2009


#9616: Trunk throws warnings on php4 sites
--------------------------------------+-------------------------------------
 Reporter:  Denis-de-Bernardy         |        Type:  defect (bug)    
   Status:  new                       |    Priority:  high            
Milestone:  2.8                       |   Component:  Warnings/Notices
  Version:  2.8                       |    Severity:  blocker         
 Keywords:  needs-patch dev-feedback  |  
--------------------------------------+-------------------------------------

Comment(by Denis-de-Bernardy):

 Their implementation is in classes/core/String.inc.php, and goes like
 this:

 {{{
 function html2utf($str) {
         // convert named entities to numeric entities
         $str = strtr($str, String::getHTMLEntities());

         // use PCRE-aware replace function to replace numeric entities
         $str = String::regexp_replace('~&#x([0-9a-f]+);~ei',
 'String::code2utf(hexdec("\\1"))', $str);
         $str = String::regexp_replace('~&#([0-9]+);~e',
 'String::code2utf(\\1)', $str);

         return $str;
  }
 }}}

 Side note: best I'm aware, strtr is not mb safe, so the above code is
 potentially buggy in mb languages.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9616#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list