Is there a build for Editor that works on PHP 5.3?

Is there a build for Editor that works on PHP 5.3?

Karen Van StadenKaren Van Staden Posts: 3Questions: 1Answers: 0

Getting errors for Editor on square brackets on PHP 5.3.3. Is there a build for Editor that works on PHP 5.3?

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,771Questions: 1Answers: 10,112 Site admin

    Which line is causing the error please? The libraries should actually work with 5.3 (although I would suggest you upgrade really soon - PHP 5.3 hasn't been receiving security patches in a decade!).

    We've also noticed some bugs in the earlier PHP 5.3 releases which were address in the latest patch releases. So even if you can't go to 5.4 (or better 7.x) I'd suggest updating to 5.3.29 which I think should resolve the issue.

    Allan

  • Karen Van StadenKaren Van Staden Posts: 3Questions: 1Answers: 0

    Thanks Allan.

    The current error is:

    Parse error: syntax error, unexpected '[' in /var/www/html/curriculum_mapper/datatables/lib/Database.php on line 136

    If I changed that, there would probably be other places which would need to be addressed. I have asked out IT people at UWA to put PHP 5.4 on dev to test.

  • allanallan Posts: 61,771Questions: 1Answers: 10,112 Site admin
    Answer ✓

    That's this. I think that is actually meant to be valid PHP 5.3, but I've committed a change.

    I'll see if there is a way we can run our tests on PHP 5.3.

    Allan

  • Karen Van StadenKaren Van Staden Posts: 3Questions: 1Answers: 0
    edited September 2019

    Thanks for the change snippet, I'm not getting the error anymore. However, I have a new error:

    Fatal error: Class 'Field' not found in /var/www/html/curriculum_mapper/users.php on line 7

    require_once( 'connection/connect.php' );
    mysql_select_db( $database, $connection );
    include( "datatables/lib/DataTables.php" );
    use DataTables\Editor;
    $editor = Editor::inst( $db, 'user', 'user_pk' )->fields(
        Field::inst( 'first_name' ), //line 7
        Field::inst( 'last_name' ),
        Field::inst( 'email' ),
        Field::inst( 'username' ),
        Field::inst( 'user_type' ),
        Field::inst( 'created' ),
        Field::inst( 'created_by' ),
        Field::inst( 'updated' ),
        Field::inst( 'updated_by' )
    )
        ->process( $_POST )
        ->json();
    ?>
    

    Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    Answer ✓

    You're lacking some "use" statements.
    Look at the server script code here::
    https://editor.datatables.net/examples/simple/simple.html

  • peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0

    Thanks, got it working now.

    Allan, your simple fix for the editor to work with 5.3 works just fine. :)

This discussion has been closed.