Project

General

Profile

Actions

Regression #13719

closed

Feature #13446: Upgrade PHP from 7.4 to 8.1

PHP8.1 error when saving DHCP Server settings.

Added by Eric R 2 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
DHCP (IPv4)
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.01
Release Notes:
Force Exclusion
Affected Version:
2.7.0
Affected Architecture:
All

Description

BRANCH: DEVEL version (devel)
VERSION: 2.7.0.a.20221202.0600
ERROR MESSAGE: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454Stack trace:#0 {main}thrown in /usr/local/www/services_dhcp.php on line 454

Currently having a weird issue where any time I try to "Save" any changes to the DHCP Server. Even if I try to save without making any changes I get an error. I even tried making a second DHCP Server for a different interface and the same error occurs. I can't save anything without an error. I am getting the following error message:

  • PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454Stack trace:#0 {main}thrown in /usr/local/www/services_dhcp.php on line 454

I checked line 454 and it contains the following: if (is_array($config['virtualip']['vip'])) {

// Disallow a range that includes the virtualip
if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $vip) {
if ($vip['interface'] == $if) {
if ($vip['subnet'] && is_inrange_v4($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) {
$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."), $vip['subnet']);

Not sure if it's a bug in the DEV version I am on or if there is something else causing this to fail. Didn't have this issue a few days ago when I made some DNS changes but also haven't had to touch it until now.


Files

PHP_errors (1).log (238 Bytes) PHP_errors (1).log Eric R, 12/02/2022 03:21 PM
BUG.png (181 KB) BUG.png Steph Swiss, 12/04/2022 10:02 AM

Related issues

Has duplicate Regression #13629: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.phpDuplicate

Actions
Actions #1

Updated by Steph Swiss 2 months ago

Hello and sorry for my bad English :-(

I just registered to be able to write here. I have exactly the same bug with my version "2.7.0-DEVELOPMENT (amd64) built on Fri Dec 02 06:04:46 UTC 2022 FreeBSD 14.0-CURRENT".

I had no other choice than to put a 2.7 version because the 2.6 version doesn't recognize my network cards (with OpenSense yes, but I'm not "good" with the interface and I can't find enough tutorials to do installations, while for pfsense you can find a lot of information.

So I'm stuck with this BUG because I can't change and therefore can't set IP addresses.

I remain at disposal if I need to log (just tell me how to do it).

Thanks for all your help and for your work on this version 2.7 !
Steph

Actions #2

Updated by aleksei prokofiev about 2 months ago

Tested on
2.7.0-DEVELOPMENT (amd64)
built on Fri Dec 02 06:04:46 UTC 2022
FreeBSD 14.0-CURRENT

I can not reproduce such error.

Actions #3

Updated by Steph Swiss about 2 months ago

You are very lucky because on the "built on Tue Nov 29 06:04:43 UTC 2022" and on the last one "the same one you have" I systematically have this problem.

By not changing anything, just pressing the "SAVE" button I have this

"Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454 Stack trace: #0 {main} thrown in /usr/local/www/services_dhcp. php on line 454 PHP ERROR: Type: 1, File: /usr/local/www/services_dhcp.php, Line: 454, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454 Stack trace: #0 {main} thrown"

Thanks for your answer ;-)

Actions #4

Updated by Steph Swiss about 2 months ago

Hello,

I found how to "fix" (now I don't have this PHP error message anymore).
To start in "Services > DHCP Server > LAN" and in "Range" I had under "From" 192.168.1.10 and under "To" 192.168.1.245, these values were put originally (I didn't put anything like that).
I made a backup "Diagnostics > Backup & Restore" > "Backup Configuration" > "ALL".

Then I edited the backup .xml file (with a Windows editor) and in the section of the parts of the addresses above I put for "From" 192.168.1.100 (before 192.168.1.10) and under "To" 192.168.1.199 (before 192.168.1.245). I saved the .xml file thus modified.

Then, from the WEB page, I went to "Diagnostics > Backup & Restore" > "Restore Backup" selecting my modified .xml file and after an automatic reboot of my pfsense, if I go back to "Service > DHCP Server > LAN" I can, like in my tests before when I had the PHP error, just press the "SAVE" button .... Now no more error!!!

I'm not a programmer, my test is "empirical", but it seems to me that there is a bug, because I never entered the couple of addresses "192.168.1.10 and 192.168.1.245" (I never choose such a weird range for me). I always prefer to put something like "192.168.1.100 and 192.168.1.199" which I find more logical (or pretty).

I don't explain this problem and I don't explain how I got the idea to do this kind of manipulation, except that I didn't like the "original" range visually, so I found this "solution" by chance.

I remain at your disposal if needed :-)
Steph

Actions #5

Updated by Steph Swiss about 2 months ago

OUPS ... in fact I still have the BUG (PHP error) when I use the "SAVE" button, however I finally managed to "fix" a DHCP address (192.168.1.88) so below 192.168.1.100 as I wanted, while before I couldn't without getting a message that I had to choose an address below those set for DHCP and as it was "192.168.1.10" it was impossible to choose (for example "88")

Sorry for my false joy. There is still a problem, but now the range values are as I want them.

Actions #6

Updated by Steph Swiss about 2 months ago

Debugging output can be collected to share with pfSense developers or others providing support or assistance.

Crash report begins. Anonymous machine information:

amd64
14.0-CURRENT
FreeBSD 14.0-CURRENT #0 devel-main-n255817-2e86726b5f5: Tue Nov 29 06:29:29 UTC 2022 root@freebsd:/var/jenkins/workspace/pfSense-CE-snapshots-master-main/obj/amd64/ncXeZ3Ec/var/jenkins/workspace/pfSense-CE-snapshots-master-main/sources/FreeBSD-src-dev

Crash report details:

PHP Errors:
[04-Dec-2022 17:08:58 Europe/Zurich] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454
Stack trace:
#0 {main}
thrown in /usr/local/www/services_dhcp.php on line 454
[04-Dec-2022 17:09:03 Europe/Zurich] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php:454
Stack trace:
#0 {main}
thrown in /usr/local/www/services_dhcp.php on line 454

No FreeBSD crash data found.

Actions #7

Updated by Marcos M about 2 months ago

  • File dhcp.patch added
  • Tracker changed from Bug to Regression
  • Subject changed from Fatal error when trying to alter any DHCP Server (2.7.0-DEVEL) to PHP8.1 error when saving DHCP Server settings.
  • Status changed from New to Pull Request Review
  • Assignee set to Marcos M
  • Target version set to 2.7.0
  • Parent task set to #13446
  • Plus Target Version set to 23.01
  • Affected Architecture All added
  • Affected Architecture deleted (amd64)

https://gitlab.netgate.com/pfSense/pfSense/-/merge_requests/967

Copy/paste/apply the attached patch via the System Patches package (only tested on 23.01.a.20221202.0600).

Actions #8

Updated by Eric R about 2 months ago

I determined what was causing the issue. It seems to be caused by the pfBlockerNG-devel package. I had a second router I was setting up and checked the DHCP server functionality after ever change. Everything worked fine until I installed the pfBlockerNG-devel package. Uninstalling it does not remedy the issue either. A full factory reset is required.

Package specifics
  • pfBlockerNG-devel
  • Version: 3.1.0_11
Actions #9

Updated by Eric R about 2 months ago

Found a workaround.

You can reconfigure the interfaces and DHCP Servers via console to the box. Had no issues making changes via console and all of them took.

Actions #10

Updated by Steph Swiss about 2 months ago

What is strange is that I installed 2.6.0 from a USB stick, then unsuccessfully because of my i-226 network cards, reinstalled version 2.7 DEV from a USB stick, then restored my backup .xml file and I still have the bug.

This clearly means that the uninstallation of "NGBlocker" has kept traces in the .xml file of my complete backup

So I have to find these traces and remove them manually, if I want to keep all my other settings .... not easy (for me).

Actions #11

Updated by Marcos M about 2 months ago

If you are able to reproduce the problem, please test the patch.

Actions #12

Updated by Eric R about 2 months ago

Marcos, can you verify the link? I am unable to access the one you provided. Showing as unreachable.

Actions #13

Updated by Flole Systems about 2 months ago

That link is not public, that's why a patch file was attached aswell.

Actions #14

Updated by Eric R about 2 months ago

Ah, my mistake. Missed that. Just downloaded the patch and will apply it and report results this afternoon.

Actions #15

Updated by Eric R about 2 months ago

CONFIRMED :

The patch posted by Marcos resolves the issue, even with pfBlockerNG-devel installed.

Actions #16

Updated by Marcos M about 2 months ago

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100
Actions #17

Updated by Marcos M about 2 months ago

  • File deleted (dhcp.patch)
Actions #18

Updated by Marcos M about 2 months ago

  • Status changed from Feedback to Resolved

Thanks for confirming.

Actions #19

Updated by Jim Pingle about 2 months ago

  • Has duplicate Regression #13629: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/services_dhcp.php added
Actions #20

Updated by Jim Pingle about 2 months ago

  • Release Notes changed from Default to Force Exclusion
Actions

Also available in: Atom PDF