xref: /php-src/ext/curl/tests/gh16802.phpt (revision 179ca2bf)
1--TEST--
2GH-16802 (open_basedir bypass using curl extension)
3--EXTENSIONS--
4curl
5--SKIPIF--
6<?php
7$curl_version = curl_version();
8if ($curl_version['version_number'] < 0x075500) {
9    die("skip: blob options not supported for curl < 7.85.0");
10}
11?>
12--INI--
13open_basedir=/nowhere
14--FILE--
15<?php
16$ch = curl_init("file:///etc/passwd");
17curl_setopt($ch, CURLOPT_PROTOCOLS_STR, "all");
18curl_setopt($ch, CURLOPT_PROTOCOLS_STR, "ftp,all");
19curl_setopt($ch, CURLOPT_PROTOCOLS_STR, "all,ftp");
20curl_setopt($ch, CURLOPT_PROTOCOLS_STR, "all,file,ftp");
21var_dump(curl_exec($ch));
22?>
23--EXPECTF--
24Warning: curl_setopt(): The FILE protocol cannot be activated when an open_basedir is set in %s on line %d
25
26Warning: curl_setopt(): The FILE protocol cannot be activated when an open_basedir is set in %s on line %d
27
28Warning: curl_setopt(): The FILE protocol cannot be activated when an open_basedir is set in %s on line %d
29
30Warning: curl_setopt(): The FILE protocol cannot be activated when an open_basedir is set in %s on line %d
31bool(false)
32