Bug #62070 [Opn->Asn]: Collator::getSortKey returns garbage
Edit report at https://bugs.php.net/bug.php?id=62070&edit=1
ID: 62070
Updated by: felipe@php.net
Reported by: clicky at erebot dot net
Summary: Collator::getSortKey returns garbage
-Status: Open
+Status: Assigned
Type: Bug
Package: I18N and L10N related
Operating System: Ubuntu 10.10
PHP Version: 5.4.3
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-05-19 13:24:25] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62070&edit=1
Thread (3 messages)