I have this simple php function
<?php
$ELASTIC_SEARCH_SPECIAL_KEYWORDS = "/[\\+\\-\\=\\&\\|\\!\\(\\)\\{\\}\\[\\]\\^\\\"\\~\\*\\<\\>\\?\\:\\\\\\/]/";
function escapeESReservedChars($text) {
global $ELASTIC_SEARCH_SPECIAL_KEYWORDS;
$result = preg_replace_callback ($ELASTIC_SEARCH_SPECIAL_KEYWORDS,
function ($matches) {
return "\\" . $matches[0];
}, $text);
return $result;
}
Here $text
is any text message where if there is any special chars,it will replace that with \\
It run only when i make build & upload to server. If i run this file on localhost
it neither run not throw any error. There is no problem with this function. I think middleman
is doing something behind the screen.