PHP 5.5 preg_replace() /e modifier depricated
-
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);
- The topic ‘PHP 5.5 preg_replace() /e modifier depricated’ is closed to new replies.