Skip to content
Permalink
Browse files

Fixing the result of App::import() when name of class have slash.

  • Loading branch information...
jrbasso committed Nov 30, 2010
1 parent 40585a3 commit ffaec10a7c1a1cb50eddbdaebd5c471946360ee3
Showing with 9 additions and 1 deletion.
  1. +5 −1 cake/libs/app.php
  2. +4 −0 cake/tests/cases/libs/app.test.php
@@ -505,7 +505,11 @@ public static function import($type = null, $name = null, $parent = true, $searc
$file = Inflector::underscore($name) . ".{$ext}";
}
$ext = self::__settings($type, $plugin, $parent);
if ($name != null && !class_exists($name . $ext['class'])) {
$className = $name;
if (strpos($className, '/') !== false) {
$className = substr($className, strrpos($className, '/') + 1);
}
if ($name != null && !class_exists($className . $ext['class'])) {
if ($load = self::__mapped($name . $ext['class'], $type, $plugin)) {
if (self::__load($load)) {
if (self::$return) {
@@ -211,6 +211,10 @@ function testClassLoading() {
$this->assertTrue($file);
$this->assertTrue(class_exists('Shell'));
$file = App::import('Lib', 'cache/Apc');
$this->assertTrue($file);
$this->assertTrue(class_exists('ApcEngine'));
$file = App::import('Model', 'SomeRandomModelThatDoesNotExist', false);
$this->assertFalse($file);

0 comments on commit ffaec10

Please sign in to comment.
You can’t perform that action at this time.