Skip to content

Commit 798e707

Browse files
committed
Add test for bug #76296
1 parent d6bc266 commit 798e707

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ext/openssl/tests/bug76296.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #76296 openssl_pkey_get_public does not respect open_basedir
3+
--SKIPIF--
4+
<?php if (!extension_loaded("openssl")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
$dir = __DIR__ . '/bug76296_openbasedir';
8+
$pem = 'file://' . __DIR__ . '/public.key';
9+
if (!is_dir($dir)) {
10+
mkdir($dir);
11+
}
12+
13+
ini_set('open_basedir', $dir);
14+
15+
var_dump(openssl_pkey_get_public($pem));
16+
?>
17+
--EXPECTF--
18+
19+
Warning: openssl_pkey_get_public(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d
20+
bool(false)
21+
--CLEAN--
22+
@rmdir(__DIR__ . '/bug76296_openbasedir');

0 commit comments

Comments
 (0)