From:             judas dot iscariote at gmail dot com
Operating system: linux 32/64bit, Win32 
PHP version:      5CVS-2007-04-30 (CVS)
PHP Bug Type:     Streams related
Bug description:  regression with SSL connections since fix for #39571

Description:
------------
Since PHP 5.2.1, our application that has jabber stopped working.all
previuos PHP version works fine, this regression is caused by the fix for
bug  #39571,reverting xp_ssl.c to the version shipped with 5.2.0 solves the
problem.

Reproduce code:
---------------
./configure --with-openssl 

<?php

error_reporting(E_ALL);

$j = fsockopen('ssl://jabber.org', 5223,  $errorno, $errorstr, 10);

socket_set_blocking($j, 0);
socket_set_timeout($j, 5);

fwrite($j,"<?xml version='1.0' encoding='UTF-8' ?>");
fwrite($j, "<stream:stream to='jabber.org' xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>");

$data = '';
// Wait for a response until timeout is reached
$start = time();
$data = '';
$timeout = 10;
$wait = false;

do {
    $read = trim(fread($j, 4096));
    $data .= $read;

// ok.. this check aint part of the original code
// that breaks,but check if we timed out of reached eof..anyway..
$foo = stream_get_meta_data($j);
if(feof($j) || $foo['timed_out'] || $foo['eof']) break;

// yeah, we know aint nice, but works in **any** other PHP version.
} while (time() <= $start + $timeout && ($wait || $data == '' || $read !=
'' || (substr(rtrim($data), -1) != '>')));

fclose($j);

var_dump($data);

?>

Expected result:
----------------
response from the server var_dump'ed as in (all) previous versions

Actual result:
--------------
Fatal error: Maximum execution time of **30** seconds exceeded...an xdebug
session reveals that the script hang, in a **single** fread() call

an strace shows something hangs permanently with EAGAIN signal.. (probably
the loop in xp_ssl.c from line 398 to 410), note that checking if has
reached EOF or if the stream times out does not help either.



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

Reply via email to