contao/import — Issue #2570: Improve input->get method
Author: DyaGa
Created: 2011-11-29 19:47:43+00:00
State: open
Labels: Feature, framework

Example:

`$_GET` array have this values:

```
$_GET = Array
(
[model] => some-model
[info] =>
)
```

I need to do this:

```
if(($text = $this->Input->get('text')) !== null)
{
// key 'text' exists
// do something...
}
else
{
// key 'text' doesn't exists
// do something...
}
```

But have a problem when accessing the key that doesn't exists in `$_GET` array in `Input->get()` method. It returns empty string, but have to be `null` value.

If we do this:

```
var_dump($_GET['info']);
var_dump($_GET['text']);

var_dump($this->Input->get('info'));
var_dump($this->Input->get('text'));
```

the result will be:

```
string '' (length=0)
null

string '' (length=0)
string '' (length=0)
```

In example below, method `$this->Input->get('text')` returns `string ''` not `null`...
in case of returning `string ''` system says that key `text` exists in `$_GET` variable, but it doesn't.

--- _Originally created on September 25th, 2010, at 10:49am (ID 2570)_