Project

General

Profile

Bug #11801

PHP error in ``upgrade_212_to_213()`` when upgrading certain IPsec tunnels

Added by Jim Pingle about 1 month ago. Updated 1 day ago.

Status:
Feedback
Priority:
Normal
Assignee:
Category:
Configuration Upgrade
Target version:
Start date:
04/12/2021
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
21.05
Release Notes:
Default
Affected Version:
2.5.x
Affected Architecture:
All

Description

Certain IPsec tunnel configurations fail to upgrade cleanly with the following error:

Fatal error: Uncaught Error: Cannot unset string offsets in /etc/inc/upgrade_config.inc:6437
Stack trace:
#0 /etc/inc/config.lib.inc(482): upgrade_212_to_213()
#1 /etc/rc.bootup(132): convert_config()
#2 {main}
  thrown in /etc/inc/upgrade_config.inc on line 6437
PHP ERROR: Type: 1, File: /etc/inc/upgrade_config.inc, Line: 6437, Message: Uncaught Error: Cannot unset string offsets in /etc/inc/upgrade_config.inc:6437
Stack trace:
#0 /etc/inc/config.lib.inc(482): upgrade_212_to_213()
#1 /etc/rc.bootup(132): convert_config()
#2 {main}
  thrown

Appears to be this line:

unset($ph1ent['reauth_enable'], $ph1ent['rekey_enable'], $ph1ent['margintime'], $ph1ent['over_time']);

Separating the test and checking for existence first does not produce an error:

        if (isset($ph1ent['reauth_enable'])) {
            unset($ph1ent['reauth_enable']);
        }
        if (isset($ph1ent['rekey_enable'])) {
            unset($ph1ent['rekey_enable']);
        }
        if (isset($ph1ent['margintime'])) {
            unset($ph1ent['margintime']);
        }
        if (isset($ph1ent['over_time'])) {
            unset($ph1ent['over_time']);
        }

Forum thread: https://forum.netgate.com/topic/162843/upgrade-from-2-4-5-to-21-01-fatal-error-in-upgrade_config

Associated revisions

Revision a6edfe27 (diff)
Added by Jim Pingle 16 days ago

Fix PHP error in upgrade code. Fixes #11801

Change upgrade_212_to_213() so it unsets variables individually after
first testing if they are set. This avoids an error if a tunnel entry
does not contain a value or has a deeper config issue which renders it
invalid.

Revision 7a010ad2 (diff)
Added by Jim Pingle 16 days ago

Fix PHP error in upgrade code. Fixes #11801

Change upgrade_212_to_213() so it unsets variables individually after
first testing if they are set. This avoids an error if a tunnel entry
does not contain a value or has a deeper config issue which renders it
invalid.

(cherry picked from commit a6edfe2763df01132d56199faf9ac1dc99471f1c)

History

#1 Updated by Jim Pingle 16 days ago

  • Target version changed from CE-Next to 2.6.0

#2 Updated by Jim Pingle 16 days ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#3 Updated by Jim Pingle 2 days ago

  • Plus Target Version set to 21.05

#4 Updated by Jim Pingle 2 days ago

Already in 21.05 branch.

#5 Updated by Jim Pingle 1 day ago

  • Subject changed from PHP error in upgrade_212_to_213() when upgrading certain IPsec tunnels to PHP error in ``upgrade_212_to_213()`` when upgrading certain IPsec tunnels

Updating subject for release notes.

Also available in: Atom PDF