Menu

#2829 $_SERVER['PHP_SELF'] Returns Invalid Value

Can't Reproduce
closed-invalid
nobody
None
5
2016-01-27
2016-01-27
No

SquirrelMail version: 1.4.23 [SVN]
Web server: nginx/1.4.6 (Ubuntu)
PHP version: PHP 5.5.9-1ubuntu4.14

I've discovered an issue with the value returned from the $_SERVER['PHP_SELF'] variable. For some reason the value contains the path to a particular file concatendated to itself, like this:

/squirrelmail/src/left_main.php/squirrelmail/src/left_main.php

This causes HTTP 404 errors when attempting to process (delete, move, etc) displayed messages because the path to the PHP source files ends up being invalid. The fix is to replace PHP_SELF with SCRIPT_NAME in the functions/strings.php file at line 1514 inside the php_self() function.That is, change this:

if (!sqgetGlobalVar('PHP_SELF', $request_uri, SQ_SERVER)

to this:

if (!sqgetGlobalVar('SCRIPT_NAME', $request_uri, SQ_SERVER)

Discussion

  • Paul Lesniewski

    Paul Lesniewski - 2016-01-27

    While the various CGI variables provided by PHP can seem like a web of confusion, they are never given in such incorrect fashion unless you have a botched server-side configuration. This problem is not a SquirrelMail problem; it is a mistake in your Nginx/FCGI configuration.

     
  • Paul Lesniewski

    Paul Lesniewski - 2016-01-27
    • status: open --> closed-invalid
     

Log in to post a comment.

MongoDB Logo MongoDB