I've just tested locally my web application, everything works fine, but after uploading to server application behaves differently. I use function formatiraj_string_url to convert diacritic symbols and get clean url... locally it works fine but on server this function doesnt convert them the same way.
Few days earlier I tested this on some third server and it worked fine. Now I'm uploading web to test it again on this third server, but I just wonder what could really be the cause of such behavior?
function formatiraj_string_url($string)
{
$string = strtolower($string);
$znak[0] = ' ';
$znak[1] = 'Š';
$znak[2] = 'š';
$znak[3] = 'Đ';
$znak[4] = 'đ';
$znak[5] = 'Č';
$znak[6] = 'č';
$znak[7] = 'Ć';
$znak[8] = 'ć';
$znak[9] = 'Ž';
$znak[10] = 'ž';
$znak[11] = 'Š';
$znak[12] = 'Đ';
$znak[13] = 'Č';
$znak[14] = 'Ć';
$znak[15] = 'Ž';
$znak[16] = 'š';
$znak[17] = 'đ';
$znak[18] = 'č';
$znak[19] = 'ć';
$znak[20] = 'ž';
$znak[21] = 'Š'; // Š
$znak[22] = 'š'; // š
$zamjena[0] = '-';
$zamjena[1] = 's';
$zamjena[2] = 's';
$zamjena[3] = 'd';
$zamjena[4] = 'd';
$zamjena[5] = 'c';
$zamjena[6] = 'c';
$zamjena[7] = 'c';
$zamjena[8] = 'c';
$zamjena[9] = 'z';
$zamjena[10] = 'z';
$zamjena[11] = 's';
$zamjena[12] = 'd';
$zamjena[13] = 'c';
$zamjena[14] = 'c';
$zamjena[15] = 'z';
$zamjena[16] = 's';
$zamjena[17] = 'd';
$zamjena[18] = 'c';
$zamjena[19] = 'c';
$zamjena[20] = 'z';
$zamjena[21] = 's';
$zamjena[22] = 's';
$string = str_replace($znak, $zamjena, $string);
$new_string = preg_replace("/[^a-zA-Z0-9-s]/", "", $string);
return $new_string;
}
EDIT: Before str_replace, this function used preg_replace. On server this was the error showed:
Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in /home2/sinjcom/public_html/sinj.com.hr/administracija/include/funkcije.php on line 200
But locally, I didn't have this problem