[eluser]joelkallman[/eluser]
Quote:If something is set then it should return whatever value is there, if something is not set then it should be NULL.
I agree. This is the correct way to do it.
So now onto a few more questions. Phil mentioned the following methods that would be affected, but I believe there should be more if we are to be consistent.
Code:
$this->input->get();
$this->input->get_post();
$this->input->post();
$this->input->cookie();
$this->input->server();
$this->input->post();
$this->session->userdata();
$this->session->flashdata();
// New ------------------
$this->uri->segment();
$this->uri->rsegment();
$this->config->item();
$this->lang->line();
Also, all the related helper functions need to be documented as well.
A few more questions on functionality. Since we added the ability for $this->input->post() to return the full $_POST array when called, this should return an empty array when there is nothing in $_POST. This is how default PHP functions and should also apply to get() and cookie().
So to be clear, assuming $_POST === array(), the following code should operate as follows.
Code:
$foo = $this->input->post('foo');
$bar = $this->input->post();
var_dump($foo); // OUTPUTS: NULL
print_r($bar); // OUTPUTS: Array()
Anyway, those are some of my thoughts. What do you think?