Details
Description
I was working with some contrib code which was sending an empty value to html2text.php. As a result, the following notice was produced:
Notice: Uninitialized string offset: 0 in /home/arborrow/Moodle/code/19stable/lib/html2text.php on line 39
I am attaching a diff file that gets around the notice; however, I'm not sure if setting $chr to an empty string is the best thing. But I think verifying that there is something there to work with in $badStr{0} is a good idea.
Peace - Anthony
Attachments
Issue Links
| This issue will be resolved by: | ||||
| MDL-17542 | html2text appears to be incompatible with the GPL |
|
|
|
A couple of questions that came to mind as I was looking at this.
1) Why is html2text.php function its own file? Is it just for licensing? Any reason not to include into a standard library (weblib or some other).
2) I generally like to see a default value in the case that one is not provided. Would there be any advantage to setting $badStr = '' or NULL? Similarly in /lib/weblib.php with the html_to_text($html) declaration any advantage to declaring a default value.
Peace - Anthony