• Message I get on all the pages on the dev and stage servers:

    Deprecated: Function create_function() is deprecated in /var/www/htdocs/wp-content/plugins/healcode-mindbody-widget/widget.php on line 88

    Code on :88 of named file:
    // add_action(‘widgets_init’, create_function(”, ‘return register_widget(“Hc_Insert_Html_Widget”);’)); // <– this is less than perfect

    // js style anon function call. This is awesome:
    add_action(‘widgets_init’, function() {
    return register_widget(“Hc_Insert_Html_Widget”);
    });

    create_function was supplanted w/ native anon function as of php 5.3.0, in 2008. Hey @mbo — you might consider … you know. ??

    • This topic was modified 5 years, 4 months ago by Tom Smith.
    • This topic was modified 5 years, 4 months ago by Tom Smith.
Viewing 1 replies (of 1 total)
  • daymobrew

    (@daymobrew)

    Here’s a patch for the create_function() warning.
    You can also remove the closing ?>

    — widget.php.orig 2019-11-22 10:55:10.000000000 +0000
    +++ widget.php 2019-11-27 10:31:29.204687000 +0000
    @@ -85,5 +85,5 @@

    } // end class Hc_Insert_Html_Widget
    -add_action(‘widgets_init’, create_function(”, ‘return register_widget(“Hc_Insert_Html_Widget”);’));
    +add_action(‘widgets_init’, function () { return register_widget(“Hc_Insert_Html_Widget”); } );
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Deprecated function notice’ is closed to new replies.