Kroc/DOMTemplate

DOMTemplateRepeater regression in v19

Closed this issue · 1 comments

Hi Krok!

There is a regression in v19. Here’s a minimal code to reproduce it:

$nav = new DOMTemplate('<nav><a></a></nav>');

$link = $nav->repeat('a');
$link->setValue('.', '<span>go&nbsp;back</span>', true);
$link->next();

echo $nav; 

There will be an error if you run this because DOMTemplateRepeater::htmlentities property is null. This leads to &nbps; not being converted, which means invalid XML goes into DOMDocument.

In v19 generation of HTML entities array has moved from the class to DOMTemplate, leaving DOMTemplateRepeater with null.

I wonder if storing it as a static variable of html_entity_decode function would solve it.

Kroc commented

Hi, so sorry for missing this issue! I've had an intense month that's not allowed me time to look at my projects. I'll be looking at your pull request soon; thank you very much for your efforts in bringing this issue forward, it's greatly appreciated!