1

Topic: PHP Notice: Undefined index: safe

I may have stumbled across a bug in htmLawed. If $config is not passed or $config['safe'] is not set, invoking htmLawed() produces the follwing error:

PHP Notice:  Undefined index:  safe in .../htmLawed.php on line 40

2

Re: PHP Notice: Undefined index: safe

Thank you for reporting this 'harmless bug'. I'll fix it in the next release so PHP won't throw that notice. It can be fixed by changing the relevant part of line 40 of 'htmLawed.php' file:

// find in line 40
($C['safe'] == 1 ? ',on*' : '')));
// change to
((isset($C['safe']) && $C['safe'] == 1) ? ',on*' : '')));

Alternately, PHP can be made to not display PHP error notices:

ini_set('display_errors', 0);

3

Re: PHP Notice: Undefined index: safe

htmLawed 1.1.8.1 was released to fix this issue.