• Resolved alx359

    (@alx359)


    I’m getting the following notice on our live site:

    PHP Notice: Undefined index: action in /srv/users/serverpilot/apps/www-mydomain/public/wp-content/plugins/media-library-assistant/includes/class-mla-ajax.php on line 40

    Line 40 reads:
    if ( ( defined('DOING_AJAX') && DOING_AJAX ) && ( 'mla_named_transfer' == $_REQUEST['action'] ) ) {

    An obvious quick-fix would be @$_REQUEST['action'] but it’s just masking an issue that’s perhaps somewhere else. Please advise.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your report. It would be very helpful to know more about what AJAX operation is causing this notice because it is unusual for WordPress to define the DOING_AJAX constant without a defined action value. Every WordPress and MLA operation I’ve been able to try defines the “action” variable. I would like to be able to reproduce your problem so I completely understand it. You could log additional information by going to the Settings/Media Library Assistant Debug tab and setting the “MLA Reporting” level to 3. That would add the content of the $_REQUEST variable to the log for further investigation. It looks like the request is coming from some “front end” operation, not an admin mode operation, because a similar test on line 58 is not triggering any message; is that right?

    In any case, the message is harmless because the logic conditioned by the test is only needed for a specific MLA operation. I do not think there is any other MLA-specific issue. I will go through the code and test for the presence of action where required, but any additional information you can provide would be helpful.

    Thread Starter alx359

    (@alx359)

    Thanks for the sensible path toward a fix, David! I’m not yet sure why/when the notice appears. I’ve done the debug settings you’d suggested, and will report as soon as something more concrete appears in the logs. Cheers!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and for activating the logging.

    I have uploaded a new MLA Development Version dated 20190114 that contains a fix for your issue. It also reduces the amount of uninteresting information written to the error log when MLA AJAX debugging is turned on.

    You can find step-by-step instructions for using the Development Version in this earlier topic:

    MLA errors when using plugin

    If you get a chance to try the Development Version please let me know how it works for you. Thanks for your help with this issue.

    Thread Starter alx359

    (@alx359)

    I installed the dev version, and see you’ve specifically handled the lack of action with a new if-clause on line 40.

    However, now I’m getting the notice on line 65:

    [15-Jan-2019 16:04:29 UTC] PHP Notice: Undefined index: action in plugins/media-library-assistant/includes/class-mla-ajax.php on line 65

    line 65:
    if ( ( defined('DOING_AJAX') && DOING_AJAX ) && ( 'add-' == substr( $_POST['action'], 0, 4 ) ) ) {

    The level-3 reporting doesn’t seem to be helping narrowing down the culprit. This is the log entry before the notice above:

    [15-Jan-2019 16:04:29 UTC] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
      'action' => 'wp_1_wc_privacy_cleanup',
      'nonce' => '191c84ba7c',
      0 => 
      array (
        'task' => 'trash_pending_orders',
      ),
      1 => 
      array (
        'task' => 'trash_failed_orders',
      ),
      2 => 
      array (
        'task' => 'trash_cancelled_orders',
      ),
      3 => 
      array (
        'task' => 'anonymize_completed_orders',
      ),
      4 => 
      array (
        'task' => 'delete_inactive_accounts',
      ),
    )
    Thread Starter alx359

    (@alx359)

    Another example:

    [15-Jan-2019 17:30:25 UTC] 600 MLACore::mla_plugins_loaded_action() MLA 2.77 (20190114) mla_debug_level 0x3
    [15-Jan-2019 17:30:48 UTC] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
      'action' => 'GOTMLS_logintime',
      'GOTMLS_sess' => '1547573439593',
    )
    [15-Jan-2019 17:30:48 UTC] PHP Notice:  Undefined index: action in plugins/media-library-assistant/includes/class-mla-ajax.php on line 65
    [15-Jan-2019 17:30:51 UTC] 600 MLACore::mla_plugins_loaded_action() MLA 2.77 (20190114) mla_debug_level 0x3
    [15-Jan-2019 17:30:53 UTC] 600 MLACore::mla_plugins_loaded_action() MLA 2.77 (20190114) mla_debug_level 0x3
    [15-Jan-2019 17:30:53 UTC] 600 MLACore::mla_plugins_loaded_action() MLA 2.77 (20190114) mla_debug_level 0x3
    [15-Jan-2019 17:30:54 UTC] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
      'action' => 'gadwp_backend_item_reports',
      'gadwp_security_backend_item_reports' => '1a24c1dc59',
      'projectId' => 'false',
      'from' => '30daysAgo',
      'to' => 'yesterday',
      'query' => 'sessions,bottomstats',
    )
    Plugin Author David Lingren

    (@dglingren)

    Thanks for the examples and additional information. The examples do not illuminate the original missing action issue but they are helpful.

    I have uploaded a new MLA Development Version dated 20190115 that contains a fix for the “line 65” issue. I have also reviewed all the other references to $_POST['action'] and changed them to $_REQUEST['action'] where appropriate.

    If you get a chance to try the updated Development Version please let me know how it works for you. Thanks for your patience and continued help with this issue.

    Thread Starter alx359

    (@alx359)

    I installed the latest dev version, and for the next 24h or so the log has been cleanly reporting without further issues. Looks fixed to me now, and I’m marked it as resolved. Perfect support as always, thank you!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news. Don’t forget to deactivate the MLA debug logging you set up to investigate the original problem.

    The fixes will go out in the next MLA version and you shouldn’t have to do anything else. Please update this topic if you notice any related problems in the interim. Thanks again for your help.

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

The topic ‘Undefined index: action’ is closed to new replies.