WordPress.org

Make WordPress Core

Ticket #16892: 16892.4.patch

File 16892.4.patch, 1.3 KB (added by hakre, 3 years ago)

pcre.recursion_limit settings workaround

  • wp-includes/formatting.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    13861386function make_clickable($ret) { 
    13871387        $ret = ' ' . $ret; 
    13881388        // in testing, using arrays here was found to be faster 
    1389         $ret = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
     1389        $save = ini_set('pcre.recursion_limit', 10000); 
     1390        $retval = preg_replace_callback('#(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret); 
     1391        if (null !== $retval ) 
     1392                $ret = $retval; 
     1393        ini_set('pcre.recursion_limit', $save); 
    13901394        $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); 
    13911395        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); 
    13921396        // this one is not in an array because we need it to run last, for cleanup of accidental links within links