Author: Derick Rethans
Date: 2007-01-10 17:13:06 +0100 (Wed, 10 Jan 2007)
New Revision: 4487

Log:
- Implemented issue #9569: Add "autoload.php" as 3rd fallback autoload file to
  search for.

Modified:
   trunk/Base/ChangeLog
   trunk/Base/src/base.php
   trunk/Base/src/exceptions/autoload.php
   trunk/Base/tests/base_test.php

Modified: trunk/Base/ChangeLog
===================================================================
--- trunk/Base/ChangeLog        2007-01-10 15:49:29 UTC (rev 4486)
+++ trunk/Base/ChangeLog        2007-01-10 16:13:06 UTC (rev 4487)
@@ -1,6 +1,8 @@
 1.3beta1 - [RELEASEDATE]
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+- Implemented issue #9569: Add "autoload.php" as 3rd fallback autoload file to
+  search for.
 - Added exception class ezcBaseExtensionNotFoundException to be thrown when an
   extension is required but is not found.
 

Modified: trunk/Base/src/base.php
===================================================================
--- trunk/Base/src/base.php     2007-01-10 15:49:29 UTC (rev 4486)
+++ trunk/Base/src/base.php     2007-01-10 16:13:06 UTC (rev 4487)
@@ -120,6 +120,7 @@
             switch ( sizeof( $matches ) )
             {
                 case 4:
+                    // check for x_y_autoload.php
                     $autoloadFile = strtolower( 
"{$matches[2]}_{$matches[3]}_autoload.php" );
                     $fileNames[] = $autoloadFile;
                     if ( ezcBase::requireFile( $autoloadFile, $className, 
$matches[1] ) )
@@ -129,12 +130,21 @@
                     // break intentionally missing.
 
                 case 3:
+                    // check for x_autoload.php
                     $autoloadFile = strtolower( "{$matches[2]}_autoload.php" );
                     $fileNames[] = $autoloadFile;
                     if ( ezcBase::requireFile( $autoloadFile, $className, 
$matches[1] ) )
                     {
                         return true;
                     }
+
+                    // check for autoload.php
+                    $autoloadFile = 'autoload.php';
+                    $fileNames[] = $autoloadFile;
+                    if ( ezcBase::requireFile( $autoloadFile, $className, 
$matches[1] ) )
+                    {
+                        return true;
+                    }
                     break;
             }
 

Modified: trunk/Base/src/exceptions/autoload.php
===================================================================
--- trunk/Base/src/exceptions/autoload.php      2007-01-10 15:49:29 UTC (rev 
4486)
+++ trunk/Base/src/exceptions/autoload.php      2007-01-10 16:13:06 UTC (rev 
4487)
@@ -28,7 +28,7 @@
         {
             $paths[] = realpath( $dir[1] );
         }
-        parent::__construct( "Could not find a class to file mapping for 
'{$className}'. Searched for ". implode( ' and ', $files ) . " in: " . implode( 
', ', $paths ) );
+        parent::__construct( "Could not find a class to file mapping for 
'{$className}'. Searched for ". implode( ', ', $files ) . " in: " . implode( ', 
', $paths ) );
     }
 }
 ?>

Modified: trunk/Base/tests/base_test.php
===================================================================
--- trunk/Base/tests/base_test.php      2007-01-10 15:49:29 UTC (rev 4486)
+++ trunk/Base/tests/base_test.php      2007-01-10 16:13:06 UTC (rev 4487)
@@ -349,7 +349,7 @@
         catch ( ezcBaseAutoloadException $e )
         {
             $cwd = getcwd();
-            self::assertEquals( "Could not find a class to file mapping for 
'trBasetestClass3'. Searched for basetest_class3_autoload.php and 
basetest_autoload.php in: $cwd/autoload, $cwd/autoload, $cwd/autoload, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files", $e->getMessage() );
+            self::assertEquals( "Could not find a class to file mapping for 
'trBasetestClass3'. Searched for basetest_class3_autoload.php, 
basetest_autoload.php, autoload.php in: $cwd/autoload, $cwd/autoload, 
$cwd/autoload, $cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files", $e->getMessage() );
         }
 
         self::assertEquals( true, class_exists( 'trBasetestLongClass', true ) 
);
@@ -427,7 +427,7 @@
         catch ( ezcBaseAutoloadException $e )
         {
             $cwd = getcwd();
-            self::assertEquals( "Could not find a class to file mapping for 
'ezcNoSuchClass'. Searched for no_such_autoload.php and no_autoload.php in: 
$cwd/autoload, $cwd/autoload, $cwd/autoload, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/extra_repository/autoload, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files", $e->getMessage() );
+            self::assertEquals( "Could not find a class to file mapping for 
'ezcNoSuchClass'. Searched for no_such_autoload.php, no_autoload.php, 
autoload.php in: $cwd/autoload, $cwd/autoload, $cwd/autoload, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/extra_repository/autoload, 
$cwd/Base/tests/test_repository/autoload_files, 
$cwd/Base/tests/test_repository/autoload_files", $e->getMessage() );
         }
     }
 

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to