Well, what ever I say might be wrong because I'm not an expert in
assertions.

First of all, I didn't know that PHP had assertions... so, cool! :-)

Second, I know that assertions are used in non-interpreted languages,
like C for example, and it gives a way to make some kind of debugging
when the code is compiled in "debugging" mode.  When a given condition
evaluates to true it will "assert" an specific message or situation.
But all the assertions are deactivated when the program is compiled for
a production environtment.

So, you can have debbuging code in your program with assertions and that
won't affect the performance or behaviour when it is compiled for a
production environment.

Remember, I might be wrong or inaccurate.  But I agree that it is not a
good idea to use assertions to validate input data or for normal
operations.


-William

PS. Could you post a link to that article?



El mar, 13-04-2004 a las 13:58, Fraser Campbell escribió:
> 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 <[EMAIL PROTECTED]>                 http://www.wehave.net/
> Georgetown, Ontario, Canada                               Debian GNU/Linux

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to