php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40993 stream_socket_accept(): accept failed: **Success**
Submitted: 2007-04-04 10:23 UTC Modified: 2007-04-12 01:00 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:3 of 5 (60.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: judas dot iscariote at gmail dot com Assigned:
Status: No Feedback Package: Streams related
PHP Version: 5CVS-2007-04-04 (CVS) OS: linux 64 bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: judas dot iscariote at gmail dot com
New email:
PHP Version: OS:

 

 [2007-04-04 10:23 UTC] judas dot iscariote at gmail dot com
Description:
------------
Weird/contradictory error messages and memory leaks from an openssl enabled stream.

Reproduce code:
---------------
//example from the manual.

<?php

$socket = stream_socket_server("tls://0.0.0.0:8000", $errno, $errstr);
if (!$socket) {
  echo "$errstr ($errno)<br />\n";
} else {

  while ($conn = stream_socket_accept($socket)) {
    fwrite($conn, 'The local time is ' . date('n/j/Y g:i a') . "\n");
    fclose($conn);
  }
  fclose($socket);
}
?>

execute if from CLI and load point  your browser to 127.0.0.1:8000 ( in my case, firefox)

Expected result:
----------------
1. No contrictory message 

stream_socket_accept(): accept failed: **Success** ( oh well,faliure or success ?? :-) )

2. no memory leak.

Actual result:
--------------
PHP Warning:  stream_socket_accept(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:func(143):reason(267) in /home/cristian/sock.php on line 8

Warning: stream_socket_accept(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:func(143):reason(267) in /home/cristian/sock.php on line 8
PHP Warning:  stream_socket_accept(): Failed to enable crypto in /home/cristian/sock.php on line 8

Warning: stream_socket_accept(): Failed to enable crypto in /home/cristian/sock.php on line 8
PHP Warning:  stream_socket_accept(): accept failed: Success in /home/cristian/sock.php on line 8

Warning: stream_socket_accept(): accept failed: Success in /home/cristian/sock.php on line 8

[Wed Apr  4 06:19:34 2007]  Script:  'sock.php'
/home/cristian/php5/ext/openssl/xp_ssl.c(157) :  Freeing 0x00C2D5C0 (50 bytes), script=sock.php
=== Total 1 memory leaks detected ===

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-04 10:51 UTC] tony2001@php.net
I fixed the leak, but I believe the message is correct:
SSL operation failed, but network operation succeeded (i.e. it accepted the connection, but the data is invalid).
At least that's how I read it.
 [2007-04-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC