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

RichText converter in HTML format throw error exception for some string patterns #5039

Closed
marc-farre opened this issue Apr 23, 2021 · 2 comments
Assignees
Labels

Comments

@marc-farre
Copy link
Collaborator

marc-farre commented Apr 23, 2021

What steps will reproduce the problem?

Add this code (the string pattern must have \ at the end of a line and > at the beginning of the next line):

use humhub\modules\content\widgets\richtext\RichText;
RichText::convert('some text \
> some text', RichText::FORMAT_HTML)

Log error

yii\base\ErrorException: Uninitialized string offset: 1 in /var/www/hhdev/protected/humhub/modules/content/widgets/richtext/converter/BaseRichTextConverter.php:341 
Stack trace: #0 
/var/www/hhdev/protected/humhub/modules/content/widgets/richtext/converter/BaseRichTextConverter.php(341): yii\base\ErrorHandler->handleError(8, 'Uninitialized s...', '/var/www/hhdev/...', 341, Array) #1 
/var/www/hhdev/protected/vendor/cebe/markdown/Parser.php(346): humhub\modules\content\widgets\richtext\converter\BaseRichTextConverter->parseEscape('\\') #2 
/var/www/hhdev/protected/vendor/cebe/markdown/GithubMarkdown.php(95): cebe\markdown\Parser->parseInline('\\') #3 
/var/www/hhdev/protected/vendor/cebe/markdown/Parser.php(195): cebe\markdown\GithubMarkdown->consumeParagraph(Array, 0) #4
/var/www/hhdev/protected/vendor/cebe/markdown/Parser.php(170): cebe\markdown\Parser->parseBlock(Array, 0) #5
/var/www/hhdev/protected/vendor/cebe/markdown/Parser.php(60): cebe\markdown\Parser->parseBlocks(Array) #6 
/var/www/hhdev/protected/humhub/modules/content/widgets/richtext/converter/BaseRichTextConverter.php(233): cebe\markdown\Parser->parse('some text \\\n> s...') #7 
/var/www/hhdev/protected/humhub/modules/content/widgets/richtext/converter/BaseRichTextConverter.php(157): humhub\modules\content\widgets\richtext\converter\BaseRichTextConverter->parse('some text \\\n> s...') #8 
/var/www/hhdev/protected/humhub/modules/content/widgets/richtext/ProsemirrorRichTextConverter.php(26): humhub\modules\content\widgets\richtext\converter\BaseRichTextConverter::process('some text \\\n> s...', Array) #9 
/var/www/hhdev/protected/humhub/modules/content/widgets/richtext/AbstractRichText.php(352): humhub\modules\content\widgets\richtext\ProsemirrorRichTextConverter->convertToHtml('some text \\\n> s...', Array) #10
...

Additional info

Q A
HumHub version 1.8.1
@yurabakhtin
Copy link
Contributor

@luke- Fixed in PR #5044.

@luke- luke- closed this as completed Apr 26, 2021
@luke-
Copy link
Contributor

luke- commented Apr 26, 2021

@yurabakhtin Thanks!

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

3 participants