xref: /PHP-8.0/ext/curl/tests/bug61948.phpt (revision c5401854)
1--TEST--
2Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
3--SKIPIF--
4<?php if (!extension_loaded("curl")) print "skip curl extension not loaded";
5?>
6--FILE--
7<?php
8  $base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
9  mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
10
11  ini_set("open_basedir", $base_dir);
12
13  $ch = curl_init();
14  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
15  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo"));
16  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
17  curl_close($ch);
18?>
19--CLEAN--
20<?php
21    $base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
22    rmdir("$base_dir/foo");
23    rmdir($base_dir);
24?>
25--EXPECTF--
26%a
27bool(true)
28
29Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (%sbug61948) in %sbug61948.php on line %d
30bool(false)
31