Title: PHP 7.2 Compatibility: Deprecated &#8216;create_function&#8217;
Last modified: February 27, 2019

---

# PHP 7.2 Compatibility: Deprecated ‘create_function’

 *  Resolved [toddlevy](https://wordpress.org/support/users/toddlevy/)
 * (@toddlevy)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/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](http://php.net/manual/en/function.create-function.php),
   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)

 *  Plugin Contributor [Angelo Mandato](https://wordpress.org/support/users/amandato/)
 * (@amandato)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/php-7-2-compatibility-deprecated-create_function/#post-11256648)
 * Hello [@toddlevy](https://wordpress.org/support/users/toddlevy/),
 * Thanks for reporting! This has actually been fixed in the dev version, you can
   download and test for us here: [https://downloads.wordpress.org/plugin/powerpress.zip](https://downloads.wordpress.org/plugin/powerpress.zip).
   We plan on releasing this update soon.
 * Thanks,
    Angelo

Viewing 1 replies (of 1 total)

The topic ‘PHP 7.2 Compatibility: Deprecated ‘create_function’’ is closed to new
replies.

 * ![](https://ps.w.org/powerpress/assets/icon.svg?rev=2849869)
 * [PowerPress Podcasting plugin by Blubrry](https://wordpress.org/plugins/powerpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/powerpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/powerpress/)
 * [Active Topics](https://wordpress.org/support/plugin/powerpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/powerpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/powerpress/reviews/)

## Tags

 * [compatibility](https://wordpress.org/support/topic-tag/compatibility/)
 * [create_function](https://wordpress.org/support/topic-tag/create_function/)
 * [PHP 7.2](https://wordpress.org/support/topic-tag/php-7-2/)

 * 1 reply
 * 2 participants
 * Last reply from: [Angelo Mandato](https://wordpress.org/support/users/amandato/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/php-7-2-compatibility-deprecated-create_function/#post-11256648)
 * Status: resolved