bug65538_002.phpt 925 B

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