Bug #3765
closedPort alias creation and expansion leaves white space padding, causes is_numeric() tests on port validity to fail.
0%
Description
I entered a port alias ("Myport" defined as 999) through the 2.1.4 FW->"Alias"->"Port" UI, as part of a test. Using standard functions, I then wanted to extract the alias value for use in a function.
Result:
1) $config['aliases']['Myport'] was entered normally, but got saved in $config with white space padding somehow (SPC SPC 999 not plain 999). So alias creation isn't stripping out white space, but may retain or add white space padding as part of the stored alias value.
2) filter_expand_alias() failed to detect this on expansion. Notedso someone can confirm this is correct behaviour (ie, that it's the calling function's job to do so and valid values are not guaranteed).
3) filter_expand_alias() doesn't seem to be doing anything beyond normal expansion of aliases. As any function in any part of pfSense might need alias expansion, it's illogical and unclear why the function to expand a port alias is in filters.inc while all other port alias functions, and the functions to expand all other aliases (and all other alias management library code generally) is in utils.inc.
Can the port alias expansion function be moved to utils.inc, and referred to from function.inc as usual, to keep it simple and so functions don't have to load filter.inc just to expand an alias?