PHP Editor error - Parse error: syntax error, unexpected '[' in /var/www/html/md/editor/lib/Database
PHP Editor error - Parse error: syntax error, unexpected '[' in /var/www/html/md/editor/lib/Database

That's it, error PHP Editor error - Parse error: syntax error, unexpected '[' in /var/www/html/md/editor/lib/Database
This is with a working datatable (no editor function...) on the page and intialising editor with:
include( "../editor/lib/DataTables.php" );
use DataTables\Editor;
$editor = Editor::inst( $db, 'unit', 'unit_pk' )
->fields(
Field::inst( 'unit_name' ),
Field::inst( 'points' ),
Field::inst( 'year' )
)
->process( $_POST )
->json();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @peterbrowne ,
I think it's because you're not using all the classes. To be sure, could you change
to be
I don't think you need them all, but it'll tell us if we're on the right path!
Cheers,
Colin
Still have the same error:
"Parse error: syntax error, unexpected '[' in /var/www/html/md/editor/lib/Database.php on line 136 "
I am using:
The error indicates this line, but that is valid PHP.
What version of PHP are you using please?
Allan
PHP Version 5.3.3
Parse error: syntax error, unexpected '[' in /var/www/html/md/editor/lib/Database.php on line 136
That's a really old version now (10 years ago
) and hasn't seen security updates in a good while.
Are you able to update to a newer version? Even if its just 5.3.29. I recall having issues with some of the earlier 5.3.x releases before.
Allan
Admin is not upgrading, so I'm stuck at 5.3.3
As it's the best you can get with RHEL6 ... may want to update the requirements on the recent version of Editor
It is possible to install PHP 5.6 using SCL (details), however I agree - I'll mark that the latest version of PHP 5.3 is required.
@jacob.steinberger Are you also seeing the same error and the same line number?
Allan
I modify the /lib/database.php on line 136
It's works,
//return $res->fetch()['cnt'];
$row = $sth->fetch();
$cnt=$row['cnt'];
return $cnt;