Is Datatable Editor PHP 8.0 compatible ?

Is Datatable Editor PHP 8.0 compatible ?

Benoit87Benoit87 Posts: 8Questions: 3Answers: 1

Is Datatable Editor PHP 8.0 compatible ?

Thanks

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I believe so, but Colin is going to spin up a PHP 8 instance just to confirm. He'll report back here when done.

    Regards,
    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, I just installed REMI PHP 8.0.2 and all our tests ran through smoothly so it looks good as Allan predicted.

    Colin

  • imarderimarder Posts: 12Questions: 5Answers: 2

    Hello, further to this, I ran up a PHP 8.1.1 and got problems into the JSON where my DB date and date time fields default to NULL
    These are the php_error_log

    [12-Jan-2022 10:23:51 Australia/Melbourne] PHP Deprecated:  DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /Applications/XAMPP/xamppfiles/htdocs/consuls/php/lib/Editor/Format.php on line 67
    [12-Jan-2022 10:23:51 Australia/Melbourne] PHP Deprecated:  date_create_from_format(): Passing null to parameter #2 ($datetime) of type string is deprecated in /Applications/XAMPP/xamppfiles/htdocs/consuls/php/lib/Editor/Format.php on line 128
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for letting me know about that - fixed here and will be in the next Editor release, which I'll be dropping soon.

    Allan

  • kingregistrationkingregistration Posts: 3Questions: 1Answers: 0

    In version 2.0.7, you still have usage of create_function which has been removed from php8. This is in file htmlawed.php. I don't know when this file gets used, but this would error out in php8. It can easily be replaced with a proper anonymous function.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Many thanks for flagging that up. I've updated to the latest version of HtmLawed which addresses this issue. It will be included in the next release of Editor, or you can use that file directly at the moment.

    Regards,
    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    htmlawed 1.2.6 return errors with php 8.1.6 :smile: Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in D:\www\dafaction\lib\HtmLawed\Htmlawed.php on line 95

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi all
    Htmlawed.php (and all php files) need to be modified to ensure no optional string type parameter is passed as null in some php function:
    explode, preg_replace, preg_replace_callback, ....
    example line 95, 102, 109, ....
    I do job until 3.20 AM and need to go to bed... I just activate PHP 8.1.6, do changes in a lot of php files, and then (after posting prod files) find a bug in a module (don't know where Htmlawed is called) and 2 solutions were possible... go back to php 7 or find a solution...
    Hope the production version is still stable...
    Regards
    Bob

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Htmlawed is called as part of the XSS protection. You could bypass it by adding ->xss(false) to the fields. Sorry you’ve run into a problem here - I will get on to this next week.

    Allan

  • jaewebjaeweb Posts: 13Questions: 2Answers: 0

    Sorry for digging this old thread out but I tought that's better than creating a new one as duplicate.

    I ran PHP Compatibility check 8.1.16 from CodeSniffer. Latest version of Editor is installed (2.1.0). Following output:

    FILE: /assets/lib/Database/Query.php

    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

    319 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$get" was used, and possibly changed (by reference), on
    | | line 315.


    FILE: /assets/lib/Editor.php

    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES

    335 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$" was used, and possibly changed (by reference), on line
    | | 324.
    354 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$
    " was used, and possibly changed (by reference), on line
    | | 353.
    409 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$" was used, and possibly changed (by reference), on line
    | | 408.
    743 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$
    " was used, and possibly changed (by reference), on line
    | | 742.
    765 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$_" was used, and possibly changed (by reference), on line
    | | 764.


    FILE: /assets/lib/composer.php

    FOUND 1 ERROR AFFECTING 1 LINE

    12 | ERROR | The "case_insensitive" parameter for function define() is deprecated since PHP 7.3 and removed since PHP 8.0


    FILE: /assets/lib/DataTables.php

    FOUND 1 ERROR AFFECTING 1 LINE

    13 | ERROR | The "case_insensitive" parameter for function define() is deprecated since PHP 7.3 and removed since PHP 8.0


    FILE: /assets/lib/Editor/Join.php

    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES

    170 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$" was used, and possibly changed (by reference), on line
    | | 169.
    189 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$
    " was used, and possibly changed (by reference), on line
    | | 188.


    FILE: /assets/lib/Vendor/htmLawed/htmLawed.php

    FOUND 8 ERRORS AND 1 WARNING AFFECTING 7 LINES

    379 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2 and removed since PHP 8.0
    379 | ERROR | The variable '$php_errormsg' is deprecated since PHP 7.2 and removed since PHP 8.0; Use error_get_last() instead
    379 | ERROR | The variable '$php_errormsg' is deprecated since PHP 7.2 and removed since PHP 8.0; Use error_get_last() instead
    380 | ERROR | INI directive 'track_errors' is deprecated since PHP 7.2 and removed since PHP 8.0
    381 | ERROR | The variable '$php_errormsg' is deprecated since PHP 7.2 and removed since PHP 8.0; Use error_get_last() instead
    385 | ERROR | The variable '$php_errormsg' is deprecated since PHP 7.2 and removed since PHP 8.0; Use error_get_last() instead
    387 | ERROR | INI directive 'track_errors' is deprecated since PHP 7.2 and removed since PHP 8.0
    395 | ERROR | Function create_function() is deprecated since PHP 7.2 and removed since PHP 8.0; Use an anonymous function instead
    659 | ERROR | Function create_function() is deprecated since PHP 7.2 and removed since PHP 8.0; Use an anonymous function instead


    Is there a new version planned removing this issues?

    Thanks in advance

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    FWIW I'm running PHP Version 8.0.12 with no reported problems.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    Thanks for flagging this up. The warnings about func_get_args don't trigger any problems as we don't mutate the values, and the analyser doesn't check for that, so it is just flagging any value check after that function has been called. That said, I don't have a problem shifting the code around a little to address that - I've committed the change here.

    The errors about case_insensitive in define() I'm not seeing locally as this commit from two years ago removed those parameters. I'm not sure why you still have them in your install?

    For the warnings and errors in htmLawed, this thread in the Htmlawed forum discusses it. Basically that code is never executed in modern PHP, but it is there to support legacy installs. The code sniffer isn't smart enough to handle that, so I think that is safe to continue using as is. If it is a problem for your CI, you could add an ignore for that file.

    Allan

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421

    I run PHP 8.1.16 with Editor 2.0.7. No issues.

  • jaewebjaeweb Posts: 13Questions: 2Answers: 0

    Hi,

    Thank you very much @allan! I've applied all changes and only Htmlawed Errors remain in CodeSniffer. I think with the given explanations this will be fine like that. And sorry for the confusion about composer.php and DataTables.php: Somehow the old files managed to get into the new installation. My bad...

    And also thanks @tangerine and @rf1234 for your comments on your experience with > PHP 8.

    As always, I'm very happy with datatables editor and this great support! Thank you very much for all your work!

  • ltm1ltm1 Posts: 1Questions: 0Answers: 0

    PHP Deprecated: Creation of dynamic property DataTables\Database\Driver\SqlserverQuery::$_dbHost is deprecated in \lib\Database\Query.php on line 55

    PHP Deprecated: Creation of dynamic property DataTables\Database::$query_driver is deprecated in \lib\Database.php on line 63

    PHP Deprecated: Creation of dynamic property DataTables\Database::$type is deprecated in \Database.php on line 62

    With PHP 8.3. Anyone else with the same? Thanks!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited November 5

    What version of the Editor PHP libraries are you using? Those errors were resolved a while back.

    You can check the version by looking in Editor.php and search for version.

    Allan

    edit I've just realised we've exchanged emails on this topic :). To confirm, that latest versions should have no problem.

Sign In or Register to comment.