• Resolved Chad Cloman

    (@chadcloman)


    To recreate: go to a URL with this format for any site using SDM:
    https://www.example.com/?sdm_process_download=1

    I’ve been getting some requests from search bots that include the “sdm_process_download=1” query parameter but nothing else. This correctly returns an error message but also (incorrectly) generates this PHP warning:

    PHP Warning: Undefined array key “download_id” in /<my-server-path>/wp-content/plugins/simple-download-monitor/includes/sdm-download-request-handler.php on line 7

    I’ve looked at the code in sdm-download-request-handler.php, and it doesn’t check if ‘download_id’ exists until after it tries to access it.

    I suggest modifying line #7 from this:

    $download_id= absint( $_REQUEST['download_id'] );

    to this:

    $download_id = absint( $_REQUEST['download_id'] ?? 0 );

    or the equivalent:

    $download_id = absint( isset( $_REQUEST['download_id'] ) ? $_REQUEST['download_id'] : 0 );

    Thank you, hope this helps.

    • This topic was modified 8 months, 2 weeks ago by Chad Cloman. Reason: typo
    • This topic was modified 8 months, 2 weeks ago by Chad Cloman. Reason: another typo

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Thank you for reaching out to us and sharing your findings. I have submitted a message to the developers to investigate further your suggestion.

    Kind regards.

    Plugin Author mra13

    (@mra13)

    Thank you. I have updated the code for it in the repository. It will go out with the next release of the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP warning sdm-download-request-handler.php Undefined array key “download_id”’ is closed to new replies.