xref: /PHP-8.2/ext/curl/tests/bug61948.phpt (revision 74859783)
1--TEST--
2Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7  $base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
8  mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
9
10  ini_set("open_basedir", $base_dir);
11
12  $ch = curl_init();
13  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
14  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "$base_dir/foo"));
15  var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
16  curl_close($ch);
17?>
18--CLEAN--
19<?php
20    $base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
21    rmdir("$base_dir/foo");
22    rmdir($base_dir);
23?>
24--EXPECTF--
25%a
26bool(true)
27
28Warning: 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
29bool(false)
30