Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use strict comparison in various files #3873

Open
wants to merge 167 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
fe1c79b
Use strict comparison in ajax-actions.php
SergeyBiryukov Jan 19, 2023
a616c6d
Use strict comparison in class-wp-importer.php
SergeyBiryukov Jan 19, 2023
15767a0
Use strict comparison in class-wp-list-table.php
SergeyBiryukov Jan 19, 2023
6147444
Use strict comparison in class-wp-ms-sites-list-table.php
SergeyBiryukov Jan 19, 2023
f3e34de
Add ignore annotation to class-wp-privacy-policy-content.php
SergeyBiryukov Jan 19, 2023
51f2cad
Use strict comparison in class-wp-site-icon.php
SergeyBiryukov Jan 19, 2023
df21673
Use strict comparison in image-edit.php
SergeyBiryukov Jan 19, 2023
6f5d04b
Use strict comparison in media.php
SergeyBiryukov Jan 19, 2023
84527e2
Use strings in wpAjaxDeleteComment.php
SergeyBiryukov Jan 26, 2023
a304a34
Use strings in wpAjaxWpCompressionTest.php
SergeyBiryukov Jan 26, 2023
aed37ae
Use strict comparison in menu.php
SergeyBiryukov Jan 26, 2023
9007da7
Use strict comparison in meta-boxes.php
SergeyBiryukov Jan 26, 2023
0cf0a83
Use strict comparison in nav-menu.php
SergeyBiryukov Jan 26, 2023
f3aefa9
Use strict comparison in post.php
SergeyBiryukov Jan 26, 2023
08b7720
Use strict comparison in schema.php
SergeyBiryukov Jan 26, 2023
d58d20d
Use strict comparison in taxonomy.php
SergeyBiryukov Jan 26, 2023
f962ca3
Use strict comparison in update.php
SergeyBiryukov Jan 26, 2023
0c59da1
Use strings in includesPost.php
SergeyBiryukov Jan 26, 2023
2a83af1
Use strict comparison in upgrade.php
SergeyBiryukov Jan 26, 2023
25efdd0
Use strict comparison in user.php
SergeyBiryukov Jan 26, 2023
2e50f02
Use strict comparison in repair.php
SergeyBiryukov Jan 26, 2023
98f1ffd
Use strict comparison in sites.php
SergeyBiryukov Jan 26, 2023
5b8f057
Use strict comparison in users.php
SergeyBiryukov Jan 26, 2023
11404fb
Use strict comparison in options-general.php
SergeyBiryukov Jan 26, 2023
85d7b80
Use strict comparison in options-writing.php
SergeyBiryukov Jan 26, 2023
7bb7dc3
Use strict comparison in update-core.php
SergeyBiryukov Jan 26, 2023
445ad48
Use strict comparison in user-new.php
SergeyBiryukov Jan 26, 2023
1949a05
Remove unnecessary condition in user-new.php
SergeyBiryukov Jan 26, 2023
4230811
Use strict comparison in users.php
SergeyBiryukov Jan 26, 2023
a519e5d
Use correct default values in class-wp-comment.php
SergeyBiryukov Feb 2, 2023
19906b8
Use strict comparison in twentyeleven/functions.php
SergeyBiryukov Feb 2, 2023
432e1c4
Use strict comparison in twentyeleven/image.php
SergeyBiryukov Feb 2, 2023
81ebb86
Use strict comparison in twentyeleven/inc/theme-options.php
SergeyBiryukov Feb 2, 2023
ab2583b
Use strict comparison in twentyeleven/showcase.php
SergeyBiryukov Feb 2, 2023
c4fdcb6
Use strict comparison in twentyfourteen/functions.php
SergeyBiryukov Feb 2, 2023
089463e
Use strict comparison in twentyfourteen/inc/custom-header.php
SergeyBiryukov Feb 2, 2023
3c8099c
Use strict comparison in twentyfourteen/inc/featured-content.php
SergeyBiryukov Feb 2, 2023
077c34c
Use strict comparison in twentynineteen/classes/class-twentynineteen-…
SergeyBiryukov Feb 2, 2023
843c109
Use strict comparison in twentynineteen/comments.php
SergeyBiryukov Feb 2, 2023
825eb51
Use strict comparison in twentyten/functions.php
SergeyBiryukov Feb 2, 2023
f94f3d8
Use strict comparison in twentyten/loop-attachment.php
SergeyBiryukov Feb 2, 2023
6ec38e4
Use strict comparison in twentythirteen/functions.php
SergeyBiryukov Feb 2, 2023
7255e98
Use strict comparison in twentythirteen/image.php
SergeyBiryukov Feb 2, 2023
fcd2075
Use strict comparison in twentythirteen/inc/custom-header.php
SergeyBiryukov Feb 2, 2023
5fa0774
Use strict comparison in twentytwelve/functions.php
SergeyBiryukov Feb 2, 2023
49a875c
Use strict comparison in twentytwelve/image.php
SergeyBiryukov Feb 2, 2023
dc91c38
Use strict comparison in twentytwelve/inc/custom-header.php
SergeyBiryukov Feb 2, 2023
7831616
Use empty() in bookmark-template.php
SergeyBiryukov Feb 2, 2023
17ee88d
Use strict comparison in wp-includes/bookmark.php
SergeyBiryukov Feb 2, 2023
ccc449b
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Feb 24, 2023
3635cae
Use strict comparison in wp-includes/capabilities.php
SergeyBiryukov Mar 2, 2023
e7c63e9
Use strict comparison in wp-includes/category-template.php
SergeyBiryukov Mar 2, 2023
670dfeb
Use strict comparison in wp-includes/category.php
SergeyBiryukov Mar 2, 2023
e1ce1db
Use strict comparison in wp-includes/class-walker-category.php
SergeyBiryukov Mar 2, 2023
210cfc6
Use strict comparison wp-includes/class-walker-comment.php
SergeyBiryukov Mar 2, 2023
3f665df
Use strict comparison in wp-includes/class-walker-page-dropdown.php
SergeyBiryukov Mar 2, 2023
4aa39b4
Use strict comparison in class-walker-page.php
SergeyBiryukov Mar 2, 2023
7d2daaf
Use strict comparison in wp-includes/class-wp-hook.php
SergeyBiryukov Mar 2, 2023
e8b4b85
Use strict comparison in class-wp-http-streams.php
SergeyBiryukov Mar 2, 2023
02605f5
Use strict comparison in wp-includes/class-wp-image-editor-gd.php
SergeyBiryukov Mar 2, 2023
7b7faf5
Use strict comparison in wp-includes/class-wp-image-editor-imagick.php
SergeyBiryukov Mar 2, 2023
dda2016
Use strict comparison in wp-includes/class-wp-image-editor.php
SergeyBiryukov Mar 2, 2023
0ab2742
Use strict comparison in wp-includes/class-wp-list-util.php
SergeyBiryukov Mar 2, 2023
83877b8
Use strict comparison in wp-includes/class-wp-network.php
SergeyBiryukov Mar 2, 2023
5c53e4c
Use strict comparison in wp-includes/class-wp-oembed.php
SergeyBiryukov Mar 2, 2023
793dafb
Use strict comparison in wp-includes/class-wp-query.php
SergeyBiryukov Mar 2, 2023
f5284f8
Use strict comparison in wp-includes/class-wp-rewrite.php
SergeyBiryukov Mar 2, 2023
038396d
Use strict comparison in wp-includes/class-wp-roles.php
SergeyBiryukov Mar 2, 2023
d566e26
Use strict comparison in wp-includes/class-wp-simplepie-file.php
SergeyBiryukov Mar 2, 2023
3b60a35
Use strict comparison in wp-includes/class-wp-theme.php
SergeyBiryukov Mar 2, 2023
fd07718
Use strict comparison in wp-includes/class-wp-user-query.php
SergeyBiryukov Mar 2, 2023
87c4664
Use strict comparison in wp-includes/class-wp-user.php
SergeyBiryukov Mar 2, 2023
7647a09
Use strict comparison in wp-includes/class-wp-walker.php
SergeyBiryukov Mar 2, 2023
cc6be7a
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Mar 16, 2023
6048e32
Delete phpcs-230126a.txt
SergeyBiryukov Mar 16, 2023
c2ff337
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Apr 11, 2023
24dfec4
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Apr 11, 2023
3d4e8f4
Use strict comparison in class-wp-widget.php
SergeyBiryukov Apr 13, 2023
ba151ef
Use strict comparison in class-wp-xmlrpc-server.php
SergeyBiryukov Apr 13, 2023
8c42b4f
Use strict comparison in class-wp.php
SergeyBiryukov Apr 13, 2023
460fc34
Use strict comparison in comment-template.php
SergeyBiryukov Apr 13, 2023
1b4f64e
Use strict comparison in comment.php
SergeyBiryukov Apr 13, 2023
b0c1c98
Use strict comparison in cron.php
SergeyBiryukov Apr 13, 2023
53b6f56
Use strict comparison in feed-atom-comments.php
SergeyBiryukov Apr 13, 2023
bc2a73d
Use strict comparison in formatting.php
SergeyBiryukov Apr 13, 2023
42a8cd8
Use strict comparison in functions.php
SergeyBiryukov Apr 13, 2023
62b7f96
Revert the optimization in comment.php
SergeyBiryukov Apr 13, 2023
f44c401
Use strict comparison in general-template.php
SergeyBiryukov Apr 13, 2023
7a5363e
Use strict comparison in http.php
SergeyBiryukov Apr 13, 2023
d084cca
Use strict comparison in kses.php
SergeyBiryukov Apr 13, 2023
4e58465
Use strict comparison in link-template.php
SergeyBiryukov Apr 13, 2023
4feaca7
Use strict comparison in load.php
SergeyBiryukov Apr 13, 2023
1488cdb
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Apr 22, 2023
6bc1dac
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Apr 22, 2023
953940c
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Apr 23, 2023
7e29be4
Use strict comparison in ms-blogs.php
SergeyBiryukov May 16, 2023
46b2073
Use strict comparison in ms-files.php
SergeyBiryukov May 16, 2023
8f6e233
Use strict comparison in ms-functions.php
SergeyBiryukov May 16, 2023
48d23fe
Use strict comparison in ms-load.php
SergeyBiryukov May 16, 2023
acf58b3
Use strict comparison in ms-site.php
SergeyBiryukov May 16, 2023
d92aa65
Use strict comparison in nav-menu-template.php
SergeyBiryukov May 16, 2023
694d592
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov May 16, 2023
cdda507
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov May 29, 2023
d91300b
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov May 31, 2023
4fdecfc
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jun 2, 2023
8773763
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jun 4, 2023
56df29c
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jun 4, 2023
84662e8
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jun 12, 2023
6473791
Use strict comparison in post.php
SergeyBiryukov Jun 13, 2023
9da8d3b
Use strict comparison in class-wp-query.php
SergeyBiryukov Jun 13, 2023
754e481
Use strict comparison in class-wp-tax-query.php
SergeyBiryukov Jun 13, 2023
4afe3b6
Use strict comparison in class-wp.php
SergeyBiryukov Jun 13, 2023
adec27c
Use strict comparison in nav-menu-template.php
SergeyBiryukov Jun 13, 2023
bce41e6
Use strict comparison in nav-menu.php
SergeyBiryukov Jun 13, 2023
23c6105
Use strict comparison in option.php
SergeyBiryukov Jun 13, 2023
3e43144
Use strict comparison in pluggable.php
SergeyBiryukov Jun 13, 2023
2f02b20
Use strict comparison in entry.php
SergeyBiryukov Jun 13, 2023
e500356
Use strict comparison in mo.php
SergeyBiryukov Jun 13, 2023
5e0c680
Use strict comparison in plural-forms.php
SergeyBiryukov Jun 13, 2023
a978142
Use strict comparison in streams.php
SergeyBiryukov Jun 13, 2023
645c5a3
Use strict comparison in translations.php
SergeyBiryukov Jun 13, 2023
43fba89
Use strict comparison in post-template.php
SergeyBiryukov Jun 13, 2023
faa0bae
Use strict comparison in post.php
SergeyBiryukov Jun 13, 2023
69a73e3
Use strict comparison in revision.php
SergeyBiryukov Jun 13, 2023
0ca3797
Use strict comparison in rewrite.php
SergeyBiryukov Jun 13, 2023
9b19e2d
Use strict comparison in theme.php
SergeyBiryukov Jun 13, 2023
5ec5eb0
Use strict comparison in user.php
SergeyBiryukov Jun 13, 2023
b4ffbd0
Use strict comparison in class-wp-query.php
SergeyBiryukov Jun 13, 2023
ad1830a
Use correct type in get_page_by_path()
SergeyBiryukov Jun 13, 2023
64e4281
Type cast to int in select_plural_form()
SergeyBiryukov Jun 13, 2023
c77e610
Use correct type in wp_get_themes()
SergeyBiryukov Jun 13, 2023
d28d2d5
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jun 16, 2023
fd878b7
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 6, 2023
63d5d50
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 10, 2023
0221217
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 11, 2023
abde99a
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 11, 2023
866fa58
Remove extra character
SergeyBiryukov Jul 11, 2023
634a3f5
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 28, 2023
0579f2c
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Jul 30, 2023
62be419
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Aug 4, 2023
e19aae1
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Aug 12, 2023
68e6a1d
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Aug 16, 2023
7889f0a
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Aug 23, 2023
8738e38
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 14, 2024
61354b3
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 18, 2024
9353171
Remove unnecessary type casting in options-general.php
SergeyBiryukov Mar 18, 2024
b9b902d
Clarify comment in ajax-actions.php
SergeyBiryukov Mar 18, 2024
cffa5a4
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 20, 2024
e57b9f8
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 23, 2024
8e924de
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 23, 2024
45d39b5
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 24, 2024
778c805
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Mar 27, 2024
8c50aa9
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov May 9, 2024
2a7095a
Update user.php
SergeyBiryukov May 30, 2024
1b967ad
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov May 30, 2024
25e6e88
Update theme.php
SergeyBiryukov May 30, 2024
7232662
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Jun 1, 2024
cdff1b0
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Jun 8, 2024
b74c9ef
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Jun 10, 2024
461cc1f
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Sep 5, 2024
0485b36
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Sep 9, 2024
340c975
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Sep 9, 2024
af9a159
Merge branch 'trunk' into 56791-coding-standards
SergeyBiryukov Dec 8, 2024
8d80551
Update comment-template.php
SergeyBiryukov Dec 8, 2024
6db4bbf
Update comment-template.php
SergeyBiryukov Dec 8, 2024
e86f096
Update comment.php
SergeyBiryukov Dec 8, 2024
669b544
Merge remote-tracking branch 'upstream/trunk' into 56791-coding-stand…
SergeyBiryukov Dec 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-privacy-policy-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function text_change_check() {
* The == operator (equal, not identical) was used intentionally.
* See https://www.php.net/manual/en/language.operators.array.php
*/
if ( $new != $old ) {
if ( $new != $old ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
/*
* A plugin was activated or deactivated, or some policy text has changed.
* Show a notice on the relevant screens to inform the admin.
Expand Down
18 changes: 10 additions & 8 deletions src/wp-admin/includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function the_media_upload_tabs() {
foreach ( $tabs as $callback => $text ) {
$class = '';

if ( $current == $callback ) {
if ( $current === $callback ) {
$class = " class='current'";
}

Expand Down Expand Up @@ -807,7 +807,9 @@ function media_upload_form_handler() {
unset( $post['errors'] );
}

if ( $post != $_post ) {
// The == operator (equal, not identical) was used intentionally.
// See http://php.net/manual/en/language.operators.array.php
if ( $post != $_post ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
wp_update_post( $post );
}

Expand Down Expand Up @@ -1172,7 +1174,7 @@ function image_align_input_fields( $post, $checked = '' ) {
foreach ( $alignments as $name => $label ) {
$name = esc_attr( $name );
$output[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'" .
( $checked == $name ? " checked='checked'" : '' ) .
( $checked === $name ? " checked='checked'" : '' ) .
" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
}

Expand Down Expand Up @@ -1222,7 +1224,7 @@ function image_size_input_fields( $post, $check = '' ) {
$css_id = "image-size-{$size}-{$post->ID}";

// If this size is the default but that's not available, don't select it.
if ( $size == $check ) {
if ( $size === $check ) {
if ( $enabled ) {
$checked = " checked='checked'";
} else {
Expand Down Expand Up @@ -1762,7 +1764,7 @@ function get_media_item( $attachment_id, $args = null ) {
if ( 'image' === $type && $calling_post_id
&& current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' )
&& get_post_thumbnail_id( $calling_post_id ) != $attachment_id
&& get_post_thumbnail_id( $calling_post_id ) !== $attachment_id
) {

$calling_post = get_post( $calling_post_id );
Expand Down Expand Up @@ -2853,20 +2855,20 @@ function media_upload_library_form( $errors ) {
$month_count = count( $arc_result );
$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;

if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
if ( $month_count && ! ( 1 === $month_count && 0 === (int) $arc_result[0]->mmonth ) ) {
?>
<select name='m'>
<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
<?php

foreach ( $arc_result as $arc_row ) {
if ( 0 == $arc_row->yyear ) {
if ( 0 === (int) $arc_row->yyear ) {
continue;
}

$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );

if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) {
if ( (int) $arc_row->yyear . $arc_row->mmonth === (int) $selected_month ) {
$default = ' selected="selected"';
} else {
$default = '';
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-wp-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ final class WP_Comment {
* @since 4.4.0
* @var string
*/
public $comment_parent = 0;
public $comment_parent = '0';

/**
* Comment author ID.
Expand All @@ -144,7 +144,7 @@ final class WP_Comment {
* @since 4.4.0
* @var string
*/
public $user_id = 0;
public $user_id = '0';

/**
* Comment children.
Expand Down
64 changes: 35 additions & 29 deletions src/wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,10 @@ public function parse_query( $query = '' ) {
}

// Compat. Map subpost to attachment.
if ( is_scalar( $qv['subpost'] ) && '' != $qv['subpost'] ) {
if ( is_scalar( $qv['subpost'] ) && '' !== $qv['subpost'] ) {
$qv['attachment'] = $qv['subpost'];
}
if ( is_scalar( $qv['subpost_id'] ) && '' != $qv['subpost_id'] ) {
if ( is_scalar( $qv['subpost_id'] ) && '' !== $qv['subpost_id'] ) {
$qv['attachment_id'] = $qv['subpost_id'];
}

Expand Down Expand Up @@ -969,7 +969,7 @@ public function parse_query( $query = '' ) {
}
unset( $tax_query );

if ( empty( $qv['author'] ) || ( '0' == $qv['author'] ) ) {
if ( empty( $qv['author'] ) || ( '0' === (string) $qv['author'] ) ) {
$this->is_author = false;
} else {
$this->is_author = true;
Expand All @@ -991,24 +991,24 @@ public function parse_query( $query = '' ) {
}
}

if ( '' != $qv['feed'] ) {
if ( '' !== $qv['feed'] ) {
$this->is_feed = true;
}

if ( '' != $qv['embed'] ) {
if ( '' !== $qv['embed'] ) {
$this->is_embed = true;
}

if ( '' != $qv['tb'] ) {
if ( '' !== $qv['tb'] ) {
$this->is_trackback = true;
}

if ( '' != $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) {
if ( '' !== $qv['paged'] && ( (int) $qv['paged'] > 1 ) ) {
$this->is_paged = true;
}

// If we're previewing inside the write screen.
if ( '' != $qv['preview'] ) {
if ( '' !== $qv['preview'] ) {
$this->is_preview = true;
}

Expand Down Expand Up @@ -1076,25 +1076,29 @@ public function parse_query( $query = '' ) {
unset( $this->queried_object );
}

if ( 'page' === get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && get_option( 'page_for_posts' ) == $this->queried_object_id ) {
if ( 'page' === get_option( 'show_on_front' ) && isset( $this->queried_object_id )
&& (int) get_option( 'page_for_posts' ) === $this->queried_object_id
) {
$this->is_page = false;
$this->is_home = true;
$this->is_posts_page = true;
}

if ( isset( $this->queried_object_id ) && get_option( 'wp_page_for_privacy_policy' ) == $this->queried_object_id ) {
if ( isset( $this->queried_object_id )
&& (int) get_option( 'wp_page_for_privacy_policy' ) === $this->queried_object_id
) {
$this->is_privacy_policy = true;
}
}

if ( $qv['page_id'] ) {
if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == $qv['page_id'] ) {
if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) === $qv['page_id'] ) {
$this->is_page = false;
$this->is_home = true;
$this->is_posts_page = true;
}

if ( get_option( 'wp_page_for_privacy_policy' ) == $qv['page_id'] ) {
if ( get_option( 'wp_page_for_privacy_policy' ) === $qv['page_id'] ) {
$this->is_privacy_policy = true;
}
}
Expand Down Expand Up @@ -1122,7 +1126,7 @@ public function parse_query( $query = '' ) {
$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
// Done correcting `is_*` for 'page_on_front' and 'page_for_posts'.

if ( '404' == $qv['error'] ) {
if ( '404' === $qv['error'] ) {
$this->set_404();
}

Expand Down Expand Up @@ -1903,7 +1907,7 @@ public function get_posts() {

// Set a flag if a 'pre_get_posts' hook changed the query vars.
$hash = md5( serialize( $this->query_vars ) );
if ( $hash != $this->query_vars_hash ) {
if ( $hash !== $this->query_vars_hash ) {
$this->query_vars_changed = true;
$this->query_vars_hash = $hash;
}
Expand Down Expand Up @@ -1983,11 +1987,12 @@ public function get_posts() {
$q['showposts'] = (int) $q['showposts'];
$q['posts_per_page'] = $q['showposts'];
}
if ( ( isset( $q['posts_per_archive_page'] ) && 0 != $q['posts_per_archive_page'] ) && ( $this->is_archive || $this->is_search ) ) {
if ( ( isset( $q['posts_per_archive_page'] ) && 0 !== (int) $q['posts_per_archive_page'] )
&& ( $this->is_archive || $this->is_search ) ) {
$q['posts_per_page'] = $q['posts_per_archive_page'];
}
if ( ! isset( $q['nopaging'] ) ) {
if ( -1 == $q['posts_per_page'] ) {
if ( -1 === (int) $q['posts_per_page'] ) {
$q['nopaging'] = true;
} else {
$q['nopaging'] = false;
Expand All @@ -2003,14 +2008,15 @@ public function get_posts() {
}
$q['nopaging'] = false;
}

$q['posts_per_page'] = (int) $q['posts_per_page'];
if ( $q['posts_per_page'] < -1 ) {
$q['posts_per_page'] = abs( $q['posts_per_page'] );
} elseif ( 0 == $q['posts_per_page'] ) {
} elseif ( 0 === $q['posts_per_page'] ) {
$q['posts_per_page'] = 1;
}

if ( ! isset( $q['comments_per_page'] ) || 0 == $q['comments_per_page'] ) {
if ( ! isset( $q['comments_per_page'] ) || 0 === (int) $q['comments_per_page'] ) {
$q['comments_per_page'] = get_option( 'comments_per_page' );
}

Expand Down Expand Up @@ -2166,8 +2172,8 @@ public function get_posts() {
}
}

$page_for_posts = get_option( 'page_for_posts' );
if ( ( 'page' !== get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {
$page_for_posts = (int) get_option( 'page_for_posts' );
if ( ( 'page' !== get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage !== $page_for_posts ) ) {
$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );
$q['name'] = $q['pagename'];
$where .= " AND ({$wpdb->posts}.ID = '$reqpage')";
Expand Down Expand Up @@ -2217,7 +2223,7 @@ public function get_posts() {
}

if ( $q['page_id'] ) {
if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $q['page_id'] ) ) {
if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) !== $q['page_id'] ) ) {
$q['p'] = $q['page_id'];
$where = " AND {$wpdb->posts}.ID = " . $q['page_id'];
}
Expand Down Expand Up @@ -2338,7 +2344,7 @@ public function get_posts() {

// Author/user stuff.

if ( ! empty( $q['author'] ) && '0' != $q['author'] ) {
if ( ! empty( $q['author'] ) && 0 !== (int) $q['author'] ) {
$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
foreach ( $authors as $author ) {
Expand Down Expand Up @@ -3295,7 +3301,7 @@ public function get_posts() {
return $post_parents;
}

$is_unfiltered_query = $old_request == $this->request && "{$wpdb->posts}.*" === $fields;
$is_unfiltered_query = $old_request === $this->request && "{$wpdb->posts}.*" === $fields;

if ( null === $this->posts ) {
$split_the_query = (
Expand Down Expand Up @@ -3701,7 +3707,7 @@ public function the_post() {
$this->in_the_loop = true;
$this->before_loop = false;

if ( -1 == $this->current_post ) { // Loop has just started.
if ( -1 === $this->current_post ) { // Loop has just started.
/**
* Fires once the loop is started.
*
Expand All @@ -3728,7 +3734,7 @@ public function the_post() {
public function have_posts() {
if ( $this->current_post + 1 < $this->post_count ) {
return true;
} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
} elseif ( $this->current_post + 1 === $this->post_count && $this->post_count > 0 ) {
/**
* Fires once the loop has ended.
*
Expand Down Expand Up @@ -3795,7 +3801,7 @@ public function the_comment() {

$comment = $this->next_comment();

if ( 0 == $this->current_comment ) {
if ( 0 === $this->current_comment ) {
/**
* Fires once the comment loop is started.
*
Expand All @@ -3817,7 +3823,7 @@ public function the_comment() {
public function have_comments() {
if ( $this->current_comment + 1 < $this->comment_count ) {
return true;
} elseif ( $this->current_comment + 1 == $this->comment_count ) {
} elseif ( $this->current_comment + 1 === $this->comment_count ) {
$this->rewind_comments();
}

Expand Down Expand Up @@ -4484,7 +4490,7 @@ public function is_page( $page = '' ) {
}
$pagepath_obj = get_page_by_path( $pagepath );

if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
if ( $pagepath_obj && ( $pagepath_obj->ID === $page_obj->ID ) ) {
return true;
}
}
Expand Down Expand Up @@ -4594,7 +4600,7 @@ public function is_single( $post = '' ) {
}
$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );

if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
if ( $postpath_obj && ( $postpath_obj->ID === $post_obj->ID ) ) {
return true;
}
}
Expand Down
Loading
Loading