Fix: preg_replace /e modifier deprecation error

There was a very old code path that uses /e modifier in
preg_replace statement. On PHP5 this causes issues. The replacement
actually never gets executed, but the pattern gets still compiled and
causes error_log output. I moved it to preg_replace_callback and adjusted
the callbacks argument processing.

Change-Id: Ic31f4fe2384bf46a88d4ca67e8f8ca19148203da