Bug #67745 [Nab]: regression in RC2: failing test with Atoum, not failing with php 5.4 and 5.5
| From: | pascal dot chevrel at free dot fr | Date: | Sat, 02 Aug 2014 13:47:29 +0000 |
| Subject: | Bug #67745 [Nab]: regression in RC2: failing test with Atoum, not failing with php 5.4 and 5.5 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186943@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67745&edit=1
ID: 67745
User updated by: pascal dot chevrel at free dot fr
Reported by: pascal dot chevrel at free dot fr
Summary: regression in RC2: failing test with Atoum, not
failing with php 5.4 and 5.5
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 5.6.0RC2
Assigned To: tyrael
Block user comment: N
Private report: N
New Comment:
Thanks for investigating, I see that the bug was in my code as I do have
mb_internal_encoding('UTF-8') in the bootstrap file for the application but I don't
have it set in the bootstrap file used in my unit tests.
Previous Comments:
------------------------------------------------------------------------
[2014-08-02 11:23:12] tyrael@php.net
the result of the sort is different, because mb_strlen returns a different value on 5.6, because the
default mb_internal_encoding was changed in 5.6 from ISO-8859-1 to UTF-8:
http://3v4l.org/rZNL4
this change is described in our UPGRADING guide and should be explained in the php.net upgrading
docs also:
http://git.php.net/?p=php-src.git;a=blob;f=UPGRADING;h=7a174c47c2a034ac3718cf364cde66569d72b0d7;hb=refs/heads/PHP-5.6#l80
if you want to make sure that your code/test produces the same result on both 5.6 and older versions
(or anywhere where the internal encoding is set to a non-default value), consider explicitly passing
the second optional $encoding argument to mb_strlen()
------------------------------------------------------------------------
[2014-08-02 11:05:43] tyrael@php.net
yeah, I've seen it, and it depends on atoum, and it makes the work for us easier if we
don't have to get ourself familiar with each and every php project to be able to find out what
exactly causes the problem,
I've went ahead and created a simple reproduce script based on your repo:
<?php
$sentence = 'Le système le style du couteau du suisse';
$words = explode(' ', $sentence);
$words = array_filter($words); // filter out extra spaces
$words = array_unique($words); // remove duplicate words
// sort words from longest to shortest
usort(
$words,
function ($a, $b) {
return mb_strlen($b) - mb_strlen($a);
}
);
var_dump($words);
------------------------------------------------------------------------
[2014-08-02 10:18:39] pascal dot chevrel at free dot fr
There is a testcase in a github repo referenced in this bug.
------------------------------------------------------------------------
[2014-08-02 10:16:08] tyrael@php.net
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.
------------------------------------------------------------------------
[2014-08-02 09:29:46] pascal dot chevrel at free dot fr
Description:
------------
I have a test failing with PHP 5.6RC2, I don't know if it is a bug in Atoum or if it exposes a
regression in the upcoming PHP 5.6 release.
I put a repo online with a reduced test case exposing the bug:
https://github.com/pascalchevrel/atoumbug_php5.6
I also filed a bug on Atoum:
https://github.com/atoum/atoum/issues/346
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67745&edit=1