From:             judas dot iscariote at gmail dot com
Operating system: linux 64 bit
PHP version:      5CVS-2007-04-04 (CVS)
PHP Bug Type:     Streams related
Bug description:  stream_socket_accept(): accept failed: **Success**

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 ===

-- 
Edit bug report at http://bugs.php.net/?id=40993&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40993&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40993&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40993&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40993&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40993&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40993&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40993&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40993&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40993&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40993&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40993&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40993&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40993&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40993&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40993&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40993&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40993&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40993&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40993&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40993&r=mysqlcfg

Reply via email to