Skip to content
This repository has been archived by the owner on Mar 27, 2018. It is now read-only.

Commit

Permalink
Fix a BC break!
Browse files Browse the repository at this point in the history
If we autoload a “short”-entityname, we switch to the “full”-entityname,
as dnew() already does and as we did before (again, for BC).
Thanks @stephpy and @shouze!
  • Loading branch information
Hywan committed Oct 15, 2013
1 parent 6585966 commit 7f9ef90
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Consistency.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,16 @@ public static function autoload ( $classname ) {

$head = substr($classname, 0, strpos($classname, '\\'));

if(false === array_key_exists($classname, static::$_class))
return from($head)->_import(str_replace('\\', '.', $classname), true);
if(false === array_key_exists($classname, static::$_class)) {

$_classname = str_replace('\\', '.', $classname);
$out = from($head)->_import($_classname, true);

if(false === static::entityExists($classname))
$out = from($head)->_import($_classname . '.~', true);

return $out;
}
elseif(is_string($original = static::$_class[$classname])) {

spl_autoload_call($original);
Expand Down

0 comments on commit 7f9ef90

Please sign in to comment.