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

Error 500 when trying to display revisions of a post that contains an mention to a post (reply) #34

Open
n-peugnet opened this issue Jan 23, 2023 · 2 comments · May be fixed by #35
Open

Comments

@n-peugnet
Copy link

When editing a posts that contains a mention to a post (using the "Reply" button, not a mention to a user), it is then impossible to view the revision history.

The API fails with a 500 error:

https://forum.club1.fr/api/diff?id=225

HTTP/2 500 Internal Server Error
server: nginx
date: Mon, 23 Jan 2023 11:47:02 GMT
content-type: application/vnd.api+json
X-Firefox-Spdy: h2

{"errors":[{"status":"500","code":"unknown"}]}

And the associated PHP stack trace:

[2023-01-23 11:47:02] flarum.ERROR: TypeError: Argument 2 passed to Flarum\Mentions\ConfigureMentions::addPostId() must be an instance of Flarum\User\User, null given in /var/www/forum.club1.fr/vendor/flarum/mentions/src/ConfigureMentions.php:128
Stack trace:
#0 [internal function]: Flarum\Mentions\ConfigureMentions::addPostId()
#1 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser/FilterProcessing.php(209): call_user_func_array()
#2 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser/FilterProcessing.php(130): s9e\TextFormatter\Parser\FilterProcessing::executeFilter()
#3 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser.php(1441): s9e\TextFormatter\Parser\FilterProcessing::filterTag()
#4 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser.php(1396): s9e\TextFormatter\Parser->processStartTag()
#5 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser.php(1297): s9e\TextFormatter\Parser->processCurrentTag()
#6 /var/www/forum.club1.fr/vendor/s9e/text-formatter/src/Parser.php(345): s9e\TextFormatter\Parser->processTags()
#7 /var/www/forum.club1.fr/vendor/flarum/core/src/Formatter/Formatter.php(105): s9e\TextFormatter\Parser->parse()
#8 /var/www/forum.club1.fr/vendor/the-turk/flarum-diff/src/Api/Serializers/DiffSerializer.php(263): Flarum\Formatter\Formatter->parse()
#9 /var/www/forum.club1.fr/vendor/the-turk/flarum-diff/src/Api/Serializers/DiffSerializer.php(133): TheTurk\Diff\Api\Serializers\DiffSerializer->formatter()
#10 /var/www/forum.club1.fr/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php(88): TheTurk\Diff\Api\Serializers\DiffSerializer->getDefaultAttributes()
#11 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Resource.php(183): Flarum\Api\Serializer\AbstractSerializer->getAttributes()
#12 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Resource.php(81): Tobscure\JsonApi\Resource->getAttributes()
#13 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Collection.php(113): Tobscure\JsonApi\Resource->toArray()
#14 [internal function]: Tobscure\JsonApi\Collection->Tobscure\JsonApi\{closure}()
#15 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Collection.php(114): array_map()
#16 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Document.php(188): Tobscure\JsonApi\Collection->toArray()
#17 /var/www/forum.club1.fr/vendor/sycho/json-api/src/Document.php(232): Tobscure\JsonApi\Document->toArray()
#18 /var/www/forum.club1.fr/vendor/flarum/core/src/Api/JsonApiResponse.php(27): Tobscure\JsonApi\Document->jsonSerialize()
#19 /var/www/forum.club1.fr/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(139): Flarum\Api\JsonApiResponse->__construct()
#20 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle()
#21 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#22 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ExecuteRoute->process()
#23 /var/www/forum.club1.fr/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#24 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\ThrottleApi->process()
#25 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle()
#26 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\CheckCsrfToken->process()
#27 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle()
#28 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ResolveRoute->process()
#29 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#30 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\SetLocale->process()
#31 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle()
#32 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithHeader->process()
#33 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#34 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithSession->process()
#35 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#36 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\RememberFromCookie->process()
#37 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#38 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\StartSession->process()
#39 /var/www/forum.club1.fr/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle()
#40 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\FakeHttpMethods->process()
#41 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#42 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ParseJsonBody->process()
#43 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#44 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\HandleErrors->process()
#45 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#46 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\InjectActorReference->process()
#47 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#48 /var/www/forum.club1.fr/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#49 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\RequestHandler->process()
#50 /var/www/forum.club1.fr/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle()
#51 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePathRouter->process()
#52 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle()
#53 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Laminas\Stratigility\Middleware\OriginalMessages->process()
#54 /var/www/forum.club1.fr/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#55 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePath->process()
#56 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#57 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ProcessIp->process()
#58 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle()
#59 /var/www/forum.club1.fr/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(64): Laminas\Stratigility\MiddlewarePipe->process()
#60 /var/www/forum.club1.fr/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle()
#61 /var/www/forum.club1.fr/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#62 /var/www/forum.club1.fr/public/index.php(26): Flarum\Http\Server->listen()
#63 {main}--

