#26391 [Bgs->Csd]: parse_url destroy UTF-8 when SAPI=CLI
| From: | moriyoshi@php.net | Date: | Wed, 03 Dec 2003 20:59:13 +0000 |
| Subject: | #26391 [Bgs->Csd]: parse_url destroy UTF-8 when SAPI=CLI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51647@lists.php.net to get a copy of this message | ||
ID: 26391
Updated by: moriyoshi@php.net
Reported By: towb at tiscali dot de
-Status: Bogus
+Status: Closed
Bug Type: *URL Functions
Operating System: MacOS X 10.2.6
PHP Version: 4.3.4
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
I'm not sure that my patch did fix this problem, but the
code was obviously so wrong that it may cause this kind
of weirdness.
Previous Comments:
------------------------------------------------------------------------
[2003-11-26 16:21:08] iliaa@php.net
parse_url is not affected by character encoding. Further tests on both
MacOSX and X86 could not verify the reported bug.
Tests were done using CLI SAPI.
------------------------------------------------------------------------
[2003-11-26 13:34:28] towb at tiscali dot de
I made the mistake of only testing with CLI on MacOS.
Repeated with APXS the output is correct and identical
to x86.
So it is probably related to the SAPI rather than the
platform. I cannot test with CLI on x86.
Still, the CVS build does give the deviating result
using CLI.
------------------------------------------------------------------------
[2003-11-26 11:35:18] towb at tiscali dot de
I suppose this is a standard reply. The problem only
occurs on MacOS.
I can reproduce it with php4-STABLE-200311261430 (built
--disable-cgi --disable-all --without-pear).
The exact file I used to check is at http://
www.celvina.de/tmp/url.php.txt and the result (using
CLI php > file) at http://www.celvina.de/tmp/url.txt
Both are identical to the orignal report.
------------------------------------------------------------------------
[2003-11-24 20:10:59] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Cannot replicate in latest CVS.
------------------------------------------------------------------------
[2003-11-24 17:32:09] towb at tiscali dot de
Description:
------------
Only on MacOS do PHP 4.3.3 and .4 return different
values for parse_url(urldecode($url)) and
urldecode(parse_url($url)) when UTF-8 characters are
involved.
The correct result below (identical strings) comes from
PHP 4.3.4 on Linux/x86.
Reproduce code:
---------------
$string =
"file://localhost/Volumes/Second/Next/Arianne/The%20End%20of%20Evangelion%20OST/Komm,%20su%CC%88sser%20Tod.mp3";
$first_decode = urldecode($string);
$first_url = parse_url($first_decode);
$first_path = $first_url['path'];
$last_url = parse_url($string);
$last_path = $last_url['path'];
$last_decode = urldecode($last_path);
var_dump($first_path, $last_decode);
var_dump(urlencode($first_path), urlencode($last_decode));
Expected result:
----------------
string(77) "/Volumes/Second/Next/Arianne/The End of
Evangelion OST/Komm, suÌsser Tod.mp3"
string(77) "/Volumes/Second/Next/Arianne/The End of
Evangelion OST/Komm, suÌsser Tod.mp3"
string(95)
"%2FVolumes%2FSecond%2FNext%2FArianne%2FThe+End+of+Evan
gelion+OST%2FKomm%2C+su%CC%88sser+Tod.mp3"
string(95)
"%2FVolumes%2FSecond%2FNext%2FArianne%2FThe+End+of+Evan
gelion+OST%2FKomm%2C+su%CC%88sser+Tod.mp3"
Actual result:
--------------
string(77) "/Volumes/Second/Next/Arianne/The End of
Evangelion OST/Komm, su?_sser Tod.mp3"
string(77) "/Volumes/Second/Next/Arianne/The End of
Evangelion OST/Komm, süsser Tod.mp3"
string(93)
"%2FVolumes%2FSecond%2FNext%2FArianne%2FThe+End+of+Evan
gelion+OST%2FKomm%2C+su%CC_sser+Tod.mp3"
string(95)
"%2FVolumes%2FSecond%2FNext%2FArianne%2FThe+End+of+Evan
gelion+OST%2FKomm%2C+su%CC%88sser+Tod.mp3"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26391&edit=1