@@ -3,14 +3,51 @@ Bug #62890 (default_socket_timeout=-1 causes connection to timeout)
3
3
--SKIPIF--
4
4
<?php
5
5
if (!extension_loaded ('openssl ' )) die ('skip openssl extension not available ' );
6
- if (getenv ( ' SKIP_ONLINE_TESTS ' )) die (' skip online test ' );
6
+ if (! function_exists ( " proc_open " )) die (" skip no proc_open " );
7
7
?>
8
8
--INI--
9
9
default_socket_timeout=-1
10
10
--FILE--
11
11
<?php
12
- $ clientCtx = stream_context_create (['ssl ' => ['verify_peer ' => false ]]);
13
- var_dump ((bool ) file_get_contents ('https://www.php.net ' , false , $ clientCtx ));
12
+ $ certFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug62890.pem.tmp ' ;
13
+
14
+ $ serverCode = <<<'CODE'
15
+ $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
16
+ $ctx = stream_context_create(['ssl' => [
17
+ 'local_cert' => '%s',
18
+ 'security_level' => 1,
19
+ ]]);
20
+
21
+ $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
22
+ phpt_notify();
23
+ @stream_socket_accept($server, 3);
24
+ CODE;
25
+ $ serverCode = sprintf ($ serverCode , $ certFile );
26
+
27
+ $ clientCode = <<<'CODE'
28
+ $flags = STREAM_CLIENT_CONNECT;
29
+ $ctx = stream_context_create(['ssl' => [
30
+ 'verify_peer' => false,
31
+ 'verify_peer_name' => false,
32
+ 'security_level' => 1,
33
+ ]]);
34
+
35
+ phpt_wait();
36
+
37
+ $client = stream_socket_client("tls://127.0.0.1:64321", $errno, $errstr, 3, $flags, $ctx);
38
+ var_dump($client);
39
+ CODE;
40
+
41
+ include 'CertificateGenerator.inc ' ;
42
+ $ certificateGenerator = new CertificateGenerator ();
43
+ $ certificateGenerator ->saveNewCertAsFileWithKey ('bug62890 ' , $ certFile );
44
+
45
+ include 'ServerClientTestCase.inc ' ;
46
+ ServerClientTestCase::getInstance ()->run ($ clientCode , $ serverCode );
14
47
?>
15
- --EXPECT--
16
- bool(true)
48
+ --CLEAN--
49
+ <?php
50
+ @unlink (__DIR__ . DIRECTORY_SEPARATOR . 'bug62890.pem.tmp ' );
51
+ ?>
52
+ --EXPECTF--
53
+ resource(%d) of type (stream)
0 commit comments