Actions
Bug #15423
closedPHP error when applying interface settings if the ``/tmp/.interfaces.apply`` file is present but empty
Start date:
Due date:
% Done:
100%
Estimated time:
Plus Target Version:
24.11
Release Notes:
Default
Affected Version:
Affected Architecture:
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
Actions