PHP :: Bug #62070 :: Collator::getSortKey returns garbage
| Bug #62070 | Collator::getSortKey returns garbage | ||||
|---|---|---|---|---|---|
| Submitted: | 2012-05-19 13:24 UTC | Modified: | 2012-05-23 11:37 UTC | ||
| From: | clicky at erebot dot net | Assigned: | cataphract (profile) | ||
| Status: | Closed | Package: | I18N and L10N related | ||
| PHP Version: | 5.4.3 | OS: | Ubuntu 10.10 | ||
| Private report: | No | CVE-ID: | None | ||
[2012-05-19 13:24 UTC] clicky at erebot dot net
Description: ------------ I tried to use the same code snippet as the one given on Collator::getSortKey's manual page (http://php.net/manual/en/collator.getsortkey.php). This resulted in a PHP Warning about a non zero-terminated string and a different output. I get the same results (warning + incorrect sort key) on both a 32 bits and a 64 bits build of PHP 5.2.17 (with intl installed from PECL), 5.3.13 & 5.4.3, Here's the configure line I used for PHP 5.4.3 (64 bits build with debug symbols): './configure' \ '--disable-all' \ '--disable-short-tags' \ '--disable-sigchild' \ '--enable-debug' \ '--with-layout=GNU' \ '--with-regex' \ '--with-openssl' \ '--with-zlib' \ '--enable-bcmath' \ '--with-bz2' \ '--enable-calendar' \ '--with-gd' \ '--enable-gd-native-ttf' \ '--with-gettext' \ '--with-gmp' \ '--enable-mbstring' \ '--enable-pcntl' \ '--with-readline' \ '--enable-soap' \ '--enable-sockets' \ '--with-pdo-sqlite' \ '--enable-sysvmsg' \ '--enable-sysvsem' \ '--enable-sysvshm' \ '--with-xsl' \ '--with-iconv' \ '--enable-zip' \ '--enable-posix' \ '--enable-libxml' \ '--enable-dom' \ '--enable-xml' \ '--enable-xmlreader' \ '--enable-xmlwriter' \ '--enable-simplexml' \ '--enable-tokenizer' \ '--enable-pdo' \ '--enable-ctype' \ '--enable-json' \ '--enable-session' \ '--enable-intl' \ '--enable-phar' \ '--with-sqlite3' \ '--prefix=/home/.../php-5.4.3-debug' \ '--exec-prefix=/home/.../php-5.4.3-debug' \ '--with-pear=/home/.../php-5.4.3-debug/pear' Test script: --------------- <?php // Same as the one on http://php.net/manual/en/collator.getsortkey.php $s1 = 'Hello'; $coll = collator_create( 'en_US' ); $res = collator_get_sort_key( $coll, $s1); echo urlencode($res); ?> Expected result: ---------------- 71%3F%3FE%01%09%01%8F%08%00 // No warning and same result as in the manual Actual result: -------------- PHP 5.2.17: PHP Warning: String is not zero-terminated (:4BBH ) (source: /home/.../php-5.2.17-debug/Zend/zend_execute_API.c:414) in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 %3A4BBH%01%09%01%8F%08%00 ----- PHP 5.3.13: PHP Warning: String is not zero-terminated (:4BBH ) (source: /home/.../php-5.3.13-debug/Zend/zend_execute_API.c:447) in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 %3A4BBH%01%09%01%8F%08%00 ----- PHP 5.4.3: PHP Warning: String is not zero-terminated (:4BBH ) (source: /home/.../php-5.4.3-debug/Zend/zend_execute.h:87) in Command line code on line 1 PHP Stack trace: PHP 1. {main}() Command line code:0 %3A4BBH%01%09%01%8F%08%00
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2012-05-19 16:09 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: stas
[2012-05-23 11:37 UTC] cataphract@php.net
-Status: Assigned +Status: Closed -Assigned To: stas +Assigned To: cataphract