find more cases (0 == ""), (0 == '0foo')

This commit is contained in:
orklah 2021-01-12 18:00:58 +01:00
parent 71db6d01f2
commit 770b9b5273

View File

@ -105,7 +105,7 @@ class InsaneComparisonAnalyzer implements AfterExpressionAnalysisInterface
$eligible_string = null;
foreach ($string_operand->getAtomicTypes() as $possibly_string) {
if ($possibly_string instanceof TLiteralString) {
if(preg_match('#\D#', $possibly_string->value[0] ?? '')) {
if(!is_numeric($possibly_string->value)) {
$eligible_string = $possibly_string;
break;
}