Why not use assertions for input validation?
| From: | Fraser Campbell | Date: | Tue, 13 Apr 2004 18:58:26 +0000 |
| Subject: | Why not use assertions for input validation? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183255@lists.php.net to get a copy of this message | ||
Hi,
An article was recently published in Linux Journal entitled Real-World PHP
Security.
Assertions are mentioned in the article as a way to enforce validity of input.
I didn't even realize that php had assertions so I investigated a little
further ...
PHP docs on the assert function
(http://www.php.net/manual/en/function.assert.php) states "Assertions should
not be used for normal runtime operations like input parameter checks" which
contradicts the Linux Journal article. An article in the user contributed
notes (http://www.sitepoint.com/article/1008/) also states not to use
assertions in production.
What is it about assertions that makes them unsuitable for production use?
Thanks!
--
Fraser Campbell <fraser@wehave.net> http://www.wehave.net/
Georgetown, Ontario, Canada Debian GNU/Linux