PHP 7.2 Compatibility: Deprecated ‘create_function’
-
Working on upgrading to PHP 7.2 and running into a compatibility issue.
The ‘create_function’ function has been deprecated, but it’s being used in the main powerpress.php file.
Any chance there’s an update in the works to address this?
Here’s the function…
// For grabbing data from Podpress data stored serialized, the strings for some values can sometimes get corrupted, so we fix it... function powerpress_repair_serialize($string) { if( @unserialize($string) ) return $string; // Nothing to repair... $string = preg_replace_callback('/(s:(\d+):"([^"]*)")/', create_function( '$matches', 'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s"\', strlen($matches[3]), $matches[3]);' ), $string); if( substr($string, 0, 2) == 's:' ) // Sometimes the serialized data is double serialized, so we need to re-serialize the outside string { $string = preg_replace_callback('/(s:(\d+):"(.*)";)$/', create_function( '$matches', 'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s";\', strlen($matches[3]), $matches[3]);' ), $string); } return $string; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP 7.2 Compatibility: Deprecated ‘create_function’’ is closed to new replies.