Here is an example post, which after editing produces the issue:

@"vincent"#9 encore un test

And flarum info:

Flarum core 1.6.3
PHP version: 7.4.3
MySQL version: 5.5.5-10.5.18-MariaDB-1:10.5.18+maria~ubu2004
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, intl, json, ldap, exif, memcache, msgpack, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache
+-------------------------------+------------------+--------+
| Flarum Extensions             |                  |        |
+-------------------------------+------------------+--------+
| ID                            | Version          | Commit |
+-------------------------------+------------------+--------+
| flarum-tags                   | v1.6.1           |        |
| flarum-suspend                | v1.6.1           |        |
| flarum-markdown               | v1.6.1           |        |
| zerosonesfun-composer-preview | 1.1.9            |        |
| tituspijean-auth-ldap         | dev-modifs-club1 |        |
| the-turk-diff                 | 1.1.2            |        |
| nearata-remove-pane           | v2.0.1           |        |
| ianm-syndication              | dev-fix-atom-ids |        |
| fof-user-bio                  | 1.1.1            |        |
| fof-links                     | 1.1.2            |        |
| fof-formatting                | 1.0.2            |        |
| fof-default-user-preferences  | 1.2.0            |        |
| flarum-subscriptions          | v1.6.3           |        |
| flarum-sticky                 | v1.6.1           |        |
| flarum-statistics             | v1.6.1           |        |
| flarum-mentions               | v1.6.3           |        |
| flarum-lock                   | v1.6.1           |        |
| flarum-likes                  | v1.6.1           |        |
| flarum-lang-french            | v4.5.0           |        |
| flarum-lang-english           | v1.6.0           |        |
| flarum-flags                  | v1.6.1           |        |
| datlechin-discussion-count    | v0.1.0           |        |
| club-1-cross-references       | v0.4.1           |        |
| askvortsov-checklist          | v1.3.1           |        |
+-------------------------------+------------------+--------+
Base URL: https://forum.club1.fr
Installation path: /var/www/forum.club1.fr
Queue driver: sync
Session driver: file
Mail driver: smtp
Debug mode: off
@7UMENGL1aNG
Copy link

post edited

Edited posts: Normal

reply-post edited

Edited post-reply: Normal

reply-reply -1 edited

Edited reply-reply-1: Error

reply-reply-2 edited

Edited reply-reply-2: Error


Logs:

flarum.ERROR: TypeError: Flarum\Mentions\ConfigureMentions::addPostId(): Argument #2 ($actor) must be of type Flarum\User\User, null given in /www/wwwroot/forum.monika.love/vendor/flarum/mentions/src/ConfigureMentions.php:128

Info:

