Throwing exception when headers is not an array.

This commit is contained in:
Juan Basso 2011-02-27 15:57:04 -03:00
parent 77941fb1fb
commit a92092231c
2 changed files with 5 additions and 2 deletions

View file

@ -459,8 +459,8 @@ class CakeSessionException extends CakeException { }
class ConfigureException extends CakeException { }
/**
* Exception class for Socket. This exception will be thrown from CakeSocket, HttpSocket and HttpResponse when it
* encounters an error.
* Exception class for Socket. This exception will be thrown from CakeSocket, CakeEmail, HttpSocket
* and HttpResponse when it encounters an error.
*
* @package cake.libs
*/

View file

@ -231,6 +231,9 @@ class CakeEmail {
* @return void
*/
public function header($headers) {
if (!is_array($headers)) {
throw new SocketException(__('$headers should be an array.'));
}
foreach ($headers as $header => $value) {
$this->_header[] = sprintf('%s: %s', trim($header), trim($value));
}