#49239 closed enhancement (fixed)
Prefer strict PHP comparisons over loose PHP comparisons (batch 2)
Reported by: | pikamander2 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | needs-patch |
Focuses: | coding-standards | Cc: |
Description
(Continuation of #48965)
Here are some more patch files to change loose comparisons to strict comparisons
Attachments (23)
Change History (29)
#2
@
5 years ago
- Keywords needs-patch added
@pikamander2 can you please update comment.php.2.patch patch?
if ( $comment->comment_approved != '0' ) { // if not unapproved
Replace to
if ( '0' !== $comment->comment_approved ) { // if not unapproved
#3
@
5 years ago
@mukesh27 - Sorry for the late reply.
I was hesitant to replace the loose comparisons that involved things like '0' or 0 because that would change the resulting logic when comparing it to things like null or false.
For backwards compatibility reasons, I think it would be best to do the easy ones first and then revisit comparisons like the one you mentioned later on.
Note: See
TracTickets for help on using
tickets.
@SergeyBiryukov - Here's another batch of strict comparisons.