0

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?

2
  • 1
    s is already a query variable in core used for search you shouldn't be adding it as a custom query variable. Note that query variables are not URL parameters
    – Tom J Nowell
    Apr 13, 2021 at 21:50
  • @TomJNowell That is good to know, then I will remove that filter...
    – Brethlosze
    Apr 13, 2021 at 21:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.