From f08bfcc8dc6436934565dd472479773d5c0400d8 Mon Sep 17 00:00:00 2001 From: orklah Date: Fri, 4 Dec 2020 13:29:45 +0100 Subject: [PATCH] fix bug --- hooks/InsaneComparisonAnalyzer.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/hooks/InsaneComparisonAnalyzer.php b/hooks/InsaneComparisonAnalyzer.php index 0674837..93234ca 100644 --- a/hooks/InsaneComparisonAnalyzer.php +++ b/hooks/InsaneComparisonAnalyzer.php @@ -104,12 +104,21 @@ public static function afterExpressionAnalysis( $eligible_string = null; foreach ($string_operand->getAtomicTypes() as $possibly_string) { - if ($possibly_string instanceof TLiteralString && preg_match('#[a-zA-Z]#', $possibly_string->value[0] ?? '')) { - $eligible_string = $possibly_string; - break; + if ($possibly_string instanceof TLiteralString) { + if(preg_match('#[a-zA-Z]#', $possibly_string->value[0] ?? '')) { + $eligible_string = $possibly_string; + break; + } + continue; } elseif ($possibly_string instanceof TSingleLetter && preg_match('#[a-zA-Z]#', $possibly_string->value[0] ?? '')) { - $eligible_string = $possibly_string; - break; + if(preg_match('#[a-zA-Z]#', $possibly_string->value[0] ?? '')) { + $eligible_string = $possibly_string; + break; + } + continue; + } elseif ($possibly_string instanceof Type\Atomic\TNumericString) { + // not interested + continue; } elseif ($possibly_string instanceof Type\Atomic\TString) { $eligible_string = $possibly_string; break;