rtf-html-php icon indicating copy to clipboard operation
rtf-html-php copied to clipboard

Testing rtf before parsing

Open sinnbeck opened this issue 5 years ago • 1 comments

Is there some hidden method of checking is RTF is valid before parsing it? I am running into issues with flooding my error handler with notices, as my third party RTF provider (an old system) is handing over badly formatted RTF.

It would be great if I could to something like this

$document = new Document();
if ($document->valid($rtf)) {
    $parsed = $document->Parse($rtf);
}

Also it would be nice if Document didn't both trigger a trigger_error as well throw an exception. This will hand off the error twice to my error handler (well only once if I catch it). An exception should be enough I would imagine? :)

sinnbeck avatar Nov 18 '19 11:11 sinnbeck

+1 on removing the trigger_error, that would also let @Sinnbeck solve his error spam problem with a try/catch around Parse.

Leshana avatar Jan 06 '20 21:01 Leshana