View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0015357 | mantisbt | bugtracker | public | 2013-01-10 03:55 | 2014-09-23 18:05 |
Reporter | AbsolutelyFreeWeb | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | windows | OS | 2003 | ||
Product Version | 1.2.8 | ||||
Target Version | 1.2.15 | Fixed in Version | 1.2.15 | ||
Summary | 0015357: uninitialized library path | ||||
Description | in core.php the library path is given with: define ( 'BASE_PATH' , realpath( dirname(FILE) ) ); However realpath may fail and return blank. Which results in that library path in the include path will not be valid and a number of required_once inclusions will fail. please check if realpath is returning usable data before using it. | ||||
Tags | No tags attached. | ||||
Considering that FILE will by definition contain an absolute path of the core.php file, I fail to see in which scenario realpath could possibly return NULL. Am I missing something ? Do you have a real case where this actually happened to you ? |
|
Might explain the behaviour The running script must have executable permissions on ALL DIRECTORIES IN THE HIERARCHY, otherwise realpath() will return FALSE. |
|
yes, on shared hosting on windows environment you may get that. Here is a simple fix: $thisfolder = realpath( dirname(FILE) ); |
|
OK I get it now. That being said, your proposed fix is probably unnecessary... Since Mantis has a minimum req of 5.1, I believe we in fact do not even need to call realpath() at all as we'll always have an absolute path (based on PHP doc for magic constants[1]) : FILE The full path and filename of the file. [...] Since PHP 4.0.2, FILE always contains an absolute path with symlinks resolved [..] So I would propose the following code change.
Thoughts ? [1] http://php.net/manual/en/language.constants.predefined.php |
|
@AbsolutelyFreeWeb can you please confirm if my earlier suggestion fixes your problem ? |
|
yes it should be fine. thank you |
|
Fixed. This issue does not need to be ported to 1.3 as the logic to include APIs is different and does not rely on realpath(). |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master-1.2.x 4ea08bf0 2013-01-30 04:05 Details Diff |
Remove call to realpath() when setting BASE_PATH in core.php Per PHP documentation [1], since version 4.0.2 __FILE__ always contains an absolute path with symlinks resolved; considering that MantisBT's minimum requirement is PHP 5.1 we therefore do not need to call realpath(). This avoids problems with the function returning FALSE when the running script does not have executable permissions on all directories in the hierarchy, which can happen e.g. with shared hosting on Windows. Fixes 0015357 [1] http://php.net/language.constants.predefined.php |
Affected Issues 0015357 |
|
mod - core.php | Diff File |