Bug #78308 [Ver->Dup]: IntlPartsIterator key is off by one when created with KEY_LEFT

From: Date: Tue, 07 Dec 2021 22:37:43 +0000
Subject: Bug #78308 [Ver->Dup]: IntlPartsIterator key is off by one when created with KEY_LEFT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238273@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78308&edit=1 ID: 78308 Updated by: cmb@php.net Reported by: smokey101stair at gmail dot com Summary: IntlPartsIterator key is off by one when created with KEY_LEFT -Status: Verified +Status: Duplicate Type: Bug Package: I18N and L10N related PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Closing as duplicate of <https://github.com/php/php-src/issues/7734>. Previous Comments: ------------------------------------------------------------------------ [2019-07-20 13:51:34] cmb@php.net The following pull request has been associated: Patch Name: Fix #78308: IntlPartsIterator key is wrong for KEY_LEFT/KEY_RIGHT On GitHub: https://github.com/php/php-src/pull/4446 Patch: https://github.com/php/php-src/pull/4446.patch ------------------------------------------------------------------------ [2019-07-20 11:24:43] cmb@php.net Although the index is properly adjusted[1], it is than increased once more[2]. [1] <https://github.com/php/php-src/blob/php-7.2.20/ext/intl/breakiterator/breakiterator_iterators.cpp#L162-L166> [2] <https://github.com/php/php-src/blob/php-7.2.20/ext/intl/common/common_enum.cpp#L260> ------------------------------------------------------------------------ [2019-07-18 18:24:29] smokey101stair at gmail dot com Looks like passing IntlPartsIterator::KEY_RIGHT also exhibits the same problem. https://3v4l.org/SNUAX ------------------------------------------------------------------------ [2019-07-17 19:24:56] smokey101stair at gmail dot com Description: ------------ When creating an IntlPartsIterator with a key_type of IntlPartsIterator::KEY_LEFT, the returned key value is off by one after the first key. So for the string "ABC" you would get 0, 2, 3, instead of the expected 0, 1, 2. Test script: --------------- https://3v4l.org/O8374 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78308&edit=1

« previous php.bugs (#238273) next »