PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_Menu » Bug #6394

Case sensitivity in getPath() and _buildUrlMap()

Details

Submitted2006-01-02 14:47 UTC
Frombenjamin dot taieb at bnpparibas dot com
StatusWont fix
PackageHTML_Menu
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2006-01-02 14:47 UTC] benjamin dot taieb at bnpparibas dot com

Description:
------------
If you access a script in a different Case that it was initially entered in the Menu hash, the menu is not displayed correctly. For example, let says that /test1.php is in the menu Hash and you access this script by
http://yourservername/Test1.php , the getPath function will not identify this url (/test1.php in hash and Test1.php in $PHP_SELF).
Proposed workaround :
Modify line 458 in Menu.php as follow :
while ($this->_currentUrl && !isset($this->_urlMap[$this->_currentUrl])) {
in
while ($this->_currentUrl && !isset($this->_urlMap[strtolower($this->_currentUrl)])) {
and line 479
$this->_urlMap[$url] = $path;

if ($url == $this->_currentUrl) {
return true;
}
in
$this->_urlMap[strtolower($url)] = $path;

if ($url == strtolower($this->_currentUrl)) {
return true;
}
Best Regards,

[2006-01-02 15:39 UTC] benjamin dot taieb at bnpparibas dot com

In fact, correct workaround is also to modify _findNodeType
from
if ($this->_currentUrl == $nodeUrl) {
to
if (strtolower($this->_currentUrl) == strtolower($nodeUrl)) {
AND also line 462 in getPath routine
from
return isset($this->_urlMap[$this->_currentUrl])? $this->_urlMap[$this->_currentUrl]: array();
to
return isset($this->_urlMap[strtolower($this->_currentUrl)])? $this->_urlMap[strtolower($this->_currentUrl)]: array();

AND
modify the workaround for line 481
from
if ($url == $this->_currentUrl) {
to
if (strtolower($url) == strtolower($this->_currentUrl)) {

Hope it's help somebody....