From fe78ae1be42464f08f0e8430ac2f74a706b52aa5 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Sun, 19 Feb 2017 18:24:58 -0700 Subject: [PATCH] Fixed bug introduced by preg_match change from php/php-src#1303 Fix from https://github.com/squizlabs/PHP_CodeSniffer/commit/d397f87d58119cd04cba1bc4dda1216ebb9ba642 --- Joomla/Sniffs/Commenting/FileCommentSniff.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Joomla/Sniffs/Commenting/FileCommentSniff.php b/Joomla/Sniffs/Commenting/FileCommentSniff.php index bf70e543..b9cc6f43 100644 --- a/Joomla/Sniffs/Commenting/FileCommentSniff.php +++ b/Joomla/Sniffs/Commenting/FileCommentSniff.php @@ -530,7 +530,7 @@ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, array $tags if (preg_match('/^.*?([0-9]{4})((.{1})([0-9]{4}))? (.+)$/', $content, $matches) !== 0) { // Check earliest-latest year order. - if ($matches[3] !== '') + if ($matches[3] !== '' && $matches[3] !== null) { if ($matches[3] !== '-') { @@ -538,7 +538,7 @@ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, array $tags $phpcsFile->addError($error, $tag, 'CopyrightHyphen'); } - if ($matches[4] !== '' && $matches[4] < $matches[1]) + if ($matches[4] !== '' && $matches[4] !== null && $matches[4] < $matches[1]) { $error = "Invalid year span \"$matches[1]$matches[3]$matches[4]\" found; consider \"$matches[4]-$matches[1]\" instead"; $phpcsFile->addWarning($error, $tag, 'InvalidCopyright');