Skip to content

Conversation

sirbrillig
Copy link
Owner

This adds support for some superglobals which were previously missing:

  • $http_response_header
  • $HTTP_RAW_POST_DATA
  • $php_errormsg

Fixes #176

This adds the missing `$HTTP_RAW_POST_DATA`, `$http_response_header`, and
`$php_errormsg`.
@sirbrillig sirbrillig merged commit 0537dec into master Sep 15, 2020
@sirbrillig sirbrillig deleted the add-more-superglobals branch September 15, 2020 15:46
@jrfnl
Copy link
Collaborator

jrfnl commented Sep 15, 2020

@sirbrillig You may find the helper functions in the PHPCSUtils Variables class useful for this, particularly Variables::isSuperglobal()/Variables::isSuperglobalName().

https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-Variables.html

Also note that $php_errormsg is not a superglobal. It is only available within the scope in which the error occurred and only if the track_errors configuration option is turned on (it defaults to off).

See: https://www.php.net/manual/en/reserved.variables.phperrormsg.php

@jrfnl
Copy link
Collaborator

jrfnl commented Sep 15, 2020

Oh and I forgot to mention Variables::isPHPReservedVarName()

@sirbrillig
Copy link
Owner Author

Thanks! I'll make another PR to fix that up. Judging by the docs, I think I should just remove php_errormsg entirely from the checks because it's deprecated and only available in specific circumstances. (I wish the PHP superglobals docs page would note that...).

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

Successfully merging this pull request may close these issues.

False positive: $http_response_header
2 participants