Project

General

Profile

Actions

Bug #14579

closed
JL JP

PHP error in ``handle_wireless_post()`` when toggling some wireless interface options

Bug #14579: PHP error in ``handle_wireless_post()`` when toggling some wireless interface options

Added by Jonathan Lee about 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Wireless
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.09
Release Notes:
Default
Affected Version:
Affected Architecture:
SG-2100

Description

Hello fellow redmine community members. I found a php error when I change SSID to hidden. WiFi card works otherwise.

[14-Jul-2023 17:16:50 US/Pacific] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1800
Stack trace:
#0 /usr/local/www/interfaces.php(1676): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1800
[14-Jul-2023 17:17:38 US/Pacific] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1800
Stack trace:
#0 /usr/local/www/interfaces.php(1676): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1800
[14-Jul-2023 17:18:06 US/Pacific] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1800
Stack trace:
#0 /usr/local/www/interfaces.php(1676): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1800


Files

PHP_errors (4).log (891 Bytes) PHP_errors (4).log logs Jonathan Lee, 07/15/2023 12:36 AM

Related issues 1 (0 open1 closed)

Related to Todo #14790: Eliminate direct config access in ``interfaces.php``ResolvedJim Pingle

Actions

KP Updated by Kris Phillips about 3 years ago Actions #1

Tested this on 23.09 DEVELOPMENT builds. I'm not able to reproduce this, so either something else is needed to recreate this or it was fixed along the way.

JP Updated by Jim Pingle about 3 years ago Actions #2

  • Project changed from pfSense Plus to pfSense
  • Category changed from Wireless to Wireless
  • Target version set to 2.8.0
  • Affected Plus Version deleted (23.05.1)
  • Plus Target Version set to 23.09

The same could happen on CE, not just Plus. There are several places there for that and other settings nearby which could lead to PHP errors. On CE the lines in this error message are around ~1747, not ~1800. It's blindly setting a value several layers deep in a variable without checking if the components are an array first.

That whole section is a bit of a mess and could do with being updated to use safe array access get/set functions.

JP Updated by Jim Pingle about 3 years ago Actions #3

  • Assignee set to Jim Pingle

MP Updated by Michael Pfsense about 3 years ago Actions #4

I also have this problem when trying to take a wificard interface from SSID broadcast to no SSID broadcast on 2.7.0-RELEASE (amd64)

MP Updated by Michael Pfsense about 3 years ago Actions #5

Crash report begins. Anonymous machine information:

amd64
14.0-CURRENT
FreeBSD 14.0-CURRENT #1 RELENG_2_7_0-n255866-686c8d3c1f0: Wed Jun 28 04:21:19 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-CE-snapshots-2_7_0-main/obj/amd64/LwYAddCr/var/jenkins/workspace/pfSense-CE-snapshots-2_7_0-main/sources/FreeBSD-src-REL

Crash report details:

PHP Errors:
[09-Sep-2023 16:25:16 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:29 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:43 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:54 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748

No FreeBSD crash data found.

KP Updated by Kris Phillips almost 3 years ago Actions #6

Michael Pfsense wrote in #note-5:

Crash report begins. Anonymous machine information:

amd64
14.0-CURRENT
FreeBSD 14.0-CURRENT #1 RELENG_2_7_0-n255866-686c8d3c1f0: Wed Jun 28 04:21:19 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-CE-snapshots-2_7_0-main/obj/amd64/LwYAddCr/var/jenkins/workspace/pfSense-CE-snapshots-2_7_0-main/sources/FreeBSD-src-REL

Crash report details:

PHP Errors:
[09-Sep-2023 16:25:16 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:29 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:43 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748
[09-Sep-2023 16:25:54 America/New_York] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1748
Stack trace:
#0 /usr/local/www/interfaces.php(1632): handle_wireless_post()
#1 {main}
thrown in /usr/local/www/interfaces.php on line 1748

No FreeBSD crash data found.

Hello Michael,

What are the exact reproduction steps you are taking to recreate this? I'm still unable to reproduce this issue on my test hardware.

JP Updated by Jim Pingle almost 3 years ago Actions #7

  • Related to Todo #14790: Eliminate direct config access in ``interfaces.php`` added

JP Updated by Jim Pingle almost 3 years ago Actions #8

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

Applied in changeset commit:1857f9fbf03ad0ea7435c87a3289c5d6da50dc54.

JP Updated by Jim Pingle almost 3 years ago Actions #9

  • Subject changed from handle_wireless_post() php error to PHP error in ``handle_wireless_post()`` when toggling some wireless interface options

Updating subject for release notes.

LP Updated by Lev Prokofev almost 3 years ago Actions #10

I was able to replicate the issue on

23.09-DEVELOPMENT (amd64)
built on Thu Sep 07 06:05:43 UTC 2023
FreeBSD 14.0-ALPHA2

the changeset (1857f9fbf03ad0ea7435c87a3289c5d6da50dc54) was applied, going to test it on the latest build

PHP ERROR: Type: 1, File: /usr/local/www/interfaces.php, Line: 1796, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/interfaces.php:1796
Stack trace:
#0 /usr/local/www/interfaces.php(1672): handle_wireless_post()
#1 {main}
thrown @ 2023-09-23 10:43:51

LP Updated by Lev Prokofev almost 3 years ago Actions #11

Can't reproduce on the

23.09-DEVELOPMENT (amd64)
built on 20230922-1539
FreeBSD 14.0-CURRENT

I suppose it can be marked as resolved.

JP Updated by Jim Pingle almost 3 years ago Actions #12

  • Status changed from Feedback to Resolved

JL Updated by Jonathan Lee almost 3 years ago Actions #13

Thank you !!

JP Updated by Jim Pingle almost 3 years ago Actions #14

  • Target version changed from 2.8.0 to 2.7.1
Actions

Also available in: Atom