robots-txt-parser
robots-txt-parser copied to clipboard
Wrong boolean value in RobotsTxtValidator.php?
In https://github.com/bopoda/robots-txt-parser/blob/master/src/RobotsTxtParser/RobotsTxtValidator.php, there's a chunk of code at line 47:
$hasAllowDirectives = true;
foreach ($orderedDirectives as $directiveRow) {
if ($directiveRow['directive'] == 'allow') {
$hasAllowDirectives = true;
break;
}
}
Shouldn't that be:
$hasAllowDirectives = **false**;
foreach ($orderedDirectives as $directiveRow) {
if ($directiveRow['directive'] == 'allow') {
$hasAllowDirectives = true;
break;
}
}
Yes, you are right @scott8035 . The initial intention was as in code you provided. In general it should work, but extra condition does not give profit. Will have a look at this class later to improve.