PHP warning sdm-download-request-handler.php Undefined array key “download_id”
-
To recreate: go to a URL with this format for any site using SDM:
https://www.example.com/?sdm_process_download=1I’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, 1 week ago by . Reason: typo
- This topic was modified 8 months, 1 week ago by . Reason: another typo
The page I need help with: [log in to see the link]
- The topic ‘PHP warning sdm-download-request-handler.php Undefined array key “download_id”’ is closed to new replies.