Project

General

Profile

Actions

Bug #15907

closed

PHP error in Captive Portal with undefined zone interface list

Added by Danilo Zrenjanin 4 months ago. Updated 3 months ago.

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

100%

Estimated time:
Plus Target Version:
25.03
Release Notes:
Default
Affected Version:
Affected Architecture:

Description

Following the upgrade to version 24.11, the captive portal intermittently displays PHP error messages. However, production operations continue to function without any disruption.

I've attached the file containing the PHP error details.


Files

PHP_errors (7).log (34.9 KB) PHP_errors (7).log Danilo Zrenjanin, 12/06/2024 02:32 PM
Actions #1

Updated by Jim Pingle 4 months ago

  • Assignee set to Jim Pingle
  • Target version set to 2.8.0
  • Plus Target Version set to 25.01
[05-Dec-2024 09:37:19 Europe/Rome] PHP Fatal error:  Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /etc/inc/captiveportal.inc:1746
Stack trace:
#0 /etc/inc/captiveportal.inc(1746): explode()
#1 /etc/inc/captiveportal.inc(1802): portal_ip_from_client_ip()
#2 /etc/inc/captiveportal.inc(1823): portal_hostname_from_client_ip()
#3 /usr/local/captiveportal/index.php(60): portal_reply_page()
#4 {main}
  thrown in /etc/inc/captiveportal.inc on line 1746

Looks like this line shouldn't be using [] as the default, but "":

    $interfaces = array_filter(explode(",", config_get_path("captiveportal/{$cpzone}/interface", [])));

Actions #2

Updated by Jim Pingle 4 months ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #3

Updated by Jim Pingle 4 months ago

  • Subject changed from Intermittent PHP Error Messages in Captive Portal Post-Upgrade to Version 24.11 to PHP error in Captive Portal with undefined zone interface list
Actions #4

Updated by Jim Pingle 4 months ago

  • Plus Target Version changed from 25.01 to 25.03
Actions #5

Updated by Marcos M 4 months ago

  • Status changed from Feedback to Resolved
Actions #6

Updated by Gertjan KROEB 4 months ago

See also here : https://forum.netgate.com/topic/195520/issues-after-update-from-24-03-to-24-11/14
and here : https://forum.netgate.com/topic/195697/php-error-type-1

Afaik : portal_reply_page() presumes a valid $cpzone, or the test on line 59 ( if (empty($cpcfg)) { ) failed == no valid &cpzone parameter found.
portal_reply_page() (line 60, index.php, can not be sued here )

Actions #7

Updated by Jim Pingle 3 months ago

Gertjan KROEB wrote in #note-6:

See also here : https://forum.netgate.com/topic/195520/issues-after-update-from-24-03-to-24-11/14
and here : https://forum.netgate.com/topic/195697/php-error-type-1

Afaik : portal_reply_page() presumes a valid $cpzone, or the test on line 59 ( if (empty($cpcfg)) { ) failed == no valid &cpzone parameter found.
portal_reply_page() (line 60, index.php, can not be sued here )

Those are different, unrelated errors. Those belong in separate redmine issues.

Actions

Also available in: Atom PDF