1 (edited by IAmCorbin 2010-03-09 23:32:19)

Topic: [SOLVED] Attributes being stripped of their values

I just started using htmLawed 1.1.9.1 and it looks great so far. I'm having trouble specifying the allowed attributes though.

$config = array('safe'=>1,
            'tidy'=>1,
            'deny_attribute'=>'* -style -href -target',
            'schemes'=>'style: *; href: *; target: *');
$title = htmLawed($filteredInput['title'],$config);
$text = htmLawed($_POST['text'],$config);

If I'm not mistaken, these $config options should allow only the attributes: 'style', 'href', or 'target' and it should allow any value.

When it runs it does allow these attributes, but it replaces any attribute value with "\"
  e.g.
before: style="background: red"
after: style="\"

What am I doing wrong?

2

Re: [SOLVED] Attributes being stripped of their values

Could this be related to PHP 'magic quotes'? See this thread. If not, is there any other type of processing done on the input/output text? The settings you are using work fine and as expected on the htmLawed demo page.

3

Re: [SOLVED] Attributes being stripped of their values

That would be the problem. It's working now, thanks