Bug #5702

PHP warning when openssl module not installed

Submitted:
2013-02-01 21:29:23 By: iandunn
Browsers:
firefox msie safari chrome opera
Open Priority: 3 Resolution: None Assigned to: None
Description of problem:

The call to fsockopen() in GoogleSpell::_getMatches() doesn't check if the openssl module is available before trying to use it. If it isn't installed PHP will display a warning like this:

Error response: <br />
<b>Warning</b>: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://www.google.com:443 (Unable to find the socket transport &quot;ssl&quot; - did you forget to enable it when you configured PHP?) in <b>D:\wamp\www\wp342\wp-includes\js\tinymce\plugins\spellchecker\classes\GoogleSpell.php</b> on line <b>86</b><br /> Could not open SSL connection to google.{"id":null,"result":[],"error":null}


It should be simple to fix with something like this:
if( in_array( 'openssl', apache_get_modules() ) {
// fsockopen() ...
}
else {
echo 'OpenSSL module not available';
}

 

If you wish to follow or post a comment, you need to be registered and logged in.