misc/184595: converters/php5-iconv: iconv transliteration support broken

Michael Gmelin freebsd at grem.de
Sun Dec 8 16:00:01 UTC 2013


>Number:         184595
>Category:       misc
>Synopsis:       converters/php5-iconv: iconv transliteration support broken
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 08 16:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Michael Gmelin
>Release:        10.0-BETA3
>Organization:
Grem Equity GmbH
>Environment:
FreeBSD srv10 10.0-BETA3 FreeBSD 10.0-BETA3 #0: Mon Dec 2 20:44:29 UTC 2013     root@:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
php5-iconv has been changed to use FreeBSD's native iconv implementation where available (read FreeBSD 10). Unfortunately FreeBSD doesn't support GNU iconv's TRANSLIT and IGNORE extensions, which are clearly documented to be supported unconditionally on any platform by the PHP project:

http://www.php.net/manual/en/function.iconv.php
"out_charset 

 The output charset. 

If you append the string //TRANSLIT to out_charset transliteration is activated. This means that when a character can't be represented in the target charset, it can be approximated through one or several similarly looking characters. If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded. Otherwise, str is cut from the first illegal character and an E_NOTICE is generated."

As a result, PHP code that runs correctly on other operating systems or FreeBSD < 10 will break in subtle ways.
>How-To-Repeat:
Run the following code snippet:

cat t.php <<EOF
<?php

print iconv("UTF-8", "ISO-8859-1//TRANSLIT", "T\xc5\xbdst\n");

?>
EOF

FreeBSD 9.2:
$ php t.php
TZst

FreeBSD 10 BETA3:
$ php t.php
T?st

>Fix:
Implement TRANSLIT/IGNORE extensions in base or make the port use converters/libiconv.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list