Skip to content

Commit

Permalink
Added error checking for lack of SSL availability
Browse files Browse the repository at this point in the history
  • Loading branch information
elazar committed Feb 6, 2010
1 parent 2e72ef4 commit 5f45930
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Phergie/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ public function setSsl($ssl)
{
$this->ssl = (bool) $ssl;

if ($this->ssl && !in_array('ssl', stream_get_transports())) {
throw new Phergie_Connection_Exception(
'SSL is not supported by the PHP installation in use',
Phergie_Connection_Exception::SSL_NOT_SUPPORTED
);
}

return $this;
}

Expand Down
8 changes: 8 additions & 0 deletions Phergie/Connection/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ class Phergie_Connection_Exception extends Phergie_Exception
* @const int
*/
const ERR_REQUIRED_SETTING_MISSING = 1;

/**
* Error indicating that a connection is configured to use SSL, but SSL
* is not supported by the current PHP installation
*
* @const int
*/
const ERR_SSL_NOT_SUPPORTED = 2;
}

0 comments on commit 5f45930

Please sign in to comment.