On 07/26/2016 03:08 PM, Brent Shaffer wrote:
As mentioned by @dwsupplee in this PR comment
<https://github.com/google/google-auth-library-php/pull/126#discussion_r72299639>,
the PHP docs <http://us2.php.net/manual/en/function.assert.php> for
assert state:
Assertions should be used as a debugging feature only. You may use
them for sanity-checks that test for conditions that should always
be TRUE and that indicate some programming errors if not or to
check for the presence of certain features like extension
functions or certain system limits and features.
Assertions should not be used for normal runtime operations like
input parameter checks. As a rule of thumb your code should always
be able to work correctly if assertion checking is not activated.
Wouldn't it be better to use E_USER_WARNING instead?
- Brent
One of the difficulties is that in PHP 5, a failed type check will
trigger an E_RECOVERABLE_ERROR, but on PHP 7 it will now throw a
TypeError. So if the goal is to mimic a type check, it will be wrong in
one version or the other. An assertion, though, can behave the same in
both versions.
--Larry Garfield
--
You received this message because you are subscribed to the Google Groups "PHP
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/f6bf8ae2-6478-31a2-3410-4667dd63518a%40garfieldtech.com.
For more options, visit https://groups.google.com/d/optout.