summaryrefslogtreecommitdiff
path: root/inc/Input.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-06-25 00:37:21 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-06-25 00:37:21 +0200
commit591acd873d64abb271864b581c48ca419aa5d329 (patch)
tree8d2e0511550c54620041c5aa9298d88cfd5e13cb /inc/Input.class.php
parentbcc94b2c17efc51fd78a25db43058d10e685679d (diff)
downloadrpg-591acd873d64abb271864b581c48ca419aa5d329.tar.gz
rpg-591acd873d64abb271864b581c48ca419aa5d329.tar.bz2
some Input class fixes and unit tests
Diffstat (limited to 'inc/Input.class.php')
-rw-r--r--inc/Input.class.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/inc/Input.class.php b/inc/Input.class.php
index 62c2688c8..1ea5e031f 100644
--- a/inc/Input.class.php
+++ b/inc/Input.class.php
@@ -104,8 +104,7 @@ class Input {
$this->set($name, $default);
}
- $ref = &$this->access[$name];
- return $ref;
+ return $this->access[$name];
}
/**
@@ -143,6 +142,8 @@ class Input {
/**
* Access a request parameter as bool
*
+ * Note: $nonempty is here for interface consistency and makes not much sense for booleans
+ *
* @param string $name Parameter name
* @param mixed $default Default to return if parameter isn't set
* @param bool $nonempty Return $default if parameter is set but empty()
@@ -165,6 +166,7 @@ class Input {
*/
public function arr($name, $default = array(), $nonempty = false) {
if(!isset($this->access[$name])) return $default;
+ if(!is_array($this->access[$name])) return $default;
if($nonempty && empty($this->access[$name])) return $default;
return (array) $this->access[$name];
@@ -183,8 +185,6 @@ class PostInput extends Input {
*/
function __construct() {
$this->access = &$_POST;
- unset ($this->post);
- unset ($this->get);
}
/**
@@ -211,8 +211,6 @@ class GetInput extends Input {
*/
function __construct() {
$this->access = &$_GET;
- unset ($this->post);
- unset ($this->get);
}
/**