|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-05-15 17:02 UTC] young dot inbox at gmail dot com
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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 21:00:01 2025 UTC |
it's still reproducible without links <?php $data = array ( 0 => 'test me hard' ); function my_to_string($inp) { return (string)$inp; } $xlBook = new \ExcelBook(null, null, true); $xlBook->setLocale('UTF-8'); $xlSheet1 = $xlBook->addSheet('Sheet1'); var_dump($data); array_walk($data, 'my_to_string'); var_dump($data); $xlSheet1->writeRow(0, $data);