dracony/PHPixie-Core — pull request #6 by maxidirienzo (2014-04-02 16:13:02+00:00)
Title: Request param return value when param does not exists

Request->filter_xss returned an empty string if NULL was passed. With this fix it returns NULL.

This impacted in Request->post(), Request->get() and Request->param(), when a param did not exists, these functions were expected to return NULL by default, but when internally called filter_xss function and passing NULL, filter_xss() converted the NULL to "" when calling strip_tags().

With this change the expected result of Request->post(), Request->get() and Request->param() is correct when the passed value is NULL.

Note that this may have a major impact on ORM variables values if something like this is done:

$m = new \App\Model\someModel($this->pixie);
$m->some_property= $this->request->post('some_param');
$m->save();

Previous to this change, if "some_param" was not sent to the server, an empty string was stored in "some_property", after this change, NULL will be stored in "some_property"

Added a test for this in requestTest.php, assertion fails with the current code, passes with my changes.
Also tweaked Helper test as it was reporting an error when the tests ran.