What is the benefit of using getallheaders() instead of apache_request_headers()?

390 views Asked by At

When using Rector as an aid in upgrading php versions from 7.2 to 7.3, one rule (RenameFunctionRector) changes all instances of apache_request_headers() to getallheaders().

After reading the documentation for both functions, it appears that getallheaders() is an alias and there's no difference between the two as far as I can see. Can anyone explain the reason why getallheaders() exists and if there's any benefit to implementing it?

1

There are 1 answers

0
Chris Haas On BEST ANSWER

apache_request_headers was flagged for possible deprecation in 7.4. Although that didn't happen, I think it was added to Rector just in case it did happen eventually.

As for why it was flagged for deprecation, this thread talks about it, but basically that function's name implies it is Apache-specific, however there are other SAPIs besides that.