JayBizzle / Crawler-Detect

🕷 CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
https://crawlerdetect.io
MIT License
1.99k stars 258 forks source link

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated with PHP 8.1 #474

Closed acelaya closed 2 years ago

acelaya commented 2 years ago

I'm testing a project where I use jaybizzle/crawler-detect:1.2.109 with PHP 8.1, and it is throwing this error:

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /app/vendor/jaybizzle/crawler-detect/src/CrawlerDetect.php on line 168.

It works fine with PHP 8.0, but I guess it requires some changes to make it compatible with PHP 8.1

I'm open to contribute the fix if you want to.

acelaya commented 2 years ago

This seems to fix it https://github.com/JayBizzle/Crawler-Detect/pull/475