PR-6.1-dev Pending

User tests: Successful: Unsuccessful:

avatar BrainforgeUK
BrainforgeUK
5 Nov 2025

Now uses strpos instead of preg_match.

Summary of Changes

In isRobot() use strpos() instead of preg_match() as that is faster.

See https://www.php.net/manual/en/function.preg-match.php#refsect1-function.preg-match-notes

Testing Instructions

A simple test available in this plugin.
bfisrobottest.zip

Install and on enabling the front-end displays the following on success:
Test (false):
Test (true):1
Test (true):1

Actual result BEFORE applying this Pull Request

Robots detected.

Expected result AFTER applying this Pull Request

Robots detected.
Its a big list of robots - possibly a detectable performance improvement,

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar BrainforgeUK BrainforgeUK - open - 5 Nov 2025
avatar BrainforgeUK BrainforgeUK - change - 5 Nov 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Nov 2025
Category Libraries
avatar brianteeman
brianteeman - comment - 5 Nov 2025

The list is massively out of date

See #45323

avatar BrainforgeUK
BrainforgeUK - comment - 5 Nov 2025

Agree I was wondering about the best way forward. See comment I've added to #45323

Would moving this big list into a plugin be a first start? e.g.

plg_browserbot_legacy

Can then investigate other bot detectors like this.
https://fingerprint.com/try/bot-detection/

plg_browserbot_fingerprint

Up to site admin to enable the one(s) they want to use.

avatar BrainforgeUK BrainforgeUK - change - 5 Nov 2025
Labels Added: PR-6.1-dev
avatar BrainforgeUK
BrainforgeUK - comment - 5 Nov 2025

Added support for isrobot event in browserbot plugin folder.
Falls through to legacy list if no plugin found.

In future can add browserbot plugins whenever convenient.

Install and enable this plugin to test:
plg_browserbot_test.zip

Invocation:
To emulate a normal user
yourtestsite/index.php?isrobot=0

And to emulate a robot
yourtestsite/index.php?isrobot=1

Legacy isRobot behaviour
yourtestsite/index.php

avatar ceford
ceford - comment - 5 Nov 2025

Could you use in_array()? How would it compare for speed?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46413.

avatar brianteeman
brianteeman - comment - 5 Nov 2025

As I wrote in the referenced issue we should not be trying to maintain a list of robots ourselves and should be using a well maintained library instead

avatar BrainforgeUK
BrainforgeUK - comment - 5 Nov 2025

As I wrote in the referenced issue we should not be trying to maintain a list of robots ourselves and should be using a well maintained library instead

... The plugin solution opens up the possibility to use any number of free / freemium / paid for libraries. Maybe one plugin could be distributed with Joomla Project like Google Captcha is incluided. Other possibilities left to 3rd party developers.

Not an intended outcome of this pull request I have a long-standing use case of the Browser class where it looks like using this plugin approach is worth investigating.

Add a Comment

Login with GitHub to post a comment