Closed bethatasitmay closed 1 year ago
PHP Fatal error: Uncaught Error: Call to undefined function mb_convert_encoding()
mb_convert_encoding() is not part of PAN-OS-PHP, there was also no change between 2.0.73 and 2.1.13 of using this;
php-mbstring is an extension to PHP is still needed, please check on your PHP version that this is still working fine.
hmmm, I haven't touched my PHP install since I had to revert from v8.2 when I upgraded to it when I shouldn't have (around January). I'll uninstall/re-install and see how it goes.
I'm assuming that php-mbstring is part of the normal install and, in particular, a part of the Chocolatey method of installing PHP.
Also, do I still need to install a PHP version <8.2?
you can continue with PHP 8.2 since you reached out I fixed all of this, and run myself only 8.2
Ah, I missed that in the updates (I do read them, just too fast sometimes :-) )
ok, so I will close this case, as this is related to PHP and PHP module installation
All good now - thanks!
TL;DR
In my last PHP 8.1.6 install, I did not enable the mbstring extension (I didn't even have it in my notes to do that which makes me think it was never enabled). I uninstalled 8.1, installed 8.2, fixed the path, enabled the mbstring extension, and re-downloaded PAN-OS-PHP from GIT just to be sure.
I didn't think to check the php.ini for the extension being enabled and testing it prior to the uninstall - I only looked at it as with a new PHP install, enable_dl needs to be turned on and I had a note to enable the openssl extension (although I think you fixed that issue a while back).
The uninstall retains the php.ini since it's not the original and I did not have the mbstring extension enabled in my previous install. Strange that it worked for so long without issue.
The action=description-append is now working.
Describe the bug
When I run a command with action=description-append it is failing.
Expected behavior
Baring too many description entries, a filter-matching rule's description should be updated. This was working prior to me upgrading from v2.0.73 to v2.1.13. I tried saved commands that previously worked and they do not work now. I've tried different filters to confirm it isn't getting stuck on a single rule.
Current behavior
PS C:\tools\pan> PS C:\tools\pan> PS C:\tools\pan>PS C:\tools\pan> php -r "require_once 'C:/tools/pan/pan-os-php/utils/pan-os-php.php';" type=rule in=api://panorama.domain.com location=firewall01 actions=description-Append:' Ticket-229 8-28-23',no 'filter=(dst has.recursive host01)'
*** pan-os-php.php type=rule UTILITY **
0 C:\tools\pan\pan-os-php\lib\misc-classes\trait\ObjectWithDescription.php(86): Rule->setDescription()
1 C:\tools\pan\pan-os-php\utils\common\actions-rule.php(2858): Rule->API_setDescription()
2 C:\tools\pan\pan-os-php\utils\common\CallContext.php(112): {closure}()
3 C:\tools\pan\pan-os-php\utils\lib\RULEUTIL.php(430): CallContext->executeAction()
4 C:\tools\pan\pan-os-php\utils\lib\RULEUTIL.php(36): RULEUTIL->time_to_process_objects()
5 C:\tools\pan\pan-os-php\utils\lib\UTIL.php(211): RULEUTIL->utilStart()
6 C:\tools\pan\pan-os-php\lib\misc-classes\PH.php(1025): UTIL->__construct()
7 C:\tools\pan\pan-os-php\utils\pan-os-php.php(117): PH::callPANOSPHP()
8 Command line code(1): require_once('...')
9 {main}
thrown in C:\tools\pan\pan-os-php\lib\misc-classes\trait\ObjectWithDescription.php on line 62
Steps to reproduce
php -r "require_once 'C:/tools/pan/pan-os-php/utils/pan-os-php.php';" type=rule in=api://lv-pamgmt01.dcswins.com location=any actions=description-Append:'TEST 8-28-23',yes 'filter=(tag has Migration-06)'
I've also tried filtering on a src has.recursive/dst has.recursive and using location any. With location any, it did update a Shared rule but then still failed with the above error.
Context
For audit purposes, we are required to make a rule description update that corresponds to a commit.
Your Environment