View Issue Details

IDProjectCategoryView StatusLast Update
0005753mantisbtbugtrackerpublic2009-10-07 14:19
Reporterflexer Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.0a2 
Target Version1.2.0rc2Fixed in Version1.2.0rc2 
Summary0005753: CGI PHP (with FCGI) with EMPTY PHP_SELF
Description

When using PHP with FastCGI and lighttpd, $_SERVER['PHP_SELF'] is set but it's empty. Checks made by mantis with that variable all fails. Mantis still works, but, for example, the $g_path is wrongly set.

Hint: not only check for (isset($_SERVER['PHP_SELF'])) but also && !empty($_SERVER['PHP_SELF'])

In config_defaults_inc.php when trying to set $g_path, I did this:

    if (isset($_SERVER['PHP_SELF']) && !empty($_SERVER['PHP_SELF']))
      $t_path = dirname( $_SERVER['PHP_SELF'] );
    else
      $t_path = dirname( $_SERVER['SCRIPT_NAME'] );

and it worked fine (this also get rid of the default "http://www.example.com/mantis/".

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Related Changesets

MantisBT: master ce27f552

2009-07-10 19:39

dhx


Details Diff
Use SCRIPT_NAME instead of PHP_SELF

$_SERVER['SCRIPT_NAME'] does a similar thing to $_SERVER['PHP_SELF']
except it is defined in the CGI standard. Many web servers, by defualt,
don't expose PHP_SELF when using CGI/FastCGI. They do expose
SCRIPT_NAME, so this is a better choice to use.

See:
http://hoohoo.ncsa.illinois.edu/cgi/env.html
http://www.php.net/manual/en/reserved.variables.server.php
http://php.about.com/od/learnphp/qt/_SERVER_PHP.htm
Affected Issues
0005753
mod - core/html_api.php Diff File
mod - core.php Diff File
mod - config_defaults_inc.php Diff File
mod - core/access_api.php Diff File
mod - core/authentication_api.php Diff File
mod - manage_config_email_page.php Diff File
mod - manage_config_workflow_page.php Diff File
mod - core/database_api.php Diff File
mod - admin/test_email.php Diff File
mod - manage_config_work_threshold_page.php Diff File
mod - api/soap/mantisconnect.php Diff File
mod - core/utility_api.php Diff File

MantisBT: master-1.2.x 2fe55fdd

2009-07-10 19:39

dhx


Details Diff
Use SCRIPT_NAME instead of PHP_SELF

$_SERVER['SCRIPT_NAME'] does a similar thing to $_SERVER['PHP_SELF']
except it is defined in the CGI standard. Many web servers, by defualt,
don't expose PHP_SELF when using CGI/FastCGI. They do expose
SCRIPT_NAME, so this is a better choice to use.

See:
http://hoohoo.ncsa.illinois.edu/cgi/env.html
http://www.php.net/manual/en/reserved.variables.server.php
http://php.about.com/od/learnphp/qt/_SERVER_PHP.htm
Affected Issues
0005753
mod - core/html_api.php Diff File
mod - core.php Diff File
mod - core/access_api.php Diff File
mod - core/authentication_api.php Diff File
mod - manage_config_email_page.php Diff File
mod - config_defaults_inc.php Diff File
mod - manage_config_workflow_page.php Diff File
mod - core/database_api.php Diff File
mod - admin/test_email.php Diff File
mod - manage_config_work_threshold_page.php Diff File
mod - api/soap/mantisconnect.php Diff File
mod - core/utility_api.php Diff File