• Resolved xprojectsx

    (@xprojectsx)


    Hello,
    I am very happy to find this plugin but after I believe configuring it correctly (test connection works from wp admin), I am getting the fatal error below when trying to use it to login:

    PHP Fatal error: Cannot redeclare exlog_modify_repeater_item_data_for_view_use() (previously declared in /home/site/public_html/wp-content/plugins/external-login/options/wpconfig_options.php:24) in /home/site/public_html/wp-content/plugins/external-login/options/wpconfig_options.php on line 24

    • This topic was modified 6 years, 2 months ago by xprojectsx.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author tbenyon

    (@tbenyon)

    Hey @xprojectsx,

    I can’t replicate this straight away. Can you confirm which version of PHP you are running?

    My theory at the moment (just a guess) is that you are using a version of PHP older than the plugin currently supports and it doesn’t like the way I’ve nested a function in a function.

    function exlog_modify_repeater_data_for_view_use($repeater_data) {
        function exlog_modify_repeater_item_data_for_view_use($repeater_data) {
            $formatted_data = array();
            if (is_array($repeater_data)) {
                foreach ($repeater_data as $repeater_item_data) {
                    $formatted_repeater_items_data = array();
                    foreach ($repeater_item_data as $repeater_item_datum) {
                        if ($repeater_item_datum['repeater_field']) {
                            $value = exlog_modify_repeater_item_data_for_view_use($repeater_item_datum['value']);
                        } else {
                            $value = $repeater_item_datum['value'];
                        }
                        $formatted_repeater_items_data[$repeater_item_datum['name']] = $value;
                    }
                    array_push($formatted_data, $formatted_repeater_items_data);
                }
                return $formatted_data;
            } else {
                return $repeater_data;
            }
        }
    
        return exlog_modify_repeater_item_data_for_view_use($repeater_data);
    }

    I am guessing each time exlog_modify_repeater_data_for_view_use() is run it is trying to redeclare exlog_modify_repeater_item_data_for_view_use().

    The issue is in the following file:
    /wp-content/plugins/external-login/options/wpconfig_options.php

    If your able to, you could test if this theory is correct by modifying the code to this:

    function exlog_modify_repeater_item_data_for_view_use($repeater_data) {
        $formatted_data = array();
        if (is_array($repeater_data)) {
            foreach ($repeater_data as $repeater_item_data) {
                $formatted_repeater_items_data = array();
                foreach ($repeater_item_data as $repeater_item_datum) {
                    if ($repeater_item_datum['repeater_field']) {
                        $value = exlog_modify_repeater_item_data_for_view_use($repeater_item_datum['value']);
                    } else {
                        $value = $repeater_item_datum['value'];
                    }
                    $formatted_repeater_items_data[$repeater_item_datum['name']] = $value;
                }
                array_push($formatted_data, $formatted_repeater_items_data);
            }
            return $formatted_data;
        } else {
            return $repeater_data;
        }
    }
    
    function exlog_modify_repeater_data_for_view_use($repeater_data) {
        return exlog_modify_repeater_item_data_for_view_use($repeater_data);
    }

    If you could still let me know which version of PHP or even better, if you’re running a lower version than the currently supported “5.6.34 or higher” to up your version.

    Thanks,

    Tom

    Thread Starter xprojectsx

    (@xprojectsx)

    Thank you for the quick reply. First, updating the code worked! To answer your question, I was running 5.6. I updated it to 7.2 but that did not resolve the issue even after restarting apache and emptying cache. When I updated the code then it worked.

    Thank you very much.

    Paul

    Plugin Author tbenyon

    (@tbenyon)

    Hey Paul,

    Thanks for the details. It’s really helpful.

    I’ll try and refactor this code ASAP and push an update.

    I’ll leave this ticket open until a fix is deployed.

    I saw you’ve written another couple of support questions and I’ll try and get to those as soon as I can.

    Thanks,

    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘fatal error’ is closed to new replies.