summaryrefslogtreecommitdiff
path: root/zend
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-13 22:47:44 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-13 22:47:44 +0100
commite14d8c6f985aeaeb247387b51d6ec027655efb99 (patch)
treeaf2baf1e73668fe994bb6254a35b507b664f2fc0 /zend
parent75944e3e755053bc2ebe9a2a8c55575941f79a56 (diff)
in response to issue #156: the super-global arrays Php::POST, Php::SERVER, etcetera can now be iterated over, and they can be assigned to a regular Php::Value variable
Diffstat (limited to 'zend')
-rw-r--r--zend/includes.h2
-rw-r--r--zend/super.cpp32
2 files changed, 4 insertions, 30 deletions
diff --git a/zend/includes.h b/zend/includes.h
index 0b6a138..1552778 100644
--- a/zend/includes.h
+++ b/zend/includes.h
@@ -63,8 +63,8 @@
#include "../include/byval.h"
#include "../include/byref.h"
#include "../include/global.h"
-#include "../include/super.h"
#include "../include/hashmember.h"
+#include "../include/super.h"
#include "../include/parameters.h"
#include "../include/modifiers.h"
#include "../include/base.h"
diff --git a/zend/super.cpp b/zend/super.cpp
index a2fa0a9..ea690fe 100644
--- a/zend/super.cpp
+++ b/zend/super.cpp
@@ -23,33 +23,10 @@ Super FILES (TRACK_VARS_FILES, "_FILES");
Super REQUEST (TRACK_VARS_REQUEST, "_REQUEST");
/**
- * Array access operator
- * This can be used for accessing associative arrays
- * @param key
+ * Convert object to a value
* @return Value
*/
-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]);
-
- // pass on the call
- return value.get(key);
-}
-
-/**
- * Array access operator
- * This can be used for accessing associative arrays
- * @param key
- * @return Value
- */
-Value Super::operator[](const char *key)
+Value Super::value()
{
// we need the tsrm_ls pointer
TSRMLS_FETCH();
@@ -58,10 +35,7 @@ Value Super::operator[](const char *key)
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]);
-
- // pass on the call
- return value.get(key);
+ return Value(PG(http_globals)[_index]);
}
/**