Skip to content

syntax error, unexpected '[' #8

Description

@Kamilcuk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions