php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45130 Contradictory error message (failed to open stream: Success)
Submitted: 2008-05-29 22:12 UTC Modified: 2008-07-15 16:12 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: php at tmcode dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at tmcode dot com
New email:
PHP Version: OS:

 

 [2008-05-29 22:12 UTC] 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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-15 13:07 UTC] jani@php.net
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.
 [2008-07-15 16:12 UTC] jani@php.net
The error is now "fixed", you will get this now:

string(78) "file_get_contents(https://google.com): failed to open stream: operation failed"

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC