PHP error (2): Undefined array key "v6_2"

Expected Behaviour:

DNS change gives the following error on save
Ubuntu 20.04, Php 7.4x

Actual Behaviour:

Error

There was a problem applying your settings.
Debugging information:
PHP error (2): Undefined array key "v6_2" in /var/www/html/admin/scripts/pi-hole/php/savesettings.php:276

Request how to resolve.

Please generate a debug log and post the token here.

I have had this same issue, it seems to me to be related to ipv6 , as i do not have ipv6, the options are greyed out to select on the dns page of pihole. I have confirmed my current ISP is not providing me ipv6 connectivity.

That being said, the error occurs on line 276, which seems to be looping through the predefined servers and appending to the dnsserverslist, as they are greyed out , i suspect the keys 'v6-1' and 'v6-2' does not exist. Please correct me if i am wrong.

                        case "DNS":

                                $DNSservers = [];
                                // Add selected predefined servers to list
                                foreach ($DNSserverslist as $key => $value)
                                {
                                        foreach(["v4_1", "v4_2", "v6_1", "v6_2"] as $type)
                                        {
                                                if(@array_key_exists("DNSserver".str_replace(".","_",$value[$type]),$_POST))
                                                {
                                                        array_push($DNSservers,$value[$type]);
                                                }
                                        }
                                }

Initially i edited savesettings.php:276, removing "v6_2: from the loop, this proceeded to change the error to "v6_1" not found, which lead me to remove that too.

Currently my edited file looks like and the error is not occuring anymore

                                $DNSservers = [];
                                // Add selected predefined servers to list
                                foreach ($DNSserverslist as $key => $value)
                                {
                                        foreach(["v4_1", "v4_2"] as $type)
                                        {
                                                if(@array_key_exists("DNSserver".str_replace(".","_",$value[$type]),$_POST))
                                                {
                                                        array_push($DNSservers,$value[$type]);
                                                }
                                        }
                                }

some furrther info i used to assist me:
https://www.reddit.com/r/pihole/comments/dtzhil/problem_with_ipv6_upstream_dns/

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.