Permalink
Browse files

Remove the @fopen hack since we're no longer using include path. Impr…

…ove error messages and version notice. Prep for 0.2.3 release.
  • Loading branch information...
1 parent e9f3022 commit 549109b09114aa216bdb64e2cab4ba1d2a3a334d @saltybeagle saltybeagle committed Jan 8, 2011
Showing with 25 additions and 20 deletions.
  1. +4 −0 RELEASE-0.2.3
  2. +7 −6 package.xml
  3. +7 −6 package_compatible.xml
  4. +7 −8 src/Autoload.php
View
@@ -0,0 +1,4 @@
+Minor Bugfixes:
+
+ - Remove use of @fopen hack [saltybeagle]
+ - Improve error messages [saltybeagle]
View
@@ -27,21 +27,22 @@ require '/path/to/PEAR2/Autoload.php';
<email>saltybeagle@php.net</email>
<active>yes</active>
</lead>
- <date>2010-09-21</date>
- <time>22:37:42</time>
+ <date>2011-01-08</date>
+ <time>14:03:05</time>
<version>
- <release>0.2.2</release>
+ <release>0.2.3</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
- <notes>Remove the dependency on include_path for the following reasons:
+ <notes>Minor Bugfixes:
-1. Speed.
-2. The include_path can be externally modified which can cause files that exist to not be loaded.</notes>
+ - Remove use of @fopen hack [saltybeagle]
+ - Improve error messages [saltybeagle]
+</notes>
<contents>
<dir name="/">
<dir name="src" baseinstalldir="PEAR2">
View
@@ -27,21 +27,22 @@ require '/path/to/PEAR2/Autoload.php';
<email>saltybeagle@php.net</email>
<active>yes</active>
</lead>
- <date>2010-09-21</date>
- <time>22:37:42</time>
+ <date>2011-01-08</date>
+ <time>14:03:05</time>
<version>
- <release>0.2.2</release>
+ <release>0.2.3</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
- <notes>Remove the dependency on include_path for the following reasons:
+ <notes>Minor Bugfixes:
-1. Speed.
-2. The include_path can be externally modified which can cause files that exist to not be loaded.</notes>
+ - Remove use of @fopen hack [saltybeagle]
+ - Improve error messages [saltybeagle]
+</notes>
<contents>
<dir name="/">
<file role="php" name="php/PEAR2/Autoload.php"/>
View
@@ -76,23 +76,22 @@ static function load($class)
if (strtolower(substr($class, 0, 6)) !== 'pear2\\') {
return false;
}
+ $file = str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $class) . '.php';
foreach (self::$paths as $path) {
- $file = str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $class) . '.php';
- $fp = @fopen($path . DIRECTORY_SEPARATOR . $file, 'r', true);
- if ($fp) {
- fclose($fp);
+ if (file_exists($path . DIRECTORY_SEPARATOR . $file)) {
require $path . DIRECTORY_SEPARATOR . $file;
if (!class_exists($class, false) && !interface_exists($class, false)) {
die(new \Exception('Class ' . $class . ' was not present in ' .
- $file . ' (include_path="' . get_include_path() .
- '") [PEAR2_Autoload version 1.1]'));
+ $path . DIRECTORY_SEPARATOR . $file .
+ '") [PEAR2_Autoload-@PACKAGE_VERSION@]'));
}
return true;
}
}
$e = new \Exception('Class ' . $class . ' could not be loaded from ' .
- $file . ', file does not exist (include_path="' . get_include_path() .
- '") [PEAR2_Autoload version 1.1]');
+ $file . ', file does not exist (registered paths="' .
+ implode(PATH_SEPARATOR, self::$paths) .
+ '") [PEAR2_Autoload-@PACKAGE_VERSION@]');
$trace = $e->getTrace();
if (isset($trace[2]) && isset($trace[2]['function']) &&
in_array($trace[2]['function'], array('class_exists', 'interface_exists'))) {

0 comments on commit 549109b

Please sign in to comment.