ID: 41236
Updated by: [EMAIL PROTECTED]
Reported By: judas dot iscariote at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Streams related
Operating System: linux 32/64bit, Win32
PHP Version: 5CVS-2007-04-30 (CVS)
-Assigned To:
+Assigned To: iliaa
Previous Comments:
------------------------------------------------------------------------
[2007-04-30 07:20:11] judas dot iscariote at gmail dot com
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 this bug report at http://bugs.php.net/?id=41236&edit=1