These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

PHPEveCentral - unexpected '[' in Utils.php

Author
Riley Masterson
Mechanical Basterds
#1 - 2014-06-01 02:21:54 UTC
I'm working with PHPEveCentral 1.0.4 in PHP 5.3.28 (installed via Composer) and when using the example code provided on GitHub I receive the following error:

"Error Message" wrote:
Parse error: syntax error, unexpected '[' in /vendor/manhim/phpevecentral/library/PHPEveCentral/Utils.php on line 88


"Sample Code" wrote:

$result = \PHPEveCentral\PHPEveCentral::getInstance()->MarketStat()
->addTypeId(34) // Tritanium
->addTypeId(35) // Pyerite
->addRegionLimit(10000002) // The Forge
->send();

$tritanium = $result->getType(34);
echo 'The minimum sell price of Tritanium in The Forge is ' . $tritanium->sell->min;


"Util.php at line 88" wrote:
$post_options = [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => implode('&', $query_string)
];


I'm not really sure what to do here since there is only one other thread I could find for PHPEveCentral, and it hasn't been touched in quite a while on Github, so I figure it must be pretty stable.

Thanks in advance for any help you can provide.
qu1ckkkk
The Warp Core Stabilizers
#2 - 2014-06-01 07:26:03 UTC
Short array syntax such as ['1', '2'] is not supported in PHP 5.3. Upgrade to PHP 5.4 and it should be fine.

Proud developer of SeAT! A Simple Eve API & Corporation Management Tool.

Project Page: https://github.com/eveseat/seat

Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#3 - 2014-06-02 12:36:38 UTC
Riley Masterson wrote:
I'm working with PHPEveCentral 1.0.4 in PHP 5.3.28

-> PHP 5.3 has reached end of lifecycle over a year ago and is only receiving critical fixes
-> PHP 5.4 is receiving fixes
-> PHP 5.5 is current stable, and receives full support
-> PHP 5.6 is beta 3, and will likely see an release candidate soon. Once that happens its just a matter of time that 5.4 reaches End of Life.
-> HHVM is 5.4 complete, and i think 5.5 almost complete. some 5.5 features where in hhvm before they where in 5.5.

If you develop nowadays, 5.5 is what you should be working on.

3rdPartyEve.net - your catalogue for 3rd party applications

Manhim
Garoun Investment Bank
Gallente Federation
#4 - 2014-06-02 14:21:33 UTC
I fixed this "issue" in 1.0.5.

Although like Peter said, PHP 5.3 is not maintained anymore and I strongly suggest to upgrade to at least 5.4.