• Resolved bebablub

    (@bebablub)


    Hello,

    thank you for your great plugin. I’m doing first tests with WordPress 5.6, Ninja Forms 3.4.33 on a PHP8 system. At first i got a hard error at line 247 of:
    ninja-forms/deprecated/includes/admin/edit-field/li.php
    which stated that curly brackets are not allowed for accessing arrays. So i changed it to:

    } elseif ( !empty($v) && is_string($v) && ( ('{' == $v[0] && '}' == $v[strlen($v) - 1]) || ('[' == $v[0] && ']' == $v[strlen($v) - 1]) || preg_match('/^\(?function ?\(/', $v) ) ) {

    which seems to work for now. But i’m a little bit afraid that there are more issues hidden in the code which are currently not shown just because code is not entered.

    Is there PHP8 compatibility planned?

    Thank you very much!

    Best regards
    Benjamin

Viewing 5 replies - 1 through 5 (of 5 total)
  • The solution to this was highlighted to the developers four months ago and we are still waiting for them to acknowledge it:

    https://www.ads-software.com/support/topic/recent-update-causing-php-error/#post-13223852

    In other issues they mark it as “resolved”:

    https://www.ads-software.com/support/topic/media_buttons_context-deprecated-2/

    The log itself holds the answer:

    
    PHP Deprecated:  media_buttons_context is <strong>deprecated</strong> since version 3.5.0! Use media_buttons instead. in /path/to/wp-includes/functions.php on line 5234
    

    Stacktrace:

    
    /path/to/wp-includes/plugin.php(638): _deprecated_hook('media_buttons_c...', '3.5.0', 'media_buttons', '')
    /path/to/wp-admin/includes/media.php(656): apply_filters_deprecated('media_buttons_c...', Array, '3.5.0', 'media_buttons')
    /path/to/wp-includes/class-wp-hook.php(287): media_buttons('acf_content')
    /path/to/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
    /path/to/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    /path/to/wp-includes/class-wp-editor.php(235): do_action('media_buttons', 'acf_content')
    /path/to/wp-includes/general-template.php(3536): _WP_Editors::editor('', 'acf_content', Array)
    /path/to/wp-content/plugins/advanced-custom-fields-pro/includes/assets.php(521): wp_editor('', 'acf_content')
    /path/to/wp-includes/class-wp-hook.php(287): ACF_Assets->print_uploader_scripts('')
    /path/to/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    /path/to/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    /path/to/wp-admin/admin-footer.php(78): do_action('admin_footer', '')
    /path/to/wp-admin/post.php(369): require_once('/home/customer/...')
    {main}
    
    Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    @brianhenryie @bebablub
    Can you update your Ninja Forms plugin to the latest version (3.5.1) and let me know if you continue to have the same issues with PHP 8?
    If you are still having this issue, can you reach out to our official support channel (ninjaforms.com/contact)

    Thread Starter bebablub

    (@bebablub)

    Hi @jmcelhaney

    No sorry i’m getting the same error with version 3.5.1:
    Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/wordpress/wp-content/plugins/ninja-forms/deprecated/includes/admin/edit-field/li.php on line 247

    If i’m change line 247 and replace the curly braces from:
    } elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {

    to

    } elseif ( !empty($v) && is_string($v) && ( ('{' == $v[0] && '}' == $v[strlen($v) - 1]) || ('[' == $v[0] && ']' == $v[strlen($v) - 1]) || preg_match('/^\(?function ?\(/', $v) ) ) {

    then everything works…

    Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    It appears that you are still using the deprecated, 2.9.x codebase. You can upgrade to the 3 codebase by following this documentation. https://ninjaforms.com/docs/conversion/

    If you are still having issues, can you contact our official Ninja Forms support channel. (ninjaforms.com/contact) so we can take a closer look.

    Hey,

    Thanks for your reply. After your message I updated our plugin (now at 3.5.1). We’re still getting in our logs (as above):

    PHP Deprecated: media_buttons_context is <strong>deprecated</strong> since version 3.5.0! Use media_buttons instead. in /path/to/wp-includes/functions.php on line 5234

    To be clear: I’m on PHP 7.4. I just replied to this PHP 8 thread because the log messages matched.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP8 Compatibility’ is closed to new replies.