+----------------------------------------+---------+--------+
| Flarum Extensions                      |         |        |
+----------------------------------------+---------+--------+
| ID                                     | Version | Commit |
+----------------------------------------+---------+--------+
| flarum-flags                           | v1.6.1  |        |
| flarum-likes                           | v1.6.1  |        |
| flarum-tags                            | v1.6.1  |        |
| flarum-sticky                          | v1.6.1  |        |
| flarum-suspend                         | v1.6.1  |        |
| flarum-nicknames                       | v1.6.1  |        |
| flarum-lock                            | v1.6.1  |        |
| flarum-approval                        | v1.6.1  |        |
| afrux-forum-widgets-core               | v0.1.7  |        |
| flarum-mentions                        | v1.6.3  |        |
| antoinefr-money                        | v1.2.0  |        |
| flarum-markdown                        | v1.6.1  |        |
| zerosonesfun-direct-links              | 3.1     |        |
| zequeen-acgembed-remastered            | v1.1.2  |        |
| v17development-user-badges             | v1.1.0  |        |
| the-turk-stickiest                     | 3.0.1   |        |
| the-turk-diff                          | 1.1.2   |        |
| sycho-profile-cover                    | v1.3.3  |        |
| pipecraft-id-slug                      | v1.1.0  |        |
| nearata-embed-video                    | v3.2.1  |        |
| malago-ads                             | 0.3.2   |        |
| kilowhat-audit-free                    | 1.6.0   |        |
| justoverclock-staff-members-widget     | 0.1.3   |        |
| justoverclock-guestengagement          | 1.0.3   |        |
| justoverclock-auto-post-count-badge    | 0.1.9   |        |
| jslirola-login2seeplus                 | v0.2.1  |        |
| ianm-synopsis                          | 1.2.2   |        |
| ianm-level-ranks                       | 1.1.0   |        |
| fof-username-request                   | 1.0.1   |        |
| fof-user-directory                     | 1.2.3   |        |
| fof-user-bio                           | 1.1.1   |        |
| fof-upload                             | 1.2.3   |        |
| fof-terms                              | 1.2.0   |        |
| fof-subscribed                         | 1.1.2   |        |
| fof-split                              | 1.1.0   |        |
| fof-sitemap                            | 2.0.1   |        |
| fof-profile-image-crop                 | 1.1.0   |        |
| fof-polls                              | 1.3.0   |        |
| fof-nightmode                          | 1.5.1   |        |
| fof-merge-discussions                  | 1.3.1   |        |
| fof-links                              | 1.1.2   |        |
| fof-linguist                           | 1.1.0   |        |
| fof-html-errors                        | 1.1.0   |        |
| fof-drafts                             | 1.2.2   |        |
| fof-doorman                            | 1.1.1   |        |
| fof-best-answer                        | 1.2.4   |        |
| flarum-subscriptions                   | v1.6.3  |        |
| flarum-statistics                      | v1.6.1  |        |
| flarum-lang-english                    | v1.6.0  |        |
| flarum-lang-chinese-simplified         | v1.3.0  |        |
| ecnu-im-sticky-sidenav                 | v1.1.0  |        |
| dem13n-topic-starter-label             | 0.1.8   |        |
| darkle-fancybox                        | 1.1.2   |        |
| club-1-cross-references                | v0.4.1  |        |
| clarkwinkelmann-who-read               | 1.4.1   |        |
| clarkwinkelmann-sudo-mode              | 1.0.2   |        |
| clarkwinkelmann-prominent-post-numbers | 1.0.0   |        |
| clarkwinkelmann-money-rewards          | 1.0.0   |        |
| blessing-oauth-client                  | v2.0.2  |        |
| askvortsov-rich-text                   | v2.1.7  |        |
| askvortsov-moderator-warnings          | v0.6.1  |        |
| askvortsov-markdown-tables             | v1.2.1  |        |
| askvortsov-categories                  | v3.0.6  |        |
| afrux-online-users-widget              | v0.1.6  |        |
| afrux-news-widget                      | v0.1.1  |        |
| afrux-forum-stats-widget               | v0.1.1  |        |
+----------------------------------------+---------+--------+
Base URL: https://forum.monika.love
Installation path: /www/wwwroot/forum.monika.love
Queue driver: sync
Session driver: file
Mail driver: smtp
Debug mode: off

I don't have a 500 error, but I think I'm in a similar situation to him.

@n-peugnet n-peugnet linked a pull request Feb 9, 2023 that will close this issue
@n0099
Copy link

n0099 commented Mar 5, 2023

related: s9e/TextFormatter#214

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

Successfully merging a pull request may close this issue.

3 participants