Bug #69776 [Opn->Fbk]: mb_strlen() produces different results from previous PHP versions

From: Date: Mon, 08 Jun 2015 20:14:46 +0000
Subject: Bug #69776 [Opn->Fbk]: mb_strlen() produces different results from previous PHP versions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193215@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69776&edit=1 ID: 69776 Updated by: requinix@php.net Reported by: martijn at vanderlee dot com Summary: mb_strlen() produces different results from previous PHP versions -Status: Open +Status: Feedback Type: Bug Package: mbstring related Operating System: Any PHP Version: 5.6.9 Block user comment: N Private report: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. The default character encoding changed with PHP 5.6. You were/are relying on its default being (apparently) UTF-8 when that was not the case, thus the incorrect value of 31. Now the default is UTF-8 and you're getting 17. https://wiki.php.net/rfc/default_encoding As to the bug you're reporting, when I use mb_ereg_search_* I get 17 characters. http://3v4l.org/JWP3O Previous Comments: ------------------------------------------------------------------------ [2015-06-08 19:47:05] martijn at vanderlee dot com Description: ------------ mb_strlen() on PHP 5.6 sometimes returns different values than the exact same call on previous versions of PHP (tested with 5.3, 5.4 and 5.5). For the given test script, PHP 5.6 returns "17" whereas all other versions return "31". It seems 5.6 is correct, however, when using the mb_ereg_search_* functions, they still return match lengths like PHP 5.5 and before. i.e. they total up to 31 for the entire string. Regardless of which version is right, all multibyte functions should atleast produce consistent results within the same version of PHP. Test script: --------------- echo mb_strlen('από το Άξιον Εστί'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69776&edit=1

« previous php.bugs (#193215) next »