WordPress.org

Make WordPress Core

Ticket #6697: bug6697.3.patch

File bug6697.3.patch, 786 bytes (added by pauamma, 6 years ago)

Take 3. (Can't use create_function directly in a static initializer - otherwise changed as suggested)

  • wp-includes/formatting.php

    old new  
    679679 * @return string The sanitized title. 
    680680 */ 
    681681function sanitize_title_with_dashes($title) { 
     682        static $toupper; 
     683    if ( !isset( $toupper ) ) 
     684                $toupper = create_function( '$m', 'return strtoupper( $m[0] );' ); 
    682685        $title = strip_tags($title); 
    683686        // Preserve escaped octets. 
    684687        $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); 
     
    702705        $title = preg_replace('/\s+/', '-', $title); 
    703706        $title = preg_replace('|-+|', '-', $title); 
    704707        $title = trim($title, '-'); 
     708        // Use uppercase hex digits in URI-escaped characters 
     709        $title = preg_replace_callback( '/%[a-f0-9][a-f0-9]/', $toupper, $title ); 
    705710 
    706711        return $title; 
    707712}