Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Call to undefined function Liuch\DmarcSrg\getallheaders() #110

Closed
zackw opened this issue Dec 18, 2023 · 10 comments
Closed

Error: Call to undefined function Liuch\DmarcSrg\getallheaders() #110

zackw opened this issue Dec 18, 2023 · 10 comments

Comments

@zackw
Copy link

zackw commented Dec 18, 2023

Loading any page of the web interface causes this error to show up (both as a toast message in my browser, and in the server's error logs).

PHP Error: dmarc-srg [error]: Error: Call to undefined function Liuch\DmarcSrg\getallheaders() in .../dmarc-srg/classes/Core.php:94, referer: [redacted]

Line 94 of Core.php is the only occurrence of the word "getallheaders" in the entire source tree.

PHP 8.1.25 / Apache 2.4, on a shared webhosting service that uses their own custom CGI replacement, I don't have any details on that.

@liuch
Copy link
Owner

liuch commented Dec 18, 2023

Hello @zackw
Could you please let me know which version of dmarc-srg you are using?

@williamdes
Copy link
Contributor

williamdes commented Dec 18, 2023

I am very interested in knowing in what conditions getallheaders is missing.

See: slimphp/Slim-Psr7#273

A polyfill for the missing function: https://github.com/ralouphie/getallheaders

@zackw
Copy link
Author

zackw commented Dec 18, 2023

@liuch Git master as of this morning, rev 7c1caa3.

@williamdes I don't know PHP at all but searching for the error message gives me the impression that it may or may not be there depending on the "SAPI" in use. And my hosting provider has their own custom SAPI so anything I could say about it would probably be useless to you.

@liuch
Copy link
Owner

liuch commented Dec 18, 2023

@williamdes This feature was not available in FPM SAPI, but has been available since version 7.3.0. I believe this issue is because of "their own CGI replacement".

@liuch
Copy link
Owner

liuch commented Dec 18, 2023

@zackw Thank you for the information.

@williamdes
Copy link
Contributor

@liuch Git master as of this morning, rev 7c1caa3.

@williamdes I don't know PHP at all but searching for the error message gives me the impression that it may or may not be there depending on the "SAPI" in use. And my hosting provider has their own custom SAPI so anything I could say about it would probably be useless to you.

If you can let me know more about the SAPI and the hosting provider name. I could keep this in mind to document in what cases this function does not exist

liuch added a commit that referenced this issue Dec 19, 2023
@liuch
Copy link
Owner

liuch commented Dec 19, 2023

@zackw I have just added a polyfill for this function. Could you please test my fix?

@zackw
Copy link
Author

zackw commented Dec 21, 2023

@liuch Works, thanks for the quick fix.

@williamdes The hosting provider is https://www.nearlyfreespeech.net/. The only information I have about the SAPI is that it identifies itself as "NearlyFreeSpeech.NET PHP SAPI" in phpinfo() output, and $_SERVER['GATEWAY_INTERFACE'] is NFGI/1.0.

@zackw
Copy link
Author

zackw commented Dec 21, 2023

FWIW I hacked together a slightly different workaround which I'll attach here in case it's of use to you.

getallheaders-hack.diff

@liuch
Copy link
Owner

liuch commented Dec 21, 2023

Thanks for your workaround. I'm going to rewrite mine a little later. Strictly speaking, I don't need all these checks because I use exactly one header in my code.

May I close this issue?

@liuch liuch closed this as completed Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants