Project

General

Profile

Actions

Bug #16661

closed
LP MM

UTF-8 characters in configuration data can result in an invalid configuration

Bug #16661: UTF-8 characters in configuration data can result in an invalid configuration

Added by Lev Prokofev 8 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Configuration Backend
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
26.03
Release Notes:
Default
Affected Version:
Affected Architecture:

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

LP Updated by Lev Prokofev 8 months ago Actions #1

  • File untitled.xml added
  • Private changed from No to Yes

MM Updated by Marcos M 8 months ago Actions #2

  • File deleted (untitled.xml)

MM Updated by Marcos M 8 months ago Actions #3

  • 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

MM Updated by Marcos M 8 months ago Actions #4

  • Status changed from New to Feedback
  • Target version set to 2.9.0
  • % Done changed from 0 to 100
  • Plus Target Version set to 26.03

Fixed with commit:16d579280c2960469f9b711e155217b40b03e54b, commit:aabf2c69a46e7d53682b99ebfb37d6bdb458b458, and commit:d5a951e5058e1ab065db6e949eb6e577b105809a.

LP Updated by Lev Prokofev 8 months ago Actions #5

  • Status changed from Feedback to Resolved

No more PHP errors after restoring the config with "bad" symbols.
Tested on

26.03-DEVELOPMENT (amd64)
built on Fri Jan 30 22:00:00 UTC 2026
FreeBSD 16.0-CURRENT

I mark this as resolved.

JP Updated by Jim Pingle 7 months ago Actions #6

  • Subject changed from UTF8 characters saved in the Client Identifier of DHCP static mappings result in an invalid config.xml file to UTF-8 characters saved in the Client Identifier of DHCP static mappings result in an invalid configuration

JP Updated by Jim Pingle 6 months ago Actions #7

  • Subject changed from UTF-8 characters saved in the Client Identifier of DHCP static mappings result in an invalid configuration to UTF-8 characters in configuration data can result in an invalid configuration
  • Category changed from DHCP (IPv4) to Configuration Backend
Actions

Also available in: Atom