php scripting and PHP shell broken after update
-
I just recently updated my pfsense firewall and now my php scripts I used for automation don't longer work.
Testing via PHP shell is also not working. None of the examples listed in the help command of the PHP shell is working.
Just no output at all!
My scripts are failing when accessing $config[filter][rule] , but I have found nothing about changed api?Please give me some advice!
-
Go have a read at this link: https://docs.netgate.com/pfsense/en/latest/development/php-config-arrays.html.
Several things have changed in PHP over the last few pfSense updates. For one, PHP 7.x has been replaced by pfSense 8.x, and 8.x behaves much differently with regards to throwing full blown errors and halting on syntax and code structure problems that PHP 7.x would just ignore, make an educated guess on what the programmer meant, and then move on.
So, the API did in fact change in a way. In particular you can't use direct access to an array element in a variable that is not actually defined as an array. Thus things that just sort of got ignored in PHP 7.x will now cause a halt in PHP 8.x (probably breaking the script).
-
What did you update from? to?
-
@bmeeks
why the PHP shell i reach from menu point 12 does not give any hints?
All the examples given in the help commands don't work.As this is the place, where I tested my scripts, I expected to get information about changes there.
Thanks for your link, I will dig from there.