FriendsOfFlarum/spamblock

Spamblock breaks hide-me extension (or vice versa)

protostork opened this issue · 5 comments

Hi, just leaving a quick bug report here, in case someone else has a similar problem.

When using the dotronglong/flarum-hide-me extension and spamblock at the same time, the site breaks in both front-end and back-end. I have left a bug report on hide-me also, for reference: dotronglong/flarum-hide-me#3

The error message (below) seems to be caused primarily by hide-me (though it works fine without spamblock enabled), so there must be some strange interaction between the two extensions.

Illuminate \ Database \ QueryException (42S02) SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flarum.flaanonymous_group' doesn't exist (SQL: select flagroups.*, flaanonymous_group.anonymous_idaspivot_anonymous_id, flaanonymous_group.group_idaspivot_group_idfromflagroupsinner joinflaanonymous_grouponflagroups.id=flaanonymous_group.group_idwhereflaanonymous_group.anonymous_id = -1) Previous exceptions SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flarum.flaanonymous_group' doesn't exist (42S02) SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flarum.flaanonymous_group' doesn't exist (42S02)

I don't know how spamblock would break this, hm. That error says a table that is called anonymous_group (assuming you have a fla DB prefix) doesn't exist - this extension doesn't add that, so I think we can't fix that here.

Can we have the stack trace of the error to see from where this database request originates?

