xref: /PHP-7.0/ext/openssl/tests/bug65538_002.phpt (revision df135ffa)
1--TEST--
2Bug #65538: SSL context "cafile" disallows URL stream wrappers
3--SKIPIF--
4<?php
5if (!extension_loaded('openssl')) die('skip, openssl required');
6if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
7?>
8--FILE--
9<?php
10$clientCtx = stream_context_create(['ssl' => [
11	// We don't get any ca list from php.net but it does not matter as we
12	// care about the fact that the external stream is not allowed.
13	// We can't use http://curl.haxx.se/ca/cacert.pem for this test
14	// as it is redirected to https which means the test would depend
15	// on system cafile when opening stream.
16	'cafile' => 'http://www.php.net',
17]]);
18file_get_contents('https://github.com', false, $clientCtx);
19?>
20--EXPECTF--
21Warning: remote cafile streams are disabled for security purposes in %s on line %d
22
23Warning: file_get_contents(): Failed to enable crypto in %s on line %d
24
25Warning: file_get_contents(%s): failed to open stream: operation failed in %s on line %d
26