henck / henck/rtf-html-php

Testing rtf before parsing

Open
#66 1 comment 2 reactions 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

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? :)

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

Start by locating the Document class and tracing its Parse method, including where parsing errors are reported and exceptions are thrown. Determine how invalid RTF is currently handled and whether a validation entry point can be defined. Done means malformed input can be checked before parsing and error handling does not report the same failure twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.