#49239 closed enhancement (fixed)
Prefer strict PHP comparisons over loose PHP comparisons (batch 2)
| Reported by: | pikamander2 | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: | coding-standards |
Description
(Continuation of #48965)
Here are some more patch files to change loose comparisons to strict comparisons
Attachments (23)
Change History (29)
#2
@
7 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
@
7 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@SergeyBiryukov - Here's another batch of strict comparisons.