php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62960 non block stream does not work with ssl
Submitted: 2012-08-28 19:07 UTC Modified: -
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jim dot javathunderbird at gmail dot com Assigned:
Status: Open Package: Streams related
PHP Version: 5.4.6 OS: CentOS 64 bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-08-28 19:07 UTC] jim dot javathunderbird at gmail dot com
Description:
------------
When using stream_socket_server with non blocking stream, there seems to have no way to write buffer to client. When the stream is in blocking mode, things start working again.

Test script:
---------------
<?php
$protocol = "ssl";
$ip = "127.0.0.1";
$port = 8000;
$context = stream_context_create();
$certificate = __DIR__."/certificate_concat.pem";
stream_context_set_option($context, 'ssl', 'local_cert', $certificate);
stream_context_set_option($context, 'ssl', 'verify_peer', false);
$server = stream_socket_server("$protocol://$ip:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
stream_set_blocking($server, 0); //when set to non blocking, ssl will not work, if set to blocking, things start working again
while(true)
{
  $client = stream_socket_accept($server);
  print "accepted " . stream_socket_get_name( $client, true) . "\n";
  if( $client )
  {
    fwrite($client, "hello");
  } else {
    print "error.\n";
  }
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-03 10:24 UTC] heruan at aldu dot net
No one has ever given a feedback to this bug. It still affects PHP 5.5.9, any chance to get this fixed in 5.6?
 [2014-04-03 10:58 UTC] heruan at aldu dot net
Note that *writing* to the encrypted stream seems working, it's *reading* that won't work and it is reported on #65137.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 03:01:25 2019 UTC