Bug #9860
closedIllegal string offset 'config' in /usr/local/pkg/tinc.inc on line 83
100%
Description
Crash report details:
PHP Errors:
[30-Oct-2019 08:46:07 Europe/Moscow] PHP Warning: Illegal string offset 'config' in /usr/local/pkg/tinc.inc on line 83
[30-Oct-2019 08:46:07 Europe/Moscow] PHP Warning: Invalid argument supplied for foreach() in /usr/local/pkg/tinc.inc on line 85
82 if (!is_array($config['installedpackages']['tinchosts']['config'])) {
83 $config['installedpackages']['tinchosts']['config'] = array();
84 }
85 foreach ($config['installedpackages']['tinchosts']['config'] as $host) {
found this issue on
https://stackoverflow.com/questions/25886103/php-warning-illegal-string-offset-and-invalid-argument-supplied-for-foreach
https://stackoverflow.com/questions/9869150/illegal-string-offset-warning-php
pfSense 2.5.0.a.20191030.0002
Updated by Viktor Gurov over 4 years ago
got this errors when Tinc Hosts is empty
Updated by Jim Pingle over 4 years ago
Probably because that array isn't fully initialized before use. It needs to be initialized at each level, not just the deepest one. We have a convenient function to do that, which is safe to run even if the array does contain data already:
init_config_arr(array('installedpackages', 'tinchosts', 'config'));
It should do that instead of the if (!is_array( ...
test, for example:
82 init_config_arr(array('installedpackages', 'tinchosts', 'config'));
83 foreach ($config['installedpackages']['tinchosts']['config'] as $host) {
Updated by Viktor Gurov over 4 years ago
Updated by Jim Pingle over 4 years ago
- Status changed from New to Pull Request Review
Updated by Renato Botelho over 4 years ago
- Status changed from Pull Request Review to Feedback
- Assignee set to Renato Botelho
- Target version set to 2.5.0
PR has been merged. Thanks!
Updated by Viktor Gurov over 4 years ago
- Status changed from Feedback to Resolved
tested on tinc 1.0.35_2
pfSense 2.5.0.a.20191113.1759
Resolved