Bug #16661
openUTF8 characters saved in the Client Identifier of DHCP static mappings result in an invalid config.xml file
100%
Description
After the upgrade from 24.11 to 25.11, the system fails to complete boot with the following errors in CLI:
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 1522, Message: Uncaught TypeError: pfSenseConfig::getConfig(): Return value must be of type array, int returned in /etc/inc/config.lib.inc:1522
Stack trace:
#0 /etc/inc/config.lib.inc(1493): pfSenseConfig->getConfig()
#1 /etc/inc/config.lib.inc(1487): pfSenseConfig->refreshConfig()
#2 /etc/inc/config.lib.inc(1372): pfSenseConfig->getConfigPath()
#3 /etc/inc/config.lib.inc(939): pfSenseConfigHistory->syncBackupCache()
#4 /etc/inc/config.lib.inc(718): cleanup_backupcache()
#5 /etc/inc/config.lib.inc(554): write_config()
#6 /etc/rc.bootup(169): convert_config()
#7 {main}
The reason was the DHCP section, which contained symbols like "é ê è ë" in the descriptions for DHCP static mappings.
example:
% perl -ne 'print "$.:$_" if /[^\x00-\x7F]/' dhcpd.xml
1968: <descr><![CDATA[Pc de prêt]]></descr>
7330: <descr><![CDATA[Synology vidéos]]></descr>
9999: <descr><![CDATA[PC Traction de PEC donné à CHIMIE]]></descr>
11180: <descr><![CDATA[PC Granulometre - Cecile Faurré]]></descr>
Despite that they are isolated by <![CDATA[ ... ]]> the system fails to read the config.
Tested on 25.11 release
Updated by Lev Prokofev 2 days ago
- File untitled.xml added
- Private changed from No to Yes
Updated by Marcos M 2 days ago
- Project changed from pfSense Plus to pfSense
- Subject changed from non-ASCII symbols in DHCP static mapping descriptions cause PHP errors to UTF8 characters saved in the Client Identifier of DHCP static mappings result in an invalid config.xml file
- Category changed from Configuration Upgrade to DHCP (IPv4)
- Assignee set to Marcos M
- Private changed from Yes to No
The reason why the non-ASCII string was able to be saved originally is because Nexus was being used which handles this case correctly. With Nexus disabled, re-saving the same static mapping would result in an invalid config.xml. The issue here is in how the XML writer/parser handles special characters. The following snippet shows various ways this has traditionally been handled along with the proposed fix: Show