diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-03 12:47:09 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-03 12:47:09 +0200 |
commit | c9d8cabfebc9a3b757fa1492c4431b0f88e9ded0 (patch) | |
tree | c76764dcd4ae2737b2de23a8a2d0d575613cd71e /src/super.cpp | |
parent | a5aaa0877fa586499c4be8f19df760fff11f28dd (diff) |
{auto} fixed super-globals when running as apache module, and when using just-in-time setting for the super-globals (fixes issue #63)
Diffstat (limited to 'src/super.cpp')
-rw-r--r-- | src/super.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/super.cpp b/src/super.cpp index b344159..b2e7ad9 100644 --- a/src/super.cpp +++ b/src/super.cpp @@ -14,13 +14,13 @@ namespace Php { /** * A number of super-globals are always accessible */ -Super POST (TRACK_VARS_POST); -Super GET (TRACK_VARS_GET); -Super COOKIE (TRACK_VARS_COOKIE); -Super SERVER (TRACK_VARS_SERVER); -Super ENV (TRACK_VARS_ENV); -Super FILES (TRACK_VARS_FILES); -Super REQUEST (TRACK_VARS_REQUEST); +Super POST (TRACK_VARS_POST, "_POST"); +Super GET (TRACK_VARS_GET, "_GET"); +Super COOKIE (TRACK_VARS_COOKIE, "_COOKIR"); +Super SERVER (TRACK_VARS_SERVER, "_SERVER"); +Super ENV (TRACK_VARS_ENV, "_ENV"); +Super FILES (TRACK_VARS_FILES, "_FILES"); +Super REQUEST (TRACK_VARS_REQUEST, "_REQUEST"); /** * Array access operator @@ -28,11 +28,14 @@ Super REQUEST (TRACK_VARS_REQUEST); * @param key * @return Value */ -Value Super::operator[](const std::string &key) const +Value Super::operator[](const std::string &key) { // we need the tsrm_ls pointer TSRMLS_FETCH(); + // call zend_is_auto_global to ensure that the just-in-time globals are loaded + if (_name) { zend_is_auto_global(_name, strlen(_name) TSRMLS_CC); _name = nullptr; } + // create a value object that wraps around the actual zval Value value(PG(http_globals)[_index]); @@ -46,11 +49,14 @@ Value Super::operator[](const std::string &key) const * @param key * @return Value */ -Value Super::operator[](const char *key) const +Value Super::operator[](const char *key) { // we need the tsrm_ls pointer TSRMLS_FETCH(); + // call zend_is_auto_global to ensure that the just-in-time globals are loaded + if (_name) { zend_is_auto_global(_name, strlen(_name) TSRMLS_CC); _name = nullptr; } + // create a value object that wraps around the actual zval Value value(PG(http_globals)[_index]); |