Bug #15423
closedPHP error when applying interface settings if the ``/tmp/.interfaces.apply`` file is present but empty
100%
Description
If the /tmp/.interfaces.apply
file is present but empty it can lead to a PHP error when applying interface settings on interface.php
:
Apr 21 06:55:04 pfsim php-fpm[429]: /interfaces.php: PHP ERROR: Type: 1, File: /etc/inc/util.inc, Line: 3723, Message: Uncaught TypeError: array_set_path(): Argument #1 ($arr) must be of type array, false given, called in /usr/local/www/interfaces.php on line 1781 and defined in /etc/inc/util.inc:3723 Apr 21 06:55:04 pfsim php-fpm[429]: Stack trace: Apr 21 06:55:04 pfsim php-fpm[429]: #0 /usr/local/www/interfaces.php(1781): array_set_path(false, 'lan/ifcfg', Array) Apr 21 06:55:04 pfsim php-fpm[429]: #1 {main} Apr 21 06:55:04 pfsim php-fpm[429]: thrown
The code checks if the file is present but doesn't ensure the contents are sane. It should check if the unserialize()
result is valid or not before proceeding and wipe the file if it isn't.
Note that this read happens twice in interfaces.php
around line 472 (Plus)/453 (CE) and line 1777 (Plus)/1721 (CE)
See also: https://forum.netgate.com/topic/187547/netgate-7100-24-03-rc-50x-error-when-modifying-interfaces
Updated by Jim Pingle 6 months ago
- Plus Target Version changed from 24.07 to 24.08
Updated by Marcos M 6 months ago
- Status changed from Pull Request Review to Feedback
- % Done changed from 0 to 100
Applied in changeset 82e22457b04bf44c55cc1c4c6df91670ddb3e77c.
Updated by Georgiy Tyutyunnik 6 months ago
reproduce on 24.03 by manually creating empty file /tmp/.interfaces.apply
tested on
24.08-DEVELOPMENT (amd64)
built on Fri Jun 7 6:01:00 UTC 2024
FreeBSD 15.0-CURRENT
this version fixes the issue
Updated by Jim Pingle about 2 months ago
- Plus Target Version changed from 24.08 to 24.11