[eluser]Unknown[/eluser]
Hello,
I encountered the following problem on PHP Version 5.2.17, on my others servers (PHP 5.2.6 and PHP/5.3.10) the problem doesn't exists!
I have a simple controller:
Code:
function test()
{
$data = array('test' => NULL);
$this->form_validation->set_rules('test', '', 'trim|xss_clean|required');
if ($this->form_validation->run()) {
$data['test'] = $this->form_validation->set_value('test');
}
$data['result'] = array('valuebydatabase' => 'lorem');
$this->load->view('test', $data);
}
A simple view:
Code:
<?=form_open(current_url());?>
<?php
// For debugging
echo $test;
?>
<input type="text" name="test" id="test" value="<?=set_value('test', $result['valuebydatabase']);?>">
<input type="submit" name="sbm" value="Submit" />
<?=form_close();?>
On my Server running PHP 5.2.17 the input value is always "lorem" although I post another value, on the other servers I get the right value...
I think PHP is initalizing a new object instead of using the existing object.
Wwhen I was debbugging the form_helper, the rules were no more in the object (View -> Calls helper -> Helper gets the instance of the object)! ->
$OBJ =& _get_validation_object() (This should be equal with $this->form_validation).
Inside the controller the rules were given and also "$this->form_validation->set_value('test');" got the right value....
So why this special PHP-Version gets not the right value?!