xref: /PHP-8.1/ext/openssl/tests/bug76296.phpt (revision 74859783)
1--TEST--
2Bug #76296 openssl_pkey_get_public does not respect open_basedir
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$dir = __DIR__ . '/bug76296_openbasedir';
8$pem = 'file://' . __DIR__ . '/public.key';
9if (!is_dir($dir)) {
10    mkdir($dir);
11}
12
13ini_set('open_basedir', $dir);
14
15var_dump(openssl_pkey_get_public($pem));
16?>
17--CLEAN--
18<?php
19@rmdir(__DIR__ . '/bug76296_openbasedir');
20?>
21--EXPECTF--
22Warning: openssl_pkey_get_public(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d
23bool(false)
24