xref: /PHP-8.0/ext/curl/tests/curl_escape.phpt (revision c5401854)
1--TEST--
2Test curl_escape and curl_unescape() functions
3--SKIPIF--
4<?php
5if (!extension_loaded("curl")) exit("skip curl extension not loaded");
6if (!function_exists("curl_escape")) exit("skip curl_escape doesn't exists");
7$curl_version = curl_version();
8if ($curl_version['version_number'] < 0x071502) {
9    exit("skip: tests works only on curl >= 7.21.2");
10}
11?>
12--FILE--
13<?php
14$str = "http://www.php.net/ ?!";
15
16$a = curl_init();
17$escaped = curl_escape($a, $str);
18$original = curl_unescape($a, $escaped);
19var_dump($escaped, $original);
20var_dump(curl_unescape($a, 'a%00b'));
21?>
22--EXPECT--
23string(36) "http%3A%2F%2Fwww.php.net%2F%20%3F%21"
24string(22) "http://www.php.net/ ?!"
25string(3) "a�b"
26