Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PHP Error when loading Backup & Restore page

    Scheduled Pinned Locked Moved Plus 23.01 Development Snapshots (Retired)
    7 Posts 3 Posters 902 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      chickendog
      last edited by chickendog

      Discovered a bug in 23.01.b.20230106.0600

      Seems there is an issue enumerating the packages installed when loading the Backup & Restore page when there are no packages installed on the system.

      Steps to reproduce

      1. Have no packages installed.
      2. Install a package (e.g. System_patches)
      3. Remove the package - you now have no packages installed on the system again.
      4. Click on Diagnostics > Backup & Restore. You should be met with the below error message.
      PHP ERROR: Type: 1, File: /usr/local/www/diag_backup.php, Line: 280, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/diag_backup.php:280
      Stack trace:
      #0 {main}
      thrown @ 2023-01-14 12:36:28
      

      Found a temp fix can be done by editing the /cf/conf/config.xml and removing the following empty tags.

      <installedpackages>
      </installedpackages>
      

      As such seems to be some kind of enumeration error when there are no packages installed on the system, by removing the tags you negate the checks to load the Reinstall packages section of the Backup & Restore page so it loads fine.

      PHP_errors.log.txt

      R 1 Reply Last reply Reply Quote 0
      • R
        rcoleman-netgate Netgate @chickendog
        last edited by

        @chickendog Can you upgrade to the current release? Your build appears to be more than a week old (a buildstamp of Jan 6, 2023 at 6am).

        Ryan
        Repeat, after me: MESH IS THE DEVIL! MESH IS THE DEVIL!
        Requesting firmware for your Netgate device? https://go.netgate.com
        Switching: Mikrotik, Netgear, Extreme
        Wireless: Aruba, Ubiquiti

        C 1 Reply Last reply Reply Quote 0
        • C
          chickendog @rcoleman-netgate
          last edited by

          @rcoleman-netgate Yes but that is the latest build available on the 23.01 branch as of today. I think they freezed it?

          R 1 Reply Last reply Reply Quote 0
          • R
            rcoleman-netgate Netgate @chickendog
            last edited by

            @chickendog It's definitely possible - I don't follow the engineering progress closely enough to know for certain one way or the other.

            Ryan
            Repeat, after me: MESH IS THE DEVIL! MESH IS THE DEVIL!
            Requesting firmware for your Netgate device? https://go.netgate.com
            Switching: Mikrotik, Netgear, Extreme
            Wireless: Aruba, Ubiquiti

            C 1 Reply Last reply Reply Quote 0
            • C
              chickendog @rcoleman-netgate
              last edited by chickendog

              @rcoleman-netgate Dev said so here https://forum.netgate.com/post/1080237

              R 1 Reply Last reply Reply Quote 0
              • R
                rcoleman-netgate Netgate @chickendog
                last edited by

                @chickendog Ahh, yeah, Jim's one of our engineers. I am doing other testing internally so I don't get to see the public build numbers. We are in our own bubble here in TAC :D

                Ryan
                Repeat, after me: MESH IS THE DEVIL! MESH IS THE DEVIL!
                Requesting firmware for your Netgate device? https://go.netgate.com
                Switching: Mikrotik, Netgear, Extreme
                Wireless: Aruba, Ubiquiti

                1 Reply Last reply Reply Quote 2
                • jimpJ
                  jimp Rebel Alliance Developer Netgate
                  last edited by

                  Oddly enough I can't reproduce the PHP error but I can see where it would happen (and should happen). I've got a change that should fix it, though:

                  https://redmine.pfsense.org/issues/13876

                  index 18bb573b0c..21d1847e09 100644
                  --- a/src/usr/local/www/diag_backup.php
                  +++ b/src/usr/local/www/diag_backup.php
                  @@ -268,10 +268,12 @@ $section->add($group);
                   
                   $form->add($section);
                   
                  -if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("packagelock"))) {
                  +$has_installed_packages = !empty(config_get_path('installedpackages/package', []));
                  +
                  +if ($has_installed_packages || (is_subsystem_dirty("packagelock"))) {
                          $section = new Form_Section('Package Functions');
                   
                  -       if ($config['installedpackages']['package'] != "") {
                  +       if ($has_installed_packages) {
                                  $group = new Form_Group('');
                                  // Note: ID attribute of each element created is to be unique.  Not being used, suppressing it.
                                  $group->add(new Form_Button(
                  

                  Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                  Need help fast? Netgate Global Support!

                  Do not Chat/PM for help!

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.