php-src/ext/curl/tests/curl_escape.phpt
Pierrick Charron edece6ec84 Fixed bug #62615 (test ext/curl/tests/curl_escape.phpt failed).
curl_easy_escape was modified in 5.21.2 to not escape "unreserved" characters
so this test will fail on version older than 5.21.2
2012-07-26 19:13:42 -04:00

26 lines
688 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--TEST--
Test curl_escape and curl_unescape() functions
--SKIPIF--
<?php
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
if (!function_exists("curl_escape")) exit("skip curl_escape doesn't exists");
$curl_version = curl_version();
if ($curl_version['version_number'] < 0x071502) {
exit("skip: tests works only on curl >= 7.21.2");
}
?>
--FILE--
<?php
$str = "http://www.php.net/ ?!";
$a = curl_init();
$escaped = curl_escape($a, $str);
$original = curl_unescape($a, $escaped);
var_dump($escaped, $original);
var_dump(curl_unescape($a, 'a%00b'));
?>
--EXPECT--
string(36) "http%3A%2F%2Fwww.php.net%2F%20%3F%21"
string(22) "http://www.php.net/ ?!"
string(3) "ab"