Support » Plugin: Social Login & Register for WordPress - 40+ Social Networks / OneAll INC » Function create_function() is deprecated in php 7.2.0

  • Resolved mirzazeyrek

    (@mirzazeyrek)


    Hello There,

    Great Job with the plug-in. We are using it for quite some time without any issues.

    But Recently we’ve switched to php7.2 in our organization and noticed errors regarding to create_function.

    Indeed, this also means php7.3 won’t be compatible with the plug-in too. Could you please send a fix for the create_function issue ?

    A possible solution https://stackoverflow.com/a/48161577/1194797

    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Claude

    (@claudeschlesser)

    Hello!

    please open this file:
    wp-content/plugins/oa-social-login/includes/widget.php

    Then replace this:
    add_action ('widgets_init', create_function ('', 'return register_widget( "oa_social_login_widget" );'));

    By this:

    function oa_social_login_init_widget ()
    {
        return register_widget('oa_social_login_widget');
    }
    add_action ('widgets_init', oa_social_login_init_widget);

    This should fix the compatibility issue. The fix will be included in the next version of the plugin.

    • This reply was modified 2 years, 8 months ago by Claude.
    Thread Starter mirzazeyrek

    (@mirzazeyrek)

    Thank you for the workaround @claudeschlesser

    After applying fix we’ve noticed other warnings:

    php 7.2 The each() function is deprecated

    I guess that’s the only issue left with php 7.2 and upcoming 7.3+ compatibility.

    https://stackoverflow.com/questions/46492621/how-to-resolve-this-deprecated-function-each-php

    Plugin Author Claude

    (@claudeschlesser)

    Thank you for the hint, I will have a closer look. We have a similar thread currently open in our support forum:

    http://support.oneall.com/forums/discussion/6449/error-line#latest

    Please note that in my first answer, there are some missing quotation marks around oa_social_login_init_widget, here the correct version:

    function oa_social_login_init_widget ()
    {
        return register_widget('oa_social_login_widget');
    }
    add_action ('widgets_init', 'oa_social_login_init_widget');

    Sorry for that!

    • This reply was modified 2 years, 8 months ago by Claude.
    Thread Starter mirzazeyrek

    (@mirzazeyrek)

    Hello @claude,

    Regarding to other deprecation warning on php7.2 I’ve mentioned here is a possible solution.

    http://prntscr.com/k71n7t

    Plugin Author Claude

    (@claudeschlesser)

    Thank you for the code!

    The PHP 7.2+ compatibility has been fixed in the latest version 5.4.2 šŸ˜‰

    Thread Starter mirzazeyrek

    (@mirzazeyrek)

    Great thanks! Is it officially released ? Seems like we can’t update it via composer wpackagist šŸ™‚ Any idea with this ?

    http://prntscr.com/k8h8wt

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Function create_function() is deprecated in php 7.2.0’ is closed to new replies.