Bug #14432
closedPHP error when failing to write ``config.cache``
100%
Description
On 23.05, the following PHP errors can be triggered:
[29-May-2023 19:10:01 Australia/Melbourne] PHP Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172 Stack trace: #0 /etc/inc/config.lib.inc(172): fwrite(false, 'a:35:{s:7:"vers...') #1 /etc/inc/config.lib.inc(147): generate_config_cache(Array) #2 /etc/inc/config.gui.inc(53): parse_config() #3 /etc/inc/auth.inc(34): require_once('/etc/inc/config...') #4 /etc/inc/openvpn.inc(36): require_once('/etc/inc/auth.i...') #5 /etc/inc/filter.inc(30): require_once('/etc/inc/openvp...') #6 /etc/inc/ipsec.inc(25): require_once('/etc/inc/filter...') #7 /etc/inc/gwlb.inc(27): require_once('/etc/inc/ipsec....') #8 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...') #9 /etc/inc/notices.inc(26): require_once('/etc/inc/functi...') #10 /etc/inc/config.inc(51): require_once('/etc/inc/notice...') #11 /usr/local/bin/telegraf_pfifgw.php(3): require_once('/etc/inc/config...') #12 {main} thrown in /etc/inc/config.lib.inc on line 172 [29-May-2023 19:10:01 Australia/Melbourne] PHP Fatal error: Uncaught ValueError: Path cannot be empty in /etc/inc/notices.inc:101 Stack trace: #0 /etc/inc/notices.inc(101): fopen('', 'w') #1 /etc/inc/config.lib.inc(1162): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors') #2 [internal function]: pfSense_clear_globals() #3 {main} thrown in /etc/inc/notices.inc on line 101
Potentially related:
https://redmine.pfsense.org/issues/14061
https://redmine.pfsense.org/issues/14031
Updated by Jim Pingle over 1 year ago
- Subject changed from PHP error with notices to PHP error when failing to write ``config.cache``
- Status changed from New to Incomplete
We need a better idea of how to reproduce this. The backtrace is similar to #14061 but that file referenced here -- "telegraf_pfifgw.php" -- does not exist anywhere in pfSense. Googling suggests it's from a third-party addon from an unofficial repo source for which we cannot be responsible.
If there is a way to reproduce it using only our code in base or our own packages, we can look into it more, but otherwise this should be closed and reported to whoever developed that script.
Updated by Steve Wheeler over 1 year ago
User still hitting this in 23.05:
[29-Jun-2023 09:09:22 Europe/London] PHP Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /etc/inc/config.lib.inc:172 Stack trace: #0 /etc/inc/config.lib.inc(172): fwrite(false, 'a:44:{s:7:"vers...') #1 /etc/inc/config.lib.inc(147): generate_config_cache(Array) #2 /etc/inc/config.inc(141): parse_config() #3 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...') #4 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...') #5 /etc/inc/notices.inc(26): require_once('/etc/inc/functi...') #6 /usr/local/pkg/nut/nut_email.php(24): require_once('/etc/inc/notice...') #7 {main} thrown in /etc/inc/config.lib.inc on line 172 [29-Jun-2023 09:09:22 Europe/London] PHP Fatal error: Uncaught ValueError: Path cannot be empty in /etc/inc/notices.inc:101 Stack trace: #0 /etc/inc/notices.inc(101): fopen('', 'w') #1 /etc/inc/config.lib.inc(1162): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors') #2 [internal function]: pfSense_clear_globals() #3 {main} thrown in /etc/inc/notices.inc on line 101
See: https://forum.netgate.com/topic/180488/crash-report-after-upgrade-to-23-05
In that case after updating the Snort package, though the notice looks to be from NUT.
Updated by Jim Pingle about 1 year ago
- Status changed from New to Feedback
- Assignee set to Jim Pingle
- Target version set to 2.8.0
- Plus Target Version set to 23.09
This should be fixed by 596a88fa42f0ac77bd2fc2be87b54457df11f64b
Updated by Jim Pingle about 1 year ago
- Status changed from Feedback to Resolved
- % Done changed from 0 to 100
Seems to be working as expected on dev snapshots.