When exporting a table, the row after the table headers is the caption (doesn't matter if it's empty or not) that comes as a string and this is adding a warning on the CSV.
Ex:
"Program name","Program code","Start time"
<b>Warning</b>: fputcsv() expects parameter 2 to be array, string given in <b>/docroot/modules/contrib/tablefield/src/Controller/TablefieldController.php</b> on line <b>70</b><br />
"Advanced Communication for Professionals",ACP1.1,"9 a.m."
"Advanced Ergonomic Studies",AES1.1,"9 a.m."
"Advanced Filmmaking",AF2.1,"2 p.m."
So I've added a simple patch that checks if the row is an array before inserting it in the CSV as fputcsv expects an array.
Comments
Comment #2
bbombachiniComment #3
bbombachiniComment #4
lolandese commentedThe patch solves the issue. The PHP warning does not occur anymore.
Comment #6
lolandese commentedThanks for both reporting and solving this.