Bug #19351 [Fbk]: stream_socket_client

From: Date: Mon, 26 Mar 2012 18:23:43 +0000
Subject: Bug #19351 [Fbk]: stream_socket_client
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8453@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19351&edit=1 ID: 19351 Updated by: borz_off@cs.msu.su Reported By: till at php dot net Summary: stream_socket_client Status: Feedback Type: Bug Package: HTTP_Request2 Package Version: 2.0.0 PHP Version: 5.3.8 Roadmap Versions: New Comment: I see creation of $ctx in your code, but I don't see it being used in stream_socket_client() call. Previous Comments: ------------------------------------------------------------------------ [2012-03-26 19:14:56] till OK, trunk is very verbose! I like that! I checked out HTTP_Request2-trunk into my vendor dir and prepended it to the include_path. This is the output: Fatal error: Uncaught HTTP_Request2_ConnectionException: Unable to connect to ssl://metrics-api.librato.com:443. Error: stream_socket_client(): unable to connect to ssl://metrics-api.librato.com:443 (Unknown error) stream_socket_client(): Failed to enable crypto stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /path/vendor/HTTP_Request2/HTTP/Request2/Adapter/Socket.php on line 163 #0 /path/vendor/HTTP_Request2/HTTP/Request2/Adapter/Socket.php(163): HTTP_Request2_Adapter_Socket->connect() #1 /path/vendor/HTTP_Request2/HTTP/Request2.php(943): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2)) #2 /path/test.php(27): HTTP_Request2->send() #3 {main} thrown in /path/vendor/HTTP_Request2/HTTP/Request2/Adapter/Socket.php on line 337 Any idea which opens cause this to fail from within HTTP_Request2 when my simple stream_socket_client() which verifies as well doesn't error? ------------------------------------------------------------------------ [2012-03-26 18:59:58] till I'll check out trunk in the meantime. ------------------------------------------------------------------------ [2012-03-26 18:59:19] till I think my previous comment made no sense since the wrapper is 'ssl://' not 'https://', my mistake, but I'm still debugging the issue: My remote is: https://metrics-api.librato.com/ In HTTP_Request2, this is turned into this: 'ssl://metrics-api.librato.com:443'. I came up with this test script: <?php $ctx = stream_context_create(array( 'http' => array( 'ignore_errors' => true, ), 'ssl' => array( 'CN_match' => "metrics-api.librato.com", 'verify_peer' => true, ), )); $remote = 'ssl://metrics-api.librato.com:443'; ini_set('track_errors', 1); $socket = stream_socket_client($remote, $errno, $errstr, 2); var_dump($socket); var_dump($errno, $errstr); if (isset($php_errormsg)) { var_dump($php_errormsg); } This seems to set the same SSL-options HTTP_Request2 sets, but with HTTP_Request2 I get an "unknown error" which I cannot reproduce with this script. Do you have any idea how I could debug this further? ------------------------------------------------------------------------ [2012-03-26 18:47:49] avb -Status: Open +Status: Feedback Can you please test with current SVN version? Fix for bug #19337 should have addressed this, exception message should now contain all warnings produced by stream_socket_client() (there may be several). ------------------------------------------------------------------------ [2012-03-26 18:45:02] till Description: ------------ Hi, I ran into another issue – basically, I'm connecting with HTTP_Request2 to a remote ssl-server. The exception contains "unknown error" (Line 324, in the socket adapeter). When I execute the code in a test-script, I get the following error instead: int(-1138572888) string(98) "Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?" ($errno and $errstr from stream_socket_client, dumped). So the error is a configuration issue, but what I mean is: Could the correct error message be exposed with HTTP_Request2? Would save some time debugging. ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19351&edit=1

« previous php.pear.bugs (#8453) next »