Well, the error message makes sense to me, but then I'm not anyone.
The /e means that preg_replace() is to take the replacement string and, after interpolating backreferences, interpret the result as PHP code. In this case, the replacement string, after interpolating backreferences, is
1.1.1
. Which is not valid PHP code because it contains an unexpected double. So why not ditch the /e modifier? It's not doing anything you need. In fact, the whole expression is unnecessarily hairy.
$contents = preg_replace(
'/(\s*\*+\s*@version\s+)' . preg_quote($oldversion,'/') . '(\s*)/i',
'$1' . $newversion . '$2',
$contents);