iliaal / php_excel

PHP Extension interface to the Excel writing/reading library
http://ilia.ws
534 stars 131 forks source link

Warning: ExcelSheet::writeRow(): Failed to write cell in row 3, column 0 with error 'ok' #211

Closed mtortolano closed 3 years ago

mtortolano commented 7 years ago

Whenever I try to writeRows I get this error (the row and column vary tho of course):

Warning: ExcelSheet::writeRow(): Failed to write cell in row 3, column 0 with error 'ok'

I'm on Ubuntu 16.04 (running in WSL but that shouldn't matter), using PHP 7.0 (PHP 7.0.22-0ubuntu0.16.04.1). I've compiled with the PHP 7.0 version from excel-1.0.2-php7.tgz using LibXL 3.6.4.0

I've also tried 3.6.5.0 and 3.8.0.0 but all do the same thing.

I know my PHP code works as it was absolutely fine on Ubuntu 14.04 using the PHP 5 version with LibXL 3.6.4.0.

mtortolano commented 7 years ago

Ok I think I know what's going on, my PHP is turning the array values into References due to some preprocessing I do on them. In PHP7 these are coming through to php_excel_write_cell with this type that you don't currently handle:

#define IS_REFERENCE 10

So it's falling through the end of that function and hitting the return 0 at the end. That causes writeRow to fail but when it looks up the error with xlBookErrorMessage there isn't an error from LibXL to find hence the somewhat confusing error message of error 'ok'

johmue commented 7 years ago

the error message is fetched from libxl but since the wrapper did not pass anything to libxl, there is no error message (or to be precise, everything is perfectly fine from the perspective of libxl) - so it's 'ok'. Could be improved of course ;)