Skip to content

Commit 8d47686

Browse files
committed
Artificially enforce instantiated classes to implement
1 parent 1755df7 commit 8d47686

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

classes/Kohana/Encrypt.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ public static function factory($name = NULL)
6363
// Add the "Encrypt" prefix
6464
$class = 'Encrypt_'.ucfirst($driver);
6565

66+
// Create a new instance and make sure it's Kohana_Crypto
67+
$encrypt = new $class($settings);
68+
if ( ! $encrypt instanceof Kohana_Crypto )
69+
{
70+
throw new Kohana_Exception('Encryption class should implement `Kohana_Crypto` interface');
71+
}
6672
// Create a new instance
67-
return new $class($settings);
73+
return $encrypt;
6874
}
6975
}

0 commit comments

Comments
 (0)