Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.1, 1.5.2
-
Fix Version/s: 1.11.11
-
Component/s: Zend_Controller
-
Labels:
Description
require_once 'Zend/Controller/Request/Simple.php'; $r = new Zend_Controller_Request_Simple(); $r->setParam('key', 'value'); $r->setParams( array( 'key' => null ) ); var_dump($r->getParams());
The preceding code should output:
array(0) {
}
but is actually outputting:
array(1) {
["key"]=>
string(5) "value"
}
getParams() should be returning an empty array because setParams is defining key to be null and should therefore be calling unset on that value.
If I modified the code to the following, then everything works as expected.
<?php require_once 'Zend/Controller/Request/Simple.php'; $r = new Zend_Controller_Request_Simple(); $r->setParam('key', 'value'); $r->setParam('key', null); var_dump($r->getParams())
REFERENCE ZF 1.10.1
try:
$request->setParam('variable',null); unset($_GET['variable']); unset($_POST['variable']);correct unset variable into Zend_Controller_Request_Http, because into Zend_Controller_Request_Http on getParam(...)
it try to find variable name into $_GET & $_POST :
$request->setParam('variable',null); unset($_GET['variable']); unset($_POST['variable']);