Reading URL Parameters
The following URL call, is redirected and processed by the 404.php page, indented to capture the s parameter.
https://www.example.com/doc/?s=par
For some reason, while try to processing the s parameter, none of the following alternatives succeed in reading the string 'par',
echo 's0: '.$filename0.'br';
$filename1=htmlspecialchars($_GET['s']);
echo 's1: '.$filename1.'br';
$filename2=get_query_var('s');
echo 's2: '.$filename2.'br';
It fails when using doc\, an empty folder, redirecting to the 404.php.
When replacing that string with 404.php or with any not existing folder or file, the problem is not experienced.
https://www.example.com/404.php?s=par
https://www.example.com/not-an-object?s=par
https://www.example.com/not-an-object/?s=par
What I am missing? how should I debug this?