PHP error generating excel worksheets

Topics: Developer Forum, Project Management Forum
Jan 15, 2015 at 5:59 PM
Edited Jan 15, 2015 at 9:58 PM
Hi people:

I'm new in this forum. Recently i've been using PHPtoExcel successfully at localhost. I finished my project and uploaded it to another host. I found some errors running scripts related with PHPtoExcel at this new host. I changed nothing from my old scripts because i knew they work like a charm, but not now.

This is the error i'm getting:

Parse error: syntax error, unexpected '[', expecting ')' in /var/www/html/EZ/Classes/PHPExcel/Writer/Excel2007/Chart.php on line 637

I think the issue should be related with php.ini or something like that because it's the only thing that changed...i'm running the script with php 5.3.3

Thank you in advance
Esteban
Coordinator
Jan 15, 2015 at 9:51 PM
Yes, it is a version error, one introduced since the last production release: short array syntax was introduced in PHP version 5.4

But that error was also fixed some months ago.
Jan 15, 2015 at 9:56 PM
Thank you MarkBaker! so...there's no way to solve it through php.ini with 5.3.3? the only way is updating PHP to newer version? (5.4 or above)
Coordinator
Jan 15, 2015 at 10:59 PM
No, the way to solve it is to get the latest develop branch code from github, where the issue has been fixed
Jan 15, 2015 at 11:16 PM
Edited Jan 15, 2015 at 11:17 PM
I got it, thank you again MarkBaker!
Jan 20, 2015 at 12:58 PM
Thank you MarkBaker, it definitely solved my problem :)
Jan 20, 2015 at 2:35 PM
do you have a link for it? I can't find it..thanks
Jan 20, 2015 at 7:18 PM
segovius wrote:
do you have a link for it? I can't find it..thanks
Here i downloaded 1.8.0 and that worked fine for me

https://phpexcel.codeplex.com/releases/view/119187
Jan 21, 2015 at 7:49 AM
I have this same issue - working fine on localhost Php 5.4.30 but the error is there on the live server running Php 5.3.28 - thing is though that this has always been the latest 1.8.0 branch.
Coordinator
Jan 26, 2015 at 9:33 PM
If you can point me to any instance of short array syntax in the 1.8.0 release, then I can fix it. I have searched and am completely unable to find any such instance.

There was briefly a use of short array syntax in the develop branch, specifically the instance referenced in the initial post to this thread, but that was fixed several months ago.