• Mat Lipe

    (@mat-lipe)


    Hello,

    As of PHP version 5.5 the “e” option has been deprecated when using preg_replace(). When running on a server using PHP 5.5+ with errors on you are shown the following error when trying to login, which also kills the cookies and prevent success.

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in plugins\active-directory-integration\ad_ldap\adLDAP.php on line 2580

    As you can see the error is coming from the ldap_slashes method. Here is a version of the same method that I re-wrote to work with the latest PHP.

    protected function ldap_slashes( $str ){
    	    $formatted = preg_replace_callback(
    		    '/([\x00-\x1F\*\(\)\\\\])/',
    		    function( $matches ){
    			    return "\\" . join( "", unpack( "H2", "$matches[1]" ) );
    		    },
    		    $str
    	    );
    
    	    return $formatted;
        }

    I am currently unable to reach you bug tracking site, so I figured I would post this here.

    https://www.ads-software.com/plugins/active-directory-integration/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Deprecated use of preg_replace’ is closed to new replies.