Skip to content

Commit 6817774

Browse files
feat: add scrape regex test for useragent string
1 parent dc406b3 commit 6817774

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/Rules/RegexpSpam.php

+7
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public static function verify( array $item ): int {
111111
[
112112
'rawurl' => '^http[s]?:\/\/(accounts\.)?binance\.com\/[a-zA-Z-]+\/register(-person)?\?ref=[\w]+',
113113
],
114+
[
115+
'useragent' => 'scrape',
116+
]
114117
];
115118

116119
$quoted_author = preg_quote( $subject['author'], '/' );
@@ -154,6 +157,10 @@ public static function verify( array $item ): int {
154157
continue;
155158
}
156159

160+
if ( ! isset( $subject[ $field ] ) ) {
161+
continue;
162+
}
163+
157164
$subject[ $field ] = ( function_exists( 'iconv' ) ? iconv( 'utf-8', 'utf-8//TRANSLIT', $subject[ $field ] ) : $subject[ $field ] );
158165

159166
if ( empty( $subject[ $field ] ) ) {

0 commit comments

Comments
 (0)