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

Can't post private messages #211

Closed
GitWonder opened this issue Jan 28, 2025 · 4 comments
Closed

Can't post private messages #211

GitWonder opened this issue Jan 28, 2025 · 4 comments
Labels

Comments

@GitWonder
Copy link

GitWonder commented Jan 28, 2025

Bug Report

Current Behavior
Installed byobu in a new database. Attempted migration from phpbb. Then created a new private message via UI

Steps to Reproduce

  1. Go to Private Discussions
  2. Click on Discuss Privately
  3. Enter message
  4. See error
  5. Message is posted (multiple times)

Expected Behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • Flarum version: x.y.z
  • Extension version: x.y.z
  • Website URL: http://example.com
  • Webserver: [e.g. apache, nginx]
  • Hosting environment: [e.g. shared, vps]
  • PHP version: x.y.z
  • Browser: [e.g. chrome 67, safari 11]
Output of "php flarum info", 

Flarum core: 1.8.9
PHP version: 8.3.16
MySQL version: 8.0.40-0ubuntu0.22.04.1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gettext, iconv, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+--------------------------+---------+--------+
| Flarum Extensions        |         |        |
+--------------------------+---------+--------+
| ID                       | Version | Commit |
+--------------------------+---------+--------+
| flarum-flags             | v1.8.2  |        |
| flarum-approval          | v1.8.2  |        |
| flarum-tags              | v1.8.3  |        |
| flarum-suspend           | v1.8.4  |        |
| fof-byobu                | 1.3.9   |        |
| fof-user-directory       | 1.3.3   |        |
| afrux-forum-widgets-core | v0.1.7  |        |
| ianm-log-viewer          | 0.1.1   |        |
| fof-user-bio             | 1.4.2   |        |
| fof-upload               | 1.7.1   |        |
| fof-socialprofile        | 1.1.6   |        |
| fof-polls                | 2.2.12  |        |
| fof-masquerade           | 2.1.5   |        |
| fof-ignore-users         | 1.2.1   |        |
| fof-best-answer          | 1.6.3   |        |
| fof-ban-ips              | 1.1.2   |        |
| flarum-subscriptions     | v1.8.1  |        |
| flarum-sticky            | v1.8.2  |        |
| flarum-statistics        | v1.8.1  |        |
| flarum-mentions          | v1.8.5  |        |
| flarum-markdown          | v1.8.1  |        |
| flarum-lock              | v1.8.2  |        |
| flarum-likes             | v1.8.1  |        |
| flarum-lang-english      | v1.8.0  |        |
| flarum-extension-manager | v1.0.6  |        |
| flarum-emoji             | v1.8.1  |        |
| flarum-bbcode            | v1.8.0  |        |
| afrux-news-widget        | v0.1.1  |        |
+--------------------------+---------+--------+
Base URL: http://localhost/flarum
Installation path: /var/www/html/flarum
Queue driver: sync
Session driver: file
Scheduler status: Never run
Mail driver: mail
Debug mode: off```


[2025-01-28 00:22:06] flarum.ERROR: InvalidArgumentException: Cannot load XML: Opening and ending tag mismatch: P line 10 and r
 in /var/www/html/flarum/vendor/s9e/text-formatter/src/Renderer.php:46
Stack trace:
#0 /var/www/html/flarum/vendor/s9e/text-formatter/src/Renderers/PHP.php(303): s9e\TextFormatter\Renderer->loadXML()
#1 /var/www/html/flarum/vendor/s9e/text-formatter/src/Renderer.php(66): s9e\TextFormatter\Renderers\PHP->renderRichText()
#2 /var/www/html/flarum/vendor/flarum/core/src/Formatter/Formatter.php(126): s9e\TextFormatter\Renderer->render()
#3 /var/www/html/flarum/vendor/flarum/core/src/Post/CommentPost.php(176): Flarum\Formatter\Formatter->render()
#4 /var/www/html/flarum/vendor/flarum/core/src/Api/Serializer/BasicPostSerializer.php(63): Flarum\Post\CommentPost->formatContent()
#5 /var/www/html/flarum/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php(88): Flarum\Api\Serializer\BasicPostSerializer->getDefaultAttributes()
#6 /var/www/html/flarum/vendor/sycho/json-api/src/Resource.php(183): Flarum\Api\Serializer\AbstractSerializer->getAttributes()
#7 /var/www/html/flarum/vendor/sycho/json-api/src/Resource.php(81): Tobscure\JsonApi\Resource->getAttributes()
#8 /var/www/html/flarum/vendor/sycho/json-api/src/Document.php(194): Tobscure\JsonApi\Resource->toArray()
#9 [internal function]: Tobscure\JsonApi\Document->Tobscure\JsonApi\{closure}()
#10 /var/www/html/flarum/vendor/sycho/json-api/src/Document.php(193): array_map()
#11 /var/www/html/flarum/vendor/sycho/json-api/src/Document.php(232): Tobscure\JsonApi\Document->toArray()
#12 /var/www/html/flarum/vendor/flarum/core/src/Api/JsonApiResponse.php(27): Tobscure\JsonApi\Document->jsonSerialize()
#13 /var/www/html/flarum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(139): Flarum\Api\JsonApiResponse->__construct()
#14 /var/www/html/flarum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle()
#15 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#16 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ExecuteRoute->process()
#17 /var/www/html/flarum/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle()
#18 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Api\Middleware\ThrottleApi->process()
#19 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle()
#20 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\CheckCsrfToken->process()
#21 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle()
#22 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ResolveRoute->process()
#23 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#24 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\SetLocale->process()
#25 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle()
#26 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\AuthenticateWithHeader->process()
#27 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#28 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\AuthenticateWithSession->process()
#29 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#30 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\RememberFromCookie->process()
#31 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#32 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\StartSession->process()
#33 /var/www/html/flarum/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle()
#34 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Api\Middleware\FakeHttpMethods->process()
#35 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#36 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ParseJsonBody->process()
#37 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#38 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\HandleErrors->process()
#39 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#40 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\InjectActorReference->process()
#41 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(81): Laminas\Stratigility\Next->handle()
#42 /var/www/html/flarum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#43 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\RequestHandler->process()
#44 /var/www/html/flarum/vendor/middlewares/base-path-router/src/BasePathRouter.php(99): Laminas\Stratigility\Next->handle()
#45 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\BasePathRouter->process()
#46 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle()
#47 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Laminas\Stratigility\Middleware\OriginalMessages->process()
#48 /var/www/html/flarum/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#49 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\BasePath->process()
#50 /var/www/html/flarum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#51 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ProcessIp->process()
#52 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(81): Laminas\Stratigility\Next->handle()
#53 /var/www/html/flarum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(70): Laminas\Stratigility\MiddlewarePipe->process()
#54 /var/www/html/flarum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(73): Laminas\Stratigility\MiddlewarePipe->handle()
#55 /var/www/html/flarum/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#56 /var/www/html/flarum/index.php(26): Flarum\Http\Server->listen()
#57 {main}  

Possible solution(s)

Additional Context
Add any other context about the problem here.

@GitWonder GitWonder added the bug label Jan 28, 2025
@clarkwinkelmann
Copy link
Member

What did you use to migrate from phpbb? Did you migrate private messages, only regular discussions or only users? Are there any errors when browsing profiles or existing discussion after the migration?

Can you copy the content value of the new entries that were created in the posts table? So we can see what the broken XML mentioned in the error message looks like.

@GitWonder
Copy link
Author

GitWonder commented Jan 29, 2025

this is the content that for a new post

<t><p>What if I add another message</p></t>

This is the post chain. I've redacted the migrated text because you're only interested in the tags.

64374	21489	<r><URL url="https://REDACTED/forum/viewtopic.php?p=58176#p58176"><s>[s][url=https://REDACTED.com/forum/viewtopic.php?p=58176#p58176]</s>REDACTED<e>[/url][/s] [i](Post Deleted)[/i]</e></URL>
<QUOTE><s>[quote]</s> <br/>
REDACTED
<e>[/quote]</e></QUOTE>

REDACTED"</r>
65700	21489	<t>REDACTED</t>
65701	21489	<r><QUOTE author="REDACTED" msg_id="7412" time="1676414674" user_id="802"><s>[quote=REDACTED msg_id=7412 time=1676414674 user_id=802]</s>REDACTED<e>[/quote]</e></QUOTE>

REDACTED</r>
65702	21489	<r><QUOTE author="REDACTED" msg_id="7413" time="1676415416" user_id="1061"><s>[quote=REDACTED msg_id=7413 time=1676415416 user_id=1061]</s>
<QUOTE author="REDACTED" msg_id="7412" time="1676414674" user_id="802"><s>[quote=REDACTED msg_id=7412 time=1676414674 user_id=802]</s>REDACTED<e>[/quote]</e></QUOTE>

TREDACTED
<e>[/quote]</e></QUOTE>

REDACTED<br/>
<br/>
REDACTED</r>

It looks like my nasty AI generated code is mashing the BBCode tag replacement. I've had to AI home roll the migration script as all of the options out there seemed to do different versions of 80% of what I needed. I think it may have decided to rewrite the BBCode replacement that had been working earlier.

@clarkwinkelmann
Copy link
Member

That's curious, I don't see any obvious problem.

It's difficult to say for sure if the error message is caused by the new post, or by one of the older imported posts. But I'm not sure why an older post would get rendered when writing a private message, and if all imported posts had problems, you would be unable to browse the forum at all.

The error itself is a bit strange P line 10 and r implies there are 10 lines of XML somewhere, but such a short message would probably not span across 10 lines even with all the spacing that sometimes gets added between tags.

Did your import script use TextFormatter to create the XML, or was it all created externally? Ideally, your import script should output the posts in bbcode and/or markdown, then feed them to an instance of TextFormatter where you have previously activated the same plugins that you expect to use in Flarum. Unfortunately if the import script is not written as a Flarum extension itself, then you don't have an easy way to include the mention formatter plugin and would have to copy its template into a custom plugin. Or import everything in Flarum in just a <t> tag and use a Flarum extension to re-parse every post.

There's also a possibility that the error has nothing to do with either of these. You could try disabling all the other third-party extensions and see if there are still errors when creating private messages.

@GitWonder
Copy link
Author

Oops - I changed the post chain in my last post because I had eliminated some errors in the tagging. Apologies.

We've made an executive decision that we're not going to migrate old private messages. So in a way our problem has gone away. Thanks for your help, apologies that I've taken up your time.

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

2 participants