Title: Deprecated: preg_replace()
Last modified: March 16, 2017

---

# Deprecated: preg_replace()

 *  [miladam](https://wordpress.org/support/users/miladam/)
 * (@miladam)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/deprecated-preg_replace-2/)
 * greetings. Unfortunatelly I am not a coder but I do have a problem.
 * I have changed PHP version from php5 to php6 on the server and I recieved following
   error in my wordpress site.
 * Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback
   instead in /home/gazetta/domains/miastoiludzie.pl/public_html/prolink.php on 
   line 177
 * Line 177 looks like that
 *  $text = preg_replace(‘!s:(\d+):”(.*?)”;!se’, “‘s:’.strlen(‘$2′).’:\”$2\”;'”,
   $text);
 * When I change function to preg_replace_callback it is giving me this error also:
 * Warning: preg_replace_callback(): Requires argument 2, ”s:’.strlen(‘$2′).’:”$
   2″;”, to be a valid callback in /home/gazetta/domains/miastoiludzie.pl/public_html/
   prolink.php on line 177
 * The question is how to modify this line and function
 *  $text = preg_replace_callback(‘!s:(\d+):”(.*?)”;!se’, “‘s:’.strlen(‘$2′).’:\”
   $2\”;'”, $text);
 * to be valid without broken the code. Since I don’t know how to do it I am asking
   you for a little help. : ) Thanks in advance

Viewing 1 replies (of 1 total)

 *  [Eddy](https://wordpress.org/support/users/edznet/)
 * (@edznet)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/deprecated-preg_replace-2/#post-8931630)
 * Hi, try this fix but from what I can see the plugin [Prolink](https://frp.wordpress.org/plugins/tags/prolink)
   has been outdated for almost 4years. I cant guarantee this will work, but the
   plugin itself might need a rewrite to be compatible with current PHP versions.
 * PHP Documentation here: [http://www.php.net/manual/en/function.preg-replace-callback.php](http://www.php.net/manual/en/function.preg-replace-callback.php)
 *     ```
       $text = preg_replace_callback('!s:(\d+):"(.*?)";!', function($m) {
           return 's:' . strlen($m[2]) . ':"' . $m[2] . '";';
       }, $text);
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Deprecated: preg_replace()’ is closed to new replies.

## Tags

 * [preg_replace](https://wordpress.org/support/topic-tag/preg_replace/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Eddy](https://wordpress.org/support/users/edznet/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/deprecated-preg_replace-2/#post-8931630)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
