php warning `DOMDocument::loadXML(): EntityRef: expecting ';' in Entity, line: 4`
gutenberg setup: https://i.snag.gy/HUfCul.jpg
results in:
php warning DOMDocument::loadXML(): EntityRef: expecting ';' in Entity, line: 4
how to proceed?
@paulkirspuu were you able to set a breakpoint and inspect what the string contents is at the time this warning is thrown?
It doesn't look like @mattwatsoncodes is able to do much based on this vague issue report.
Hmmm, unless things have changed @paulkirspuu the DOMDocument only used to parse the parent block, so the innerblock shouldn't be an issue.
I'll have to investigate how it's working now. As I say, things may very well have changed.
Hi @mattwatsoncodes
Based on what I'm reading at https://stackoverflow.com/questions/9760208/php-domdocument-error-entity-nbsp-not-defined I think we should be using $dom->loadHTML(), instead of current https://github.com/mattwatsoncodes/secure-blocks-for-gutenberg/blob/13628f85f0c806f2427703cdf3a8d4c8891b3414/blocks/secure-block/php/class-secure-block.php#L94
$dom->loadXML() is generating thousands of PHP Warnings per day. Your thoughts?
Hi @lkraav I no longer support this plugin, however the correct way to do things would be to use the pre_render_block hook, and just return false if the conditions are met.
The approach I previously used is completely the wrong one.
Is there another plugin on the market? Block Context by @kasparsd doesn't have user roles implemented yet https://github.com/preseto/block-context/issues/3
General learning: DomDocument also has problems with HTML5 tags https://stackoverflow.com/questions/6090667/php-domdocument-errors-warnings-on-html5-tags
Therefore it might be completely unsuitable for this type of HTML processing and an external library might have to be integrated.