Description
We are having some redirector related errors that seem to be caused by improperly encoded url property values in the request. If there is a ' character in the Get request and it passes through the redirector it will cause a SQL error such as:
[2015-09-16 12:02:50](ERROR @ /index.php) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's%20Summit&utm_term=lee's%20summit%20conex&template=3&location=Lee's%20Summit') ' at line 1
)
Now this does not happen if the request is made through the browser as the browser seems to encode this ' character as %27 automatically. However, when the Get request is made directly by Google AdBot it is completely raw and causes the error. I reproduced this case by using Fiddler to send the request.
Our solution was to add a line of code to do a string replace in the $search var.
ex:
$search = ltrim($search,'/');
$search = str_replace("'",'%27',$search);
That seems to remedy the issue but then we are now running custom redirector code so I thought I would post it here.