Skip to content

False positive htmlAttrNotByEscHTML #680

@kkmuffme

Description

@kkmuffme

Bug Description

False positive

Minimal Code Snippet

for ( $i = 1; $i <= 10; $i++ ) { ?>
	<option value="<?php echo esc_attr( $i ); ?>" <?php echo ( $filter_importance === $i ) ? 'selected' : ''; ?> >
		&gt;=<?php echo esc_html( $i ); ?>
	</option>
<?php } ?>

Error Code

WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML for &gt;=<?php echo esc_html( $i ); ?>

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version 7.4.14
PHP_CodeSniffer version 3.6.0
VIPCS version 2.3.1

Tested Against master branch?

  • I have verified the issue still exists in the master branch of VIPCS.
  • I have verified the issue still exists in the develop branch of VIPCS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions