Warning: Illegal string offset 'username' in /etc/inc/xmlparse.inc on line 77



  • Hello,

    Since several days I can't save any config.xml using the GUI. I always get  the message:

    Warning: Illegal string offset 'username' in /etc/inc/xmlparse.inc on line 77 Fatal error: Cannot create references to/from string offsets nor overloaded objects in /etc/inc/xmlparse.inc on line 77
    

    But the trouble  seems to be deeper than just to be unable to save a new config (whatever parameter I wanna change), because now at boot time I see also this message in the logs and the booting processes seems to be freeze (per example no IP address is set on the interfaces).

    Using the serial console I can see that multiple instances of rc.initial are run and stay in the process list (never die)

    root         476  0.0  0.5 10584  2236 u0  I    Sun12PM    0:00.02 -sh (sh)
    root         482  0.0  0.4 10584  2144 u0  I    Sun12PM    0:00.02 /bin/sh /etc/rc.initial
    root         526  0.0  0.6 10948  2964 u0  I+   Sun12PM    0:00.15 /bin/tcsh
    root       70926  0.0  0.5 10584  2316  0  Is    8:11PM    0:00.03 -sh (sh)
    root       70927  0.0  0.4 10584  2208  0  I     8:11PM    0:00.02 /bin/sh /etc/rc.initial
    root       70938  0.0  0.6 10948  3056  0  S     8:11PM    0:00.31 /bin/tcsh
    

    I tried to restore a previous config.xml (using local backup) but the trouble still active…

    Any help will be appreciate :)

    Regards,

    Renaud



  • looks like a broken config to me ….

    could you try to manually copy an old config using console ?
    https://forum.pfsense.org/index.php?topic=57359.msg306319#msg306319



  • unfortunately it's what I tried at first solution. I deleted also /tmp/config.{cache|lock} as well. I see my old config, but if I try to change settings, or restore a full backup (saved in my computer) I got this error again :(



  • I'm not an expert
    but you could do these things and give them a try .

    if you mean by active that the process keep appearing in console and does it job ,
    press Ctrl+C to abort it
    then write "exit" to show the menu again

    from my understanding that the file "/etc/inc/xmlparse.inc"
    don't contain configs by it's self , only functions and some variables that used to dump/backup the configurations on the firewall
    to xml file .
    also i searched for string username in it , but couldn't find it .
    maybe there is a package or something modified this file

    do a backup for "xmlparse.inc" and replace it with the default one .

    [ Attachment ]

    xmlparse.zip



  • Hello,

    I compare your file to mine and I see no diff :(

    In fact each time I try to save a setting I got this trouble. I tried a try/catch in PHP around xmlparser to see exactly on which XML node the parser crash but it soesn't work. In fact the error message indicate that is expcting the key "username" but at line:

    foreach ($curpath as $path) {
                    $ptr =& $ptr[$path];
            }
    
    

    $ptr doesn't contain usernaname….



  • Ps: if I try a 'touch /conf/use_xmlreader'

    I Got: Warning: Illegal string offset 'username' in /etc/inc/xmlreader.inc on line 98 Fatal error: Cannot create references to/from string offsets nor overloaded objects in /etc/inc/xmlreader.inc on line 98

    and in the code the variant of xmlparse.inc

    
    } else
                                            $cfgref =& $cfgarray[$parser->name];
    
    


  • It was effectively a problem with a config.xml. But in fact it wasn't an issue with the current config.xml but with an old one present in the directory /cf/config/backup. So I moved /cf/conf/backup to /cf/conf/backup.orig and then mkdir /cf/conf/backup and everything came back to the normal.

    It was really frustrating because even if you just wanna save the current setting, pfsense seems to read the back and if one is corrupt crash….

    I hope it could help someone in the future ;)

    Renaud


Log in to reply