Skip to content

Commit

Permalink
Add a defensive coding in posts per page sniff
Browse files Browse the repository at this point in the history
This will prevent the undefined offset internal error.
  • Loading branch information
dingo-d committed Sep 17, 2023
1 parent e6b3033 commit 38f2834
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion WordPress/Sniffs/WP/PostsPerPageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function callback( $key, $val, $line, $group ) {
$val = $stripped_val;
}

$first_char = $val[0];
$first_char = isset( $val[0] ) ? $val[0] : '';
if ( '-' === $first_char || '+' === $first_char ) {
$val = ltrim( $val, '-+' );
} else {
Expand Down

0 comments on commit 38f2834

Please sign in to comment.