henck / henck/rtf-html-php

Parse error: RTF text outside of group

Open
#75 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
107
Forks
79
PR merge metrics
No merged PRs in 30d

Description

I am getting this error after my rtf document is converted and I'm moving on to a new document to convert

$document = new \RtfHtmlPhp\Document($note_object->rtf);
$formatter = new \RtfHtmlPhp\Html\HtmlFormatter('UTF-8');
$plain_text = (strip_tags($formatter->Format($document)));

after I convert my rtf document to plain text, I'm then sending it through sftp, but when I move on to the next document to convert, it crashes with the message 'Parse error: RTF text outside of group'

I'm not sure what is causing this as I know that the object being send into the formatter is indeed RTF

More debug info:

Trace:
	Array
	(
	    [0] => Array
	        (
	            [args] => Array
	                (
	                    [0] => 1024
	                    [1] => Parse error: RTF text outside of group.
	                    [2] => /var/www/html/mysite/vendor/henck/rtf-to-html/src/Document.php
	                    [3] => 286
	                    [4] => Array
	                        (
	                            [text] => RtfHtmlPhp\Text Object
	                                (
	                                    [text] => This was created by the edito
	                                )

	                            [terminate] =>
	                            [err] => Parse error: RTF text outside of group.
	                        )

	                )

	        )

	    [1] => Array
	        (
	            [file] => /var/www/html/mysite/vendor/henck/rtf-to-html/src/Document.php
	            [line] => 286
	            [function] => trigger_error
	            [args] => Array
	                (
	                    [0] => Parse error: RTF text outside of group.
	                )

	        )

	    [2] => Array
	        (
	            [file] => /var/www/html/mysite/vendor/henck/rtf-to-html/src/Document.php
	            [line] => 326
	            [function] => ParseText
	            [class] => RtfHtmlPhp\Document
	            [type] => ->
	            [args] => Array
	                (
	                )

	        )

	    [3] => Array
	        (
	            [file] => /var/www/html/mysite/vendor/henck/rtf-to-html/src/Document.php
	            [line] => 17
	            [function] => Parse
	            [class] => RtfHtmlPhp\Document
	            [type] => ->
	            [args] => Array
	                (
	                    [0] => This was created by the editor
	                )

	        )

	    [4] => Array
	        (
	            [file] => /var/www/html/mysite/private/Controllers/Jobs/Healthelink/Dischargesummary.php
	            [line] => 105
	            [function] => __construct
	            [class] => RtfHtmlPhp\Document
	            [type] => ->
	            [args] => Array
	                (
	                    [0] => This was created by the editor
	                )

	        )

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure while converting successive documents, then inspect src/Document.php around lines 286, 326, and 17, where ParseText and Parse process the reported text. Compare the input passed from the caller at Dischargesummary.php line 105 with the parser's group handling; done means the sequence converts without the reported parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.