CodeIgniter Forums
PHP bug #53632 and CI Validation class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: PHP bug #53632 and CI Validation class (/showthread.php?tid=37372)



PHP bug #53632 and CI Validation class - El Forum - 01-07-2011

[eluser]stef25[/eluser]
Entering the value of 2.2250738585072011e-308 in a contact form field and running that field through the CI Validation class hangs PHP. So it seems that the form field value is being interpreted as a float?

This all causes a "hang". The only way to avoid it is to remove the rule altogether.

Code:
$this->form_validation->set_rules('firstname', $this->lang->line('firstname'), '');
$this->form_validation->set_rules('firstname', $this->lang->line('firstname'), 'trim|required');

This is quite serious, any solutions for this?

See:
http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
http://news.ycombinator.com/item?id=2066352


PHP bug #53632 and CI Validation class - El Forum - 01-07-2011

[eluser]Phil Sturgeon[/eluser]
Sorry, not sure I follow your example. If you send 2.2250738585072011e-308 in firstname (which is probably varchar) it somehow get's treated as a float and hangs?


PHP bug #53632 and CI Validation class - El Forum - 01-07-2011

[eluser]stef25[/eluser]
Yep, simple contact form with firstname, lastname, email, etc. If I enter that value in the firstname field, it hangs when it reaches
Code:
$this->form_validation->run()

If I comment out the firstname validation rule then everything passes and the message is delivered.

There's no DB interaction going on.

I realize this is a PHP problem since just putting
Code:
$d = 2.2250738585072011e-308;
in a controller also hangs the system.

It's just weird that the problem occurs when you run it through the validation class.

We're fixing all our sites by putting this in the main index.php. Other, non CI sites on our server are a little harder to fix.


PHP bug #53632 and CI Validation class - El Forum - 01-07-2011

[eluser]Phil Sturgeon[/eluser]
Ahh this is the (one and only) bug that 5.2.17 / 5.3.5 fixes. I'll have a look and see if there is anything simple and realistic we can do for CI Reactor.