#45130 [Opn]: Contradictory error message (failed to open stream: Success)
| From: | jani@php.net | Date: | Tue, 15 Jul 2008 13:07:20 +0000 |
| Subject: | #45130 [Opn]: Contradictory error message (failed to open stream: Success) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126764@lists.php.net to get a copy of this message | ||
ID: 45130
Updated by: jani@php.net
Reported By: php at tmcode dot com
Status: Open
Bug Type: Streams related
Operating System: Linux
PHP Version: 5.2.6
New Comment:
The problem is that the underlying wrapper code emits more than one
error (warning) in this case:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL
Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate
verify failed in /home/jani/t.php on line 10
Warning: file_get_contents(): Failed to enable crypto in
/home/jani/t.php on line 10
Warning: file_get_contents(https://google.com): failed to open stream:
Success in /home/jani/t.php on line 10
Of course those last 2 are kinda useless.
Previous Comments:
------------------------------------------------------------------------
[2008-05-29 22:12:37] php at tmcode dot com
Description:
------------
Similar to bug #39850. The last warning returned by file_get_contents,
fopen, etc when a SSL error is encountered contains the word "Success".
Reproduce code:
---------------
// verify_peer=true with https://google.com
// to force a hostname mismatch error
$options = array(
'ssl' => array(
'verify_peer' => true,
'allow_self_signed' => false
)
);
$context = stream_context_create($options);
$res=file_get_contents('https://google.com',null, $context);
$error = error_get_last();
echo $error['message'];
Expected result:
----------------
$error['message'] to include something other than the word "success"
Actual result:
--------------
file_get_contents(https://google.com): failed to open stream: Success
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45130&edit=1