I’m afraid that I can’t spare the time to debug that code. What you can try to do is disable the DIGEST-MD5 mechanism in Openfire. This will cause phpBB to use the PLAIN mechanism. If there’s a compatibility issue in the DIGEST-MD5 implementation, then you have a good chance of uncovering it that way.
You can disable SASL implementations in the Openfire admin console (under Server > Server Settings > Registration & Login)
