Nasty little bug in header.inc pfSense 2.0 (and 1.2.3)



  • Hello All,

    Today while modifying the webGui for our application we ran into an issue where java script file for one our custom pages was not being loaded.  This was tracked down to a coding error in header.inc. This does not affect the general distribution of pfSense 1.2.X or 2.0 but one of these days its going to bite one of the developers where it hurts…

    line 40 in header.inc currently reads

    /*
            *      Find all javascript files that need to be included
            *      for this page ... from the arrays ... :)
            *      Coded by: Erik Kristensen
            */

    $dir  = trim(basename($_SERVER["SCRIPT_FILENAME"]), '.php');
            $path = "/usr/local/www/javascript/" . $dir . "/";
            if (is_dir($path)) {

    the trim line should be changed to
    $dir  = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));

    otherwise the file name gets bangled by random removal of ., p, h, p from the file names!

    take care.

    –luis



  • The suggested fix has been tested by me and applied in the latest 2.0 code.


Log in to reply