Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot split from a post with deleted user #43

Open
clarkwinkelmann opened this issue Jun 2, 2021 · 0 comments
Open

Cannot split from a post with deleted user #43

clarkwinkelmann opened this issue Jun 2, 2021 · 0 comments
Labels

Comments

@clarkwinkelmann
Copy link
Member

Bug Report

Current Behavior
If you start the split from a post with [deleted] user, the split fails with a 500 error.

Steps to Reproduce

  1. Create discussion with 2+ posts
  2. Delete author of second post, or use Author Change extension to manually remove the author
  3. Split from second post
  4. See "Oops something went wrong" red error message

Error message from log file:

[2021-06-02 23:13:04] flarum.ERROR: TypeError: Argument 2 passed to Flarum\Discussion\Discussion::start() must be an instance of Flarum\User\User, null given, called in /home/clark/Projects/flarum-1.0/vendor/fof/split/src/Api/Commands/SplitDiscussionHandler.php on line 97 and defined in /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Discussion/Discussion.php:120
Stack trace:
#0 /home/clark/Projects/flarum-1.0/vendor/fof/split/src/Api/Commands/SplitDiscussionHandler.php(97): Flarum\Discussion\Discussion::start()
#1 /home/clark/Projects/flarum-1.0/vendor/illuminate/bus/Dispatcher.php(122): FoF\Split\Api\Commands\SplitDiscussionHandler->handle()
#2 /home/clark/Projects/flarum-1.0/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#3 /home/clark/Projects/flarum-1.0/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#4 /home/clark/Projects/flarum-1.0/vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#5 /home/clark/Projects/flarum-1.0/vendor/illuminate/bus/Dispatcher.php(78): Illuminate\Bus\Dispatcher->dispatchNow()
#6 /home/clark/Projects/flarum-1.0/vendor/fof/split/src/Api/Controllers/SplitController.php(61): Illuminate\Bus\Dispatcher->dispatch()
#7 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(110): FoF\Split\Api\Controllers\SplitController->data()
#8 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle()
#9 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#10 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ExecuteRoute->process()
#11 /home/clark/Projects/flarum-1.0/workbench/flarum-ext-audit/src/Middlewares/ExtendSetPermissionController.php(19): Laminas\Stratigility\Next->handle()
#12 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Kilowhat\Audit\Middlewares\ExtendSetPermissionController->process()
#13 /home/clark/Projects/flarum-1.0/workbench/flarum-ext-audit/src/Middlewares/SetLoggerActor.php(28): Laminas\Stratigility\Next->handle()
#14 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Kilowhat\Audit\Middlewares\SetLoggerActor->process()
#15 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#16 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Api\Middleware\ThrottleApi->process()
#17 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(44): Laminas\Stratigility\Next->handle()
#18 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\CheckCsrfToken->process()
#19 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle()
#20 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ResolveRoute->process()
#21 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#22 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\SetLocale->process()
#23 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(56): Laminas\Stratigility\Next->handle()
#24 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithHeader->process()
#25 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#26 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\AuthenticateWithSession->process()
#27 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#28 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\RememberFromCookie->process()
#29 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#30 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\StartSession->process()
#31 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle()
#32 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Api\Middleware\FakeHttpMethods->process()
#33 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#34 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ParseJsonBody->process()
#35 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#36 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\HandleErrors->process()
#37 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#38 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\InjectActorReference->process()
#39 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle()
#40 /home/clark/Projects/flarum-1.0/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#41 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\RequestHandler->process()
#42 /home/clark/Projects/flarum-1.0/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle()
#43 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePathRouter->process()
#44 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(42): Laminas\Stratigility\Next->handle()
#45 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Laminas\Stratigility\Middleware\OriginalMessages->process()
#46 /home/clark/Projects/flarum-1.0/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#47 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Middlewares\BasePath->process()
#48 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#49 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/Next.php(61): Flarum\Http\Middleware\ProcessIp->process()
#50 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle()
#51 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(73): Laminas\Stratigility\MiddlewarePipe->process()
#52 /home/clark/Projects/flarum-1.0/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle()
#53 /home/clark/Projects/flarum-1.0/vendor/flarum/core/src/Http/Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#54 /home/clark/Projects/flarum-1.0/public/index.php(26): Flarum\Http\Server->listen()
#55 {main}  

Screenshots
(modal backdrop altered to better show what's behind it)
image

Environment

  • Flarum version: 1.0.1
  • Extension version: 1.0.0

Possible solution(s)
The problem is that Flarum's Discussion::start() method does not accept null as the author. I don't think there's an issue for it at the Flarum level yet.

A workaround would be to create the discussion model without using Discussion::start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant