mlocati / spf-lib

PHP library to parse, build and validate SPF (Sender Policy Framework) DNS records

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expander Bug

jcbenton opened this issue · comments

faasafety.gov has a very broken SPF record, which causes some uncaught errors to go fatal. This is all the info I have.

Feb 27 17:04:28 mx1 php: PHP Fatal error:  Uncaught SPFLib\Exception\MissingEnvironmentValueException: Missing the HELO/EHLO domain in /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php:147
Feb 27 17:04:28 mx1 php: Stack trace:
Feb 27 17:04:28 mx1 php: #0 /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php(72): SPFLib\Macro\MacroString\Expander->getPlaceholderValue()
Feb 27 17:04:28 mx1 php: #1 /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php(48): SPFLib\Macro\MacroString\Expander->expandPlaceholder()
Feb 27 17:04:28 mx1 php: #2 /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php(31): SPFLib\Macro\MacroString\Expander->expandChunk()
Feb 27 17:04:28 mx1 php: #3 [internal function]: SPFLib\Macro\MacroString\Expander->SPFLib\Macro\MacroString\{closure}()
Feb 27 17:04:28 mx1 php: #4 /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php(33): array_map()
Feb 27 17:04:28 mx1 php: #5 /vendor/mlocati/spf-lib/src/Checker.php(486): SPFLib\Macro\MacroString\Expander->expand()
Feb 27 17:04:28 mx1 php: #6 /vendor/mlocati/spf-lib/src/Checker.php(317): SPFLib\Checker->expandDomainSpec()
Feb 27 17:04:28 mx1 php: #7 /vendor/mlocati/spf-lib/src/Macro/MacroString/Expander.php on line 147

faasafety.gov has a very broken SPF record, which causes some uncaught errors to go fatal. This is all the info I have.

It should be valid:

$ nslookup -type=TXT faasafety.gov | grep spf
faasafety.gov   text = "v=spf1 include:faasafety.gov._nspf.valigov.email include:%{i}._ip.%{h}._ehlo.%{d}._spf.valigov.email ~all"

I'll try to find some spare time to check what's going wrong

If you check MXToolbox, the record has a null lookup in it. (Not really concerned about the validity of their SPF lookup on their domain.) I just wanted to let you know an error is being thrown in the PHP that is not caught.

If there is any way I can help via test, let me know. I'd be glad to help.