formtools / module-submission_accounts

The Submission Accounts module.
https://docs.formtools.org/modules/submission_accounts/
GNU General Public License v3.0
2 stars 7 forks source link

500 fatal error due to each() function (line 80 of index) #17

Closed zerosonesfun closed 1 year ago

zerosonesfun commented 1 year ago

Due to the use of the each() function, (line 80 of index.php) which has been deprecated as of PHP 7.2 and removed in PHP 8, many will get a fatal error logging in as a regular user. To resolve this issue, you can use a foreach loop instead. Here's the updated version of your code:

// Construct the tab list
$view_tabs = ViewTabs::getViewTabs($view_id, true);
$tabs = array();
$same_page = General::getCleanPhpSelf();

foreach ($view_tabs as $key => $value) {
    $tabs[$key] = array(
        "tab_label" => $value["tab_label"],
        "tab_link" => "{$same_page}?tab=$key&form_id=$form_id&submission_id={$submission_id}"
    );
}
benkeen commented 1 year ago

Thanks @zerosonesfun! I'm very behind on this project but I'll try to get an update out soon.

benkeen commented 1 year ago

Thanks! The latest version now has this fix.