• Resolved pepe

    (@pputzer)


    When running on PHP 7.2, Slimstat throws a deprecation warning due to the use of create_function. A quick look at the code would suggest that the use of a dynamically created function is not really necessary.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jason Crouse

    (@coolmann)

    Hi! We’re using what WordPress recommends in their codex:

    https://codex.wordpress.org/Widgets_API

    We’ll change that code to avoid any compatibility issues.

    Thank you for pointing this out.

    Best,
    Jason

    Thread Starter pepe

    (@pputzer)

    Thanks. The codex is pretty obsolete at this point (all current API documentation is maintained in the Code Reference). Dynamic functions were a thing back when procedural programming was the norm and PHP namespaces weren’t there yet.

    When you have a class, adding an extra (static) method does not pollute the global namespace, so there is no reason for the slower eval/create_function call. (Also, with PHP 5.3+, you could always use an anonymous function.)

    Plugin Contributor Jason Crouse

    (@coolmann)

    True! We added a static method, as we want to keep our compatibility with PHP 5.2. Unfortunately (!) many of our users still use that version of the language.

    Best,
    Jason

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP 7.2 Compatibility’ is closed to new replies.