• Resolved neo2k23

    (@neo2k23)


    Can you please fix these warnings? They popup while using the tgm plugin updater. please check the keys if they exist in your code. Thank you

    Warning: Undefined array key “plugins” in /var/docs/public/wp-content/plugins/elementskit-lite/compatibility/data-migration/settings-db.php on line 48

    Warning: foreach() argument must be of type array|object, null given in /var/docs/public/wp-content/plugins/elementskit-lite/compatibility/data-migration/settings-db.php on line 48

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Reedwanul Haque

    (@reedwanul)

    Dear @neo2k23

    Thanks for reaching out to us & extremely sorry for the delayed response.

    We require further clarity regarding the issue you’re referencing or the specific goal you aim to accomplish. Please provide additional details about the problem you’re encountering or the outcome you’re striving for. It would be a lot easier for us if you gave us a video about the problem so that we can understand the problem properly and help you find a solution as soon as possible. Your patience & cooperation in this matter are greatly appreciated.

    Looking forward to your response and we are always here to assist you.

    Best Regards,
    Reju

    Plugin Support Reedwanul Haque

    (@reedwanul)

    Dear @neo2k23 ,

    I hope this message finds you well. Since we haven’t received any response from you, we assume that the issue has been resolved. Therefore, I’m marking this thread as resolved.

    If you need any further assistance on this matter, feel free to create a new thread. We will be happy to assist you.

    Best Regards,
    Reju

    Thread Starter neo2k23

    (@neo2k23)

    Hello,

    How should i make the video as the 2 action calls in that file are not called in every update are they?

    The issues still exists.

    If you don not check the if the array key exists before calling it on line 48 and on line 61 in that file the issue will come back. The action hooks you are calling only in case social_share_css_was_updated or team_widget_css_was_updated. So of course i will not see them on every update as they do not always change and therefor are not always called.

    The solution however is simple. If you check the if the array key exists before calling it on line 48 in the foreach in that file, the issue will NOT come back. If the code stays the sames the issue will remain and others will report the warnings in the near future.

    if ( isset( $options[‘plugins’] ) ) {
    foreach …..{}
    }

    Thank you

    Plugin Support Reedwanul Haque

    (@reedwanul)

    Dear @neo2k23,

    I understand your concern. I will discuss this issue with the development team. Hopefully, they will review your request and provide a relevant solution as soon as possible. Your patience and cooperation in this matter are greatly appreciated.

    Best Regards,
    Reju

    Plugin Support Reedwanul Haque

    (@reedwanul)

    Dear @neo2k23,

    I have received an update from the development team, and they have confirmed that they will address this issue. In the meantime, please use the updated settings-db.php file available here: https://d.pr/f/1WRMKw to fix the problem. We will officially release this fix in an upcoming version of the plugin, so please keep your plugin updated.

    Best Regards,
    Reju

    Thread Starter neo2k23

    (@neo2k23)

    Hi

    Thank you for your feedback and solution. I doubt though that it will tackle the problem. As when the index ‘plugins’ is not set it will still generate the warning and in the future, when php changes that, a fatal. The reported issue is about a missing key in a array. Checking if the array[key] is empty will not prevent the warning (and maybe later a fatal) that the key is missing as that is what my issue is about.

    the code still requires a permanent fix,

    This code

    if (!empty($options['plugins']) && $options['action'] == 'update' && $options['type'] == 'plugin') {

    should be altered into this to prevent the warning.

    if (isset($options['plugins']) && !empty($options['plugins']) && $options['action'] == 'update' && $options['type'] == 'plugin') {

    Please have the developers review/adapt my suggestion to fix the issue permanent as it still can happen that the issue will occur when, at some point, the ‘upgrader_process_complete’ is called by another process then your plugin. F.e. when using the TGM plugin installer/updater (latest v2.6.1) to update the plugins that ship with a theme or even your plugin as it can detect those also.

    Thank you for sticking with me and my reported issue. It is really appreciated.

    Thread Starter neo2k23

    (@neo2k23)

    I did a quick google search and stumbled upon this where you will see the same solution and code used as i provided

    https://stackoverflow.com/questions/61019930/how-to-use-upgrader-process-complete-hook-in-wordpress-to-check-for-spcific-plug

    /**
    * This function runs when WordPress completes its upgrade process
    * It iterates through each plugin updated to see if ours is included
    * @param $upgrader_object Array
    * @param $options Array
    */
    function wp_upe_upgrade_completed( $upgrader_object, $options ) {
    // The path to our plugin's main file
    $our_plugin = plugin_basename( __FILE__ );
    // If an update has taken place and the updated type is plugins and the plugins element exists
    if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
    // Iterate through the plugins being updated and check if ours is there
    foreach( $options['plugins'] as $plugin ) {
    if( $plugin == $our_plugin ) {
    // Your action if it is your plugin

    }
    }
    }
    }
    add_action( 'upgrader_process_complete', 'wp_upe_upgrade_completed', 10, 2 );
    Plugin Support Reedwanul Haque

    (@reedwanul)

    Dear @neo2k23,

    I hope you are doing well, and I understand your concern. Thank you for sharing your suggestions. Please be informed that our development team has confirmed this issue will be resolved in the upcoming version. I kindly ask you to wait for the release, as it should address the problem. In the meantime, please stay calm and patient. Your cooperation is greatly appreciated.

    Best Regards,
    Reju

    Thread Starter neo2k23

    (@neo2k23)

    I was only replying that the given solution in the download file is not the correct one. So if that is the solution in the next build it won’t help preventing the warning. All in order to get your code 100% bulletproof.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.