Fix for bug #23954
| From: | Martin Jansen | Date: | Sun, 22 Jun 2003 15:48:43 +0000 |
| Subject: | Fix for bug #23954 | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-17615@lists.php.net to get a copy of this message | ||
Hi,
attached you'll find a patch for bug #23954. Comments?
--
- Martin Martin Jansen
http://martinjansen.com/
Index: Registry.php =================================================================== RCS file: /repository/php4/pear/PEAR/Registry.php,v retrieving revision 1.41 diff -u -r1.41 Registry.php --- Registry.php 10 Jun 2003 20:03:43 -0000 1.41 +++ Registry.php 22 Jun 2003 15:42:08 -0000 @@ -155,7 +155,23 @@ */ function _packageFileName($package) { - return "{$this->statedir}/{$package}.reg"; + if (is_file("{$this->statedir}/{$package}.reg")) { + return "{$this->statedir}/{$package}.reg"; + } + /** + * Iterate through the directory to find the matching + * registry file, even if it has been provided in + * another case (foobar vs. FooBar) + */ + $package = strtolower($package); + if ($handle = opendir($this->statedir)) { + while (false !== ($file = readdir($handle))) { + if (strtolower($file) == $package . ".reg") { + return "{$this->statedir}/{$file}"; + } + } + closedir($handle); + } } // }}}
Index: Registry.php =================================================================== RCS file: /repository/php4/pear/PEAR/Registry.php,v retrieving revision 1.41 diff -u -r1.41 Registry.php --- Registry.php 10 Jun 2003 20:03:43 -0000 1.41 +++ Registry.php 22 Jun 2003 15:42:08 -0000 @@ -155,7 +155,23 @@ */ function _packageFileName($package) { - return "{$this->statedir}/{$package}.reg"; + if (is_file("{$this->statedir}/{$package}.reg")) { + return "{$this->statedir}/{$package}.reg"; + } + /** + * Iterate through the directory to find the matching + * registry file, even if it has been provided in + * another case (foobar vs. FooBar) + */ + $package = strtolower($package); + if ($handle = opendir($this->statedir)) { + while (false !== ($file = readdir($handle))) { + if (strtolower($file) == $package . ".reg") { + return "{$this->statedir}/{$file}"; + } + } + closedir($handle); + } } // }}}