doofpot / DBFToMySQL

xbase/dbf to MySQL import tool
Other
21 stars 25 forks source link

syntax error, unexpected '[' #8

Open Kamilcuk opened 6 years ago

Kamilcuk commented 6 years ago

Problem: The script did not run on my old server.

There was no error message, only return status = 255:

$ php ./dbf-import.php ; echo $?
255

After investigating, i found:

$ php classes/XBase/Record.php 
PHP Parse error:  syntax error, unexpected '[' in /....../XBase/Record.php on line 200

To fix i needed to:

$ diff  Record.php.orig Record.php
200c200,201
<             $pointer = unpack('s', $data)[1];
---
>             $pointer = unpack('s', $data);
>             $pointer = $pointer[1];

My php version:

$ php -v
PHP 5.3.15 (cli) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies