Bug BadBehavior issues with newer PHP versions

fionix

Customer
After installing this ADD On yesterday again, I get the below error when people create an thread for instant.

Code:
#0 src/addons/DBTech/Security/3rdParty/bad-behavior/banned.inc.php(47): dechex('2a06:98c0:3600:...')
#1 src/addons/DBTech/Security/3rdParty/bad-behavior/core.inc.php(22): bb2_display_denial(Array, Array, '17566707', '17566707')
#2 src/addons/DBTech/Security/3rdParty/bad-behavior/core.inc.php(152): bb2_banned(Array, Array, '17566707')
#3 src/addons/DBTech/Security/Listener.php(245): bb2_start(Array)
#4 src/XF/Extension.php(69): DBTech\Security\Listener::dispatcherPostRender(Object(XF\Mvc\Dispatcher), '<!doctype html>...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html), Object(XF\Http\Response))
#5 src/XF/App.php(2855): XF\Extension->fire('dispatcher_post...', Array, NULL)
#6 src/XF/Mvc/Dispatcher.php(409): XF\App->fire('dispatcher_post...', Array)
#7 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#8 src/XF/App.php(2353): XF\Mvc\Dispatcher->run()
#9 src/XF.php(524): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}
 
I would recommend disabling the BadBehavior integration for now. The project appears abandoned, as the original website is no longer accessible.

I'm monitoring efforts to revive the project but I have no news to share at this time.
 
Update: From others experiencing this issue, it seems like the current implementation does not work on PHP 8.1 or newer.

There is an alternative project that aims to carry on support here: https://github.com/Bad-Behaviour/badbehaviour but it requires PHP 8.0, so I'm hesitant to include it in the current version.

When XenForo 2.3 is released, I would consider bumping all of my add-ons up to a minimum PHP version of 8.0, which would then enable me to include this newer version.
 
I have an issue related to this
After updating PHP and testing it on 8.2 I noticed Bad behavior was off so I installed 8.0.30 as well

now whenever I try to change anything in the settings I get this message , seems like a bit of nonsense. I'm guessing again that I missed some step one should do when changing php versions and testing out the addon or then the check must be flawed.

1716038246321.webp
 
I believe I fixed that issue. I'm unsure but the error I think was here, given the naming of the function i would not have expected the ! operator in front of it. But instead simply a call to nobadbehavior if true then show error if not continue since badbehavior can run


Code:
public static function verifyOption(&$value, \XF\Entity\Option $option): bool
    {
        if ($value && !WatcherRepo::noBadBehavior()) // ! operator seems to be wrong, removing it allows me to enable bad behavior on php 8.0.30
        {
            $option->error(
                \XF::phrase('dbtech_security_bad_behavior_cannot_run_x_y_z', [
                    'minVersion' => WatcherRepo::BB2_MIN_PHP_VERSION,
                    'maxVersion' => WatcherRepo::BB2_MAX_PHP_VERSION,
                    'yourVersion' => phpversion()
                ]),
                $option->option_id
            );
            return false;
        }

        return true;
    }
 
Last edited:

DragonByte Security

XenForo 1.5.3+ XenForo 2.0.x XenForo 2.1.x XenForo 2.2.x XenForo 2.3.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
2,344
Customer rating
5.00 star(s) 1 ratings
Back
Top