preg_replace with the deprecated /e modifier evaluates the replacement as PHP code.
Replace the /e modifier with preg_replace_callback.