svn: /pear2/Autoload/trunk/ RELEASE-0.2.3 package.xml package_compatible.xml src/Autoload.php

[email protected] (Brett Bieber) Sat, 08 Jan 2011 20:16:50 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
saltybeagle                              Sat, 08 Jan 2011 20:16:50 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307286

Log:
Remove the @fopen hack since we're no longer using include path. Improve error messages and version notice. Prep for 0.2.3 release.

Changed paths:
    A   pear2/Autoload/trunk/RELEASE-0.2.3
    U   pear2/Autoload/trunk/package.xml
    U   pear2/Autoload/trunk/package_compatible.xml
    U   pear2/Autoload/trunk/src/Autoload.php

Added: pear2/Autoload/trunk/RELEASE-0.2.3
===================================================================
--- pear2/Autoload/trunk/RELEASE-0.2.3	                        (rev 0)
+++ pear2/Autoload/trunk/RELEASE-0.2.3	2011-01-08 20:16:50 UTC (rev 307286)
@@ -0,0 +1,4 @@
+Minor Bugfixes:
+
+ - Remove use of @fopen hack [saltybeagle]
+ - Improve error messages [saltybeagle]

Modified: pear2/Autoload/trunk/package.xml
===================================================================
--- pear2/Autoload/trunk/package.xml	2011-01-08 19:20:36 UTC (rev 307285)
+++ pear2/Autoload/trunk/package.xml	2011-01-08 20:16:50 UTC (rev 307286)
@@ -27,10 +27,10 @@
   <email>[email protected]</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>
@@ -38,10 +38,11 @@
   <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">

Modified: pear2/Autoload/trunk/package_compatible.xml
===================================================================
--- pear2/Autoload/trunk/package_compatible.xml	2011-01-08 19:20:36 UTC (rev 307285)
+++ pear2/Autoload/trunk/package_compatible.xml	2011-01-08 20:16:50 UTC (rev 307286)
@@ -27,10 +27,10 @@
   <email>[email protected]</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>
@@ -38,10 +38,11 @@
   <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"/>

Modified: pear2/Autoload/trunk/src/Autoload.php
===================================================================
--- pear2/Autoload/trunk/src/Autoload.php	2011-01-08 19:20:36 UTC (rev 307285)
+++ pear2/Autoload/trunk/src/Autoload.php	2011-01-08 20:16:50 UTC (rev 307286)
@@ -76,23 +76,22 @@
             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'))) {