Bug #76434 [Fbk->Csd]: implode sometimes ignores one array item

From: Date: Sun, 10 Jun 2018 10:52:50 +0000
Subject: Bug #76434 [Fbk->Csd]: implode sometimes ignores one array item
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215581@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76434&edit=1 ID: 76434 User updated by: ceeckels at mac dot com Reported by: ceeckels at mac dot com Summary: implode sometimes ignores one array item -Status: Feedback +Status: Closed Type: Bug Package: Arrays related Operating System: MacOS, FreeBSD PHP Version: 7.1.18 Block user comment: N Private report: N New Comment: The problem is not PHP-related. It is a problem wit Apple's Terminal.app. The string output by the bash command echo -e '12345678\t12345678\t12345678\t3\t4\t5\t6\t7\t8' depends on the Terminal windows's width. So I owe an apology to PHP's implode function. Thanks to everybody. Bug should be closed. Previous Comments: ------------------------------------------------------------------------ [2018-06-08 23:53:53] danack@php.net Also, this has a very small chance of being a weird interaction between your terminal and the bytes. Please could you run this to see what implode is actually doing. function getRawCharacters($result) { $resultInHex = unpack('H*', $result); $resultInHex = $resultInHex[1]; $resultSeparated = implode(', ', str_split($resultInHex, 2)); return $resultSeparated; } $ar = [12345678, 12345678, 12345678, 3, 4, 5, 6, 7, 8]; $string = implode(chr(9), $ar); echo getRawCharacters($string) . PHP_EOL; ------------------------------------------------------------------------ [2018-06-08 23:35:13] danack@php.net I can't reproduce https://3v4l.org/kEBSX and it sounds weird. Please can you test again with opcache disabled, if it's currently enabled. Also please try with all other extensions disabled. ------------------------------------------------------------------------ [2018-06-08 23:12:01] ceeckels at mac dot com Description: ------------ No comment; just run the test script and notice that the array item 7 is missing in the result string Test script: --------------- <?php $ar = [12345678, 12345678, 12345678, 3, 4, 5, 6, 7, 8]; echo implode(chr(9), $ar), PHP_EOL; ?> Expected result: ---------------- 12345678 12345678 12345678 3 4 5 6 7 8 Actual result: -------------- 12345678 12345678 12345678 3 4 5 6 8 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76434&edit=1

« previous php.bugs (#215581) next »