Skip to content

Commit 53b9e2c

Browse files
committed
Avoid triggering PHP Warning: strpos(): Empty needle in UserAgent.php line 25.
(Remove any empty parsed useragent strings)
1 parent d60fa8b commit 53b9e2c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Robot/RobotsTxt.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ private function parseFile(RobotsFile $robotFile)
6565

6666
$this->records = [];
6767
foreach($fileRecords as $record) {
68+
if (!empty($record['ua'])) {
69+
$record['ua'] = array_filter($record['ua']);
70+
}
6871
if (!empty($record['ua']) && !empty($record['rules'])) {
6972
$this->records[] = new Record(new UserAgent($record['ua']), new AccessRules($record['rules']));
7073
}

0 commit comments

Comments
 (0)