WordPress.org

Support

Support » Plugins and Hacks » [Resolved] PHP 5.5 preg_replace() /e modifier depricated

[Resolved] PHP 5.5 preg_replace() /e modifier depricated

  • swinggraphics
    Participant

    @swinggraphics

    Here are the changes to make for 5.5 compatibility:

    Change

    $string = preg_replace("/\%post_date_gmt\(([a-zA-Z\s\\\\:,]*)\)/e", "mysql2date('$1', '$post_date_gmt')", $string);

    to

    $string = preg_replace_callback("/\%post_date_gmt\(([a-zA-Z\s\\\\:,]*)\)/", create_function('$matches', 'return mysql2date($matches[1], $post_date_gmt);'), $string);

    Change

    $string = preg_replace("/\%post_date\(([a-zA-Z\s\\\\:,]*)\)/e", "mysql2date('$1', '$post_date')", $string);

    to

    $string = preg_replace_callback("/\%post_date\(([a-zA-Z\s\\\\:,]*)\)/", create_function('$matches', 'return mysql2date($matches[1], $post_date);'), $string);

    Change

    $string = preg_replace("/\%post_modified_gmt\(([a-zA-Z\s\\\\:,]*)\)/e", "mysql2date('$1', '$post_modified_gmt')", $string);

    to

    $string = preg_replace_callback("/\%post_modified_gmt\(([a-zA-Z\s\\\\:,]*)\)/", create_function('$matches', 'return mysql2date($matches[1], $post_modified_gmt);'), $string);

    Change

    $string = preg_replace("/\%post_modified\(([a-zA-Z\s\\\\:,]*)\)/e", "mysql2date('$1', '$post_modified')", $string);

    to

    $string = preg_replace_callback("/\%post_modified\(([a-zA-Z\s\\\\:,]*)\)/", create_function('$matches', 'return mysql2date($matches[1], $post_modified);'), $string);

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] PHP 5.5 preg_replace() /e modifier depricated’ is closed to new replies.