Skip to content

Commit

Permalink
This should fix 5.2 failing
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Jul 21, 2016
1 parent 1229cfc commit 5d5ec8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 3 additions & 5 deletions WordPress/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {

return;
}
if ( PHP_VERSION_ID < 50300 ) {
var_dump( $openTag );
}
// Account for incorrect script open tags.
if ( T_INLINE_HTML === $openTag['code'] && 1 === preg_match( '`(<script (?:[^>]+)?language=[\'"]?php[\'"]?(?:[^>]+)?>)`i', $content, $match ) ) {

// Account for incorrect script open tags. The "(?:<s)?" in the regex is to work-around a bug in PHP 5.2.
if ( T_INLINE_HTML === $openTag['code'] && 1 === preg_match( '`((?:<s)?cript (?:[^>]+)?language=[\'"]?php[\'"]?(?:[^>]+)?>)`i', $content, $match ) ) {
$error = 'Script style opening tag used; expected "<?php" but found "%s"';
$snippet = $this->get_snippet( $content, $match[1] );
$data = array( $match[1] . $snippet );
Expand Down
9 changes: 9 additions & 0 deletions WordPress/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ protected function setUp() {
}
}

/**
* Skip this test on HHVM.
*
* @return bool Whether to skip this test.
*/
protected function shouldSkipTest() {
return defined( 'HHVM_VERSION' );
}

/**
* Returns the lines where errors should occur.
*
Expand Down

0 comments on commit 5d5ec8f

Please sign in to comment.