Sure, here you go. By the way, the same error is also caused when hide-me and the dem13n/nickname-changer are installed at the same time (though it doesn't seem to interfere with any of the other most commonly used extensions).

Illuminate\Database\QueryException thrown with message "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flarum.flaanonymous_group' doesn't exist (SQL: select `flagroups`.*, `flaanonymous_group`.`anonymous_id` as `pivot_anonymous_id`, `flaanonymous_group`.`group_id` as `pivot_group_id` from `flagroups` inner join `flaanonymous_group` on `flagroups`.`id` = `flaanonymous_group`.`group_id` where `flaanonymous_group`.`anonymous_id` = -1)"

Stacktrace:
#91 Illuminate\Database\QueryException in /home/www/discuss/vendor/illuminate/database/Connection.php:664
#90 Tobscure\JsonApi\Document:Tobscure\JsonApi\{closure} in [internal]:0
#89 Doctrine\DBAL\Driver\PDOException in /home/www/discuss/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:66
#88 Tobscure\JsonApi\Document:Tobscure\JsonApi\{closure} in [internal]:0
#87 PDOException in /home/www/discuss/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:64
#86 PDO:prepare in /home/www/discuss/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:64
#85 Doctrine\DBAL\Driver\PDOConnection:prepare in /home/www/discuss/vendor/illuminate/database/Connection.php:326
#84 Illuminate\Database\Connection:Illuminate\Database\{closure} in /home/www/discuss/vendor/illuminate/database/Connection.php:657
#83 Illuminate\Database\Connection:runQueryCallback in /home/www/discuss/vendor/illuminate/database/Connection.php:624
#82 Illuminate\Database\Connection:run in /home/www/discuss/vendor/illuminate/database/Connection.php:333
#81 Illuminate\Database\Connection:select in /home/www/discuss/vendor/illuminate/database/Query/Builder.php:2095
#80 Illuminate\Database\Query\Builder:runSelect in /home/www/discuss/vendor/illuminate/database/Query/Builder.php:2083
#79 Illuminate\Database\Query\Builder:Illuminate\Database\Query\{closure} in /home/www/discuss/vendor/illuminate/database/Query/Builder.php:2569
#78 Illuminate\Database\Query\Builder:onceWithColumns in /home/www/discuss/vendor/illuminate/database/Query/Builder.php:2084
#77 Illuminate\Database\Query\Builder:get in /home/www/discuss/vendor/illuminate/database/Eloquent/Builder.php:519
#76 Illuminate\Database\Eloquent\Builder:getModels in /home/www/discuss/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php:584
#75 Illuminate\Database\Eloquent\Relations\BelongsToMany:get in /home/www/discuss/vendor/illuminate/database/Eloquent/Relations/BelongsToMany.php:563
#74 Illuminate\Database\Eloquent\Relations\BelongsToMany:getResults in /home/www/discuss/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php:419
#73 Illuminate\Database\Eloquent\Model:getRelationshipFromMethod in /home/www/discuss/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php:397
#72 Illuminate\Database\Eloquent\Model:getRelationValue in /home/www/discuss/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php:327
#71 Illuminate\Database\Eloquent\Model:getAttribute in /home/www/discuss/vendor/flarum/core/src/Database/AbstractModel.php:128
#70 Flarum\Database\AbstractModel:getAttribute in /home/www/discuss/vendor/illuminate/database/Eloquent/Model.php:1515
#69 Illuminate\Database\Eloquent\Model:__get in /home/www/discuss/vendor/flarum/core/src/User/User.php:649
#68 Flarum\User\User:permissions in /home/www/discuss/vendor/flarum/core/src/User/User.php:664
#67 Flarum\User\User:getPermissions in /home/www/discuss/vendor/flarum/core/src/User/User.php:361
#66 Flarum\User\User:hasPermission in /home/www/discuss/vendor/flarum/core/src/User/UserServiceProvider.php:78
#65 Flarum\User\UserServiceProvider:Flarum\User\{closure} in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:212
#64 call_user_func_array in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:212
#63 Flarum\User\Gate:callBeforeCallbacks in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:190
#62 Flarum\User\Gate:check in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:160
#61 Flarum\User\Gate:allows in /home/www/discuss/vendor/flarum/core/src/User/User.php:692
#60 Flarum\User\User:can in /home/www/discuss/vendor/fof/spamblock/src/Access/UserPolicy.php:32
#59 FoF\Spamblock\Access\UserPolicy:spamblock in /home/www/discuss/vendor/flarum/core/src/User/AbstractPolicy.php:43
#58 call_user_func_array in /home/www/discuss/vendor/flarum/core/src/User/AbstractPolicy.php:43
#57 Flarum\User\AbstractPolicy:getPermission in /home/www/discuss/vendor/illuminate/events/Dispatcher.php:360
#56 Illuminate\Events\Dispatcher:Illuminate\Events\{closure} in /home/www/discuss/vendor/illuminate/events/Dispatcher.php:209
#55 Illuminate\Events\Dispatcher:dispatch in /home/www/discuss/vendor/illuminate/events/Dispatcher.php:169
#54 Illuminate\Events\Dispatcher:until in /home/www/discuss/vendor/flarum/core/src/User/UserServiceProvider.php:68
#53 Flarum\User\UserServiceProvider:Flarum\User\{closure} in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:212
#52 call_user_func_array in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:212
#51 Flarum\User\Gate:callBeforeCallbacks in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:190
#50 Flarum\User\Gate:check in /home/www/discuss/vendor/flarum/core/src/User/Gate.php:160
#49 Flarum\User\Gate:allows in /home/www/discuss/vendor/flarum/core/src/User/User.php:692
#48 Flarum\User\User:can in /home/www/discuss/vendor/fof/spamblock/src/Listeners/AddPermissions.php:34
#47 FoF\Spamblock\Listeners\AddPermissions:serializing in /home/www/discuss/vendor/illuminate/events/Dispatcher.php:360
#46 Illuminate\Events\Dispatcher:Illuminate\Events\{closure} in /home/www/discuss/vendor/illuminate/events/Dispatcher.php:209
#45 Illuminate\Events\Dispatcher:dispatch in /home/www/discuss/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php:87
#44 Flarum\Api\Serializer\AbstractSerializer:getAttributes in /home/www/discuss/vendor/tobscure/json-api/src/Resource.php:169
#43 Tobscure\JsonApi\Resource:getAttributes in /home/www/discuss/vendor/tobscure/json-api/src/Resource.php:75
#42 Tobscure\JsonApi\Resource:toArray in /home/www/discuss/vendor/tobscure/json-api/src/Document.php:187
#41 Tobscure\JsonApi\Document:Tobscure\JsonApi\{closure} in [internal]:0
#40 array_map in /home/www/discuss/vendor/tobscure/json-api/src/Document.php:186
#39 Tobscure\JsonApi\Document:toArray in /home/www/discuss/vendor/tobscure/json-api/src/Document.php:224
#38 Tobscure\JsonApi\Document:jsonSerialize in /home/www/discuss/vendor/flarum/core/src/Api/JsonApiResponse.php:27
#37 Flarum\Api\JsonApiResponse:__construct in /home/www/discuss/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php:111
#36 Flarum\Api\Controller\AbstractSerializeController:handle in /home/www/discuss/vendor/flarum/core/src/Api/Client.php:72
#35 Flarum\Api\Client:send in /home/www/discuss/vendor/flarum/core/src/Frontend/Frontend.php:72
#34 Flarum\Frontend\Frontend:getForumDocument in /home/www/discuss/vendor/flarum/core/src/Frontend/Frontend.php:51
#33 Flarum\Frontend\Frontend:document in /home/www/discuss/vendor/flarum/core/src/Frontend/Controller.php:32
#32 Flarum\Frontend\Controller:handle in /home/www/discuss/vendor/flarum/core/src/Http/RouteHandlerFactory.php:38
#31 Flarum\Http\RouteHandlerFactory:Flarum\Http\{closure} in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/DispatchRoute.php:65
#30 Flarum\Http\Middleware\DispatchRoute:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#29 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Admin/Middleware/RequireAdministrateAbility.php:26
#28 Flarum\Admin\Middleware\RequireAdministrateAbility:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#27 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/SetLocale.php:50
#26 Flarum\Http\Middleware\SetLocale:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#25 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php:37
#24 Flarum\Http\Middleware\CheckCsrfToken:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#23 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php:32
#22 Flarum\Http\Middleware\AuthenticateWithSession:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#21 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php:51
#20 Flarum\Http\Middleware\RememberFromCookie:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#19 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/StartSession.php:61
#18 Flarum\Http\Middleware\StartSession:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#17 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php:28
#16 Flarum\Http\Middleware\ParseJsonBody:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#15 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/flarum/core/src/Http/Middleware/HandleErrors.php:57
#14 Flarum\Http\Middleware\HandleErrors:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#13 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:84
#12 Laminas\Stratigility\MiddlewarePipe:process in /home/www/discuss/vendor/middlewares/request-handler/src/RequestHandler.php:84
#11 Middlewares\RequestHandler:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#10 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/middlewares/base-path-router/src/BasePathRouter.php:97
#9 Middlewares\BasePathRouter:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#8 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php:42
#7 Laminas\Stratigility\Middleware\OriginalMessages:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#6 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/middlewares/base-path/src/BasePath.php:53
#5 Middlewares\BasePath:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/Next.php:61
#4 Laminas\Stratigility\Next:handle in /home/www/discuss/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:84
#3 Laminas\Stratigility\MiddlewarePipe:process in /home/www/discuss/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php:73
#2 Laminas\Stratigility\MiddlewarePipe:handle in /home/www/discuss/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php:96
#1 Laminas\HttpHandlerRunner\RequestHandlerRunner:run in /home/www/discuss/vendor/flarum/core/src/Http/Server.php:42
#0 Flarum\Http\Server:listen in /home/www/discuss/index.php:26

Hm I see FoF\Spamblock\Access\UserPolicy:spamblock mentioned in the log.

But that only contains

    public function spamblock(User $actor, User $user)
    {
        if ($actor->id === $user->id || $user->can('user.spamblock')) {
            return false;
        }
    }

so that can't be it. It's definitely an issue with the other extension, as it modifies the behavior here.

Thanks for looking into, will let the extension developer know.