fpdm icon indicating copy to clipboard operation
fpdm copied to clipboard

create_function: deprecated 7.2 - Use anonymous functions instead.

Open brainz80 opened this issue 5 years ago • 0 comments

When looking at the code I came across this hack in src/fpdm.php

//My PHP4/5 static call hack, only to make the callback $this->replace_value($matches,"$value") possible!
$callback_code='$THIS=new FPDM("[_STATIC_]");return $THIS->replace_value($matches,"'.$value.'");';

$field_regexp='/^\/(\w+)\s?(\<|\()([^\)\>]*)(\)|\>)/';

if(preg_match($field_regexp,$CurLine)) {
    //modify it according to the new value $value
    $CurLine = preg_replace_callback(
        $field_regexp,
        create_function('$matches',$callback_code),
        $CurLine
    );
}else {
    if($verbose_set) echo("<br>WARNING:".htmlentities("Can not access to the value: $CurLine using regexp $field_regexp"));
}

PHPs create_function() seems to be deprecated as of 7.2. So this hack might fail in the future.

brainz80 avatar Aug 07 '20 13:08 brainz80