Jump to content

!empty($_POST['v_order'])) treat v_order=0 as empty


Alexancho

Recommended Posts

I do usual verification:

if (isset($_POST['v_order']) && !empty($_POST['v_order'])) {} //Continue checkelse {die('Something wrong with the 'v_order'!); }

When v_order=0 the line "die('Something wrong with the 'v_order'!);" is executed.If i change 0 to any other number, everything work correctly.I can avoid this case, but i don't understand why it is happened. Isn't zero a number?

Link to comment
Share on other sites

0 is considered empty, according to the PHP manual. This is why it doesn't pass the check. Scrolling down in the link I've given, you'll find people who have implemented custom functions for correcting the... "issue" (but do remember that "it's not a bug. it's a feature").

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...