Bug #76343 [NEW]: array_walk myth
| From: | young dot inbox at gmail dot com | Date: | Tue, 15 May 2018 17:02:43 +0000 |
| Subject: | Bug #76343 [NEW]: array_walk myth | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215263@lists.php.net to get a copy of this message | ||
From: young dot inbox at gmail dot com
Operating system: Ubuntu
PHP version: 7.2.5
Package: Arrays related
Bug Type: Bug
Bug description:array_walk myth
Description:
------------
After updating from PHP 7.0.* to 7.2.5 next code start failing with
PHP Warning: ExcelSheet::writeRow(): Failed to write cell in row 0,
column 0 with error 'ok' in /home/ddc/young/htdocs/2.php on line 18
It use https://github.com/iliaal/php_excel module
and you may think that
the problem with this module, but this not true.
If i will comment array_walk, which in this case NOT changing data - it
will work fine
With array_walk it gives error
but data array is the same with and without array_walk call
so array_walk call changing not only the data but something invisible in
addition, but should not
Test script:
---------------
<?php
$data = array (
0 => 'test me hard'
);
$xlBook = new \ExcelBook(null, null, true);
$xlBook->setLocale('UTF-8');
$xlSheet1 = $xlBook->addSheet('Sheet1');
var_dump($data);
array_walk($data, function(&$field) {
$field = (string)$field;
});
var_dump($data);
$xlSheet1->writeRow(0, $data);
Expected result:
----------------
Same result with and without array_walk
Actual result:
--------------
Error with array_walk and success without
--
Edit bug report at https://bugs.php.net/bug.php?id=76343&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76343&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76343&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76343&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76343&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76343&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76343&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76343&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76343&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76343&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76343&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76343&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76343&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76343&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76343&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76343&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76343&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76343&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76343&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76343&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76343&r=mysqlcfg