custom_php_deinstall_command isn't being run during pkg post-deinstall because info.xml has already been removed by that step.
A bit of a chicken/egg problem here:
The custom_php_deinstall_command function from a package is supposed to be run during the post-deinstall phase of pkg delete, but it can't, because that block of code doesn't run if the "configurationfile" doesn't exist (e.g.
pkgname.xml). Since it's the post-deinstall phase, that file has been removed already.
I confirmed this by making a change to an XML file so pkg wouldn't delete it (checksum mismatch) and then the commands ran as expected.
Changing custom_php_deinstall_command to run at deinstall instead of post-deinstall works around the issue, but needs some evaluation for potential side effects. If that is OK, it's a simple one-line change.
Affects both 2.3.x and 2.4.x and leads to behavior such as #7319