PHP  
 PHP_7_0
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/standard/tests/streams/bug70198.phpt ('Bug #70198 Checking liveness does not work as expected')

Script

1: <?php
2:
3:
/* What is checked here is 
4:     - start a server and listen
5:     - as soon as client connects, close connection and exit
6:     - on the client side - sleep(1) and check feof()
7: */
8:
9:
$srv_addr "tcp://127.0.0.1:8964";
10:
$srv_fl dirname(__FILE__) . "/bug70198_svr_" md5(uniqid()) . ".php";
11:
$srv_fl_cont = <<<SRV
12:
<?php
13: \$socket = stream_socket_server('
$srv_addr', \$errno, \$errstr);
14:
15: if (!\$socket) {
16:     echo "\$errstr (\$errno)\\n";
17: } else {
18:     if (\$conn = stream_socket_accept(\$socket, 3)) {
19:         sleep(1);
20:         /* just close the connection immediately after accepting,
21:             the client side will need wait a bit longer to realize it.*/
22:         fclose(\$conn);
23:     }
24:     fclose(\$socket);
25: }
26:
SRV;
27:
file_put_contents($srv_fl$srv_fl_cont);
28:
$dummy0 $dummy1 = array();
29:
$srv_proc proc_open(PHP_BINARY " -n $srv_fl"$dummy0$dummy1);
30:
31:
$i 0;
32:
/* wait a bit for the server startup */
33:
sleep(1);
34:
$fp stream_socket_client($srv_addr$errno$errstr2);
35: if (!
$fp) {
36:     echo 
"$errstr ($errno)\n";
37: } else {
38:     
stream_set_blocking($fp0);
39:     
sleep(2);
40:     while (!
feof($fp)) {
41:         ++
$i;
42:     }
43:     
fclose($fp);
44:     
var_dump($i);
45: }
46:
47:
proc_close($srv_proc);
48:
unlink($srv_fl);
49:
?>
50:
==DONE==
51:

Expected

int(0)
==DONE==

Output

Warning: stream_socket_client(): unable to connect to tcp://127.0.0.1:8964 (Connection refused) in /var/php_gcov/PHP_7_0/ext/standard/tests/streams/bug70198.php on line 34
Connection refused (111)

Warning: stream_socket_accept(): accept failed: Connection timed out in /var/php_gcov/PHP_7_0/ext/standard/tests/streams/bug70198_svr_9cca90f34f0b06591a1dfc402b6087bb.php on line 7
==DONE==

Diff

001+ Warning: stream_socket_client(): unable to connect to tcp://127.0.0.1:8964 (Connection refused) in /var/php_gcov/PHP_7_0/ext/standard/tests/streams/bug70198.php on line 34
002+ Connection refused (111)
003+ 
004+ Warning: stream_socket_accept(): accept failed: Connection timed out in /var/php_gcov/PHP_7_0/ext/standard/tests/streams/bug70198_svr_9cca90f34f0b06591a1dfc402b6087bb.php on line 7
001- int(0)

 

Generated at Wed, 20 Sep 2017 13:49:37 +0000 (2 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.