Hi,
Just updated my PHP version from 5.4 to 7 and I was getting that error too. Your solution, @simone-camporeale, didn’t completely worked for me. I was getting literally this in each pre:
$m[2]
So I have modified simone.camporeale solution, and got this one that is working for me:
return preg_replace_callback("/<pre(.*?)>(.*?)<\/pre>/is",function($m) { return '<pre class="wp-code-highlight prettyprint'.$line_numbers.'">'.wch_stripslashes($m[2]).''; },$content);
Note it’s almost the same, but modifying a little bit the pre tag’s class and removing the apostrophes in the wch_strpslashes() parameter.
EDIT: sorry for editing a lot. First time posting here and I was trying to figure out how to correctly put code in the code blocks.
EDIT2: btw, I had to check all my code snippets since, on some, some symbols like & or > were automatically changed to the HTML name (& amp; and & gt; respectively)