Skip to content

Commit

Permalink
Throwing exception when headers is not an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Apr 13, 2011
1 parent 77941fb commit a920922
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Error/exceptions.php
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/Network/CakeEmail.php
Expand Up @@ -231,6 +231,9 @@ public function __construct() {
* @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));
}
Expand Down

0 comments on commit a920922

Please sign in to comment.