[php-maint] Bug#612364: php5: get_browser() inserts special characters without respecting encoding
Jeremy
jeremy at blazonco.com
Tue Feb 8 02:37:11 UTC 2011
Package: php5
Version: 5.3.3-7
Severity: minor
Tags: upstream
A change ocurred in the get_browser() function between PHP 5.2 and PHP 5.3 which
in my view represents a BC break. The get_browser() function now inserts a
special character (U+00A7, "Section marker") at the beginning and end of the
browser_name_regex property of the returned object/array. The issue with this
is that the special character is encoded in ISO-8859-1 regardless of what encoding
was requested either via header() or default_charset. This results in not only
improper output (if the results of get_browser() are sent to the output) but alsoo
disasterous failure if attempting to interoperate with UTF-8 services --
for example a database using UTF-8 encoding.
I am guessing that the reason for the introduction of this character was to allow
the browser_name_regex string to have delimiters so that it could be used directly
in preg_match() or similar, and the strange delimiter was chosen to minimize the
chance of collision with the pattern. However, introducing special characters
in a particular encoding in PHP functions that ought to be returning ASCII strings
only seems unwise.
It's possible that the encoding problem itself was introduced in Debian, but I do
see the special character in the vanilla source distribution of PHP so it seems
this "feature" was introduced upstream (marked as such).
Jeremy
-- System Information:
Debian Release: 6.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages php5 depends on:
ii libapache2-mod-php5 5.3.3-7 server-side, HTML-embedded scripti
ii php5-common 5.3.3-7 Common files for packages built fr
php5 recommends no packages.
php5 suggests no packages.
-- no debconf information
More information about the pkg-php-maint
mailing list