htmlpurifier icon indicating copy to clipboard operation
htmlpurifier copied to clipboard

Cannot retrieve value of undefined directive Core.RemoveBlanks

Open FadeFx opened this issue 1 year ago • 15 comments

Hi,

I am using nextcloud and its news app, which actually is an RSS reader and uses your library. Since its latest alpha build it constantly floods nextcloud logs with

{"reqId":"S9A6V7FoXrzh4bT1hs1U","level":2,"time":"2024-11-16T08:50:24+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"Cannot retrieve value of undefined directive Core.RemoveBlanks invoked on line 75 in file /var/www/nextcloud/apps/news/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php at /var/www/nextcloud/apps/news/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php#901","userAgent":"--","version":"30.0.2.2","data":{"app":"PHP"},"id":"67385db8a6022"}

And the Dev suggested to post this here, as it seems to be an upstream issue in your library. Please also check this bugreport in nextcloud/news https://github.com/nextcloud/news/issues/2883

FadeFx avatar Nov 17 '24 05:11 FadeFx

We didn't remove this directive. What if you reinstall HTML Purifier?

ezyang avatar Nov 18 '24 18:11 ezyang

The directive was added in 4.18 (latest release), but I cannot replicate the issue when using DOMLex. $config->get('Core.RemoveBlanks') returns false

bytestream avatar Nov 19 '24 13:11 bytestream

I'm also experiencing this in nextcloud news. Is there anything specific I can dig into to help investigate?

castle-giant avatar Nov 19 '24 19:11 castle-giant

I don't really know much about HTML Purifyer, but I guess it is bundled with nextcloud news as an external library would I just need to replace a file to reinstall it? Or is it actually installed in the os?

FadeFx avatar Nov 19 '24 19:11 FadeFx

OK, so this is shipping with the nextcloud-news app, nothing I could do there I guess

FadeFx avatar Nov 19 '24 22:11 FadeFx

I am guessing they botched their bundle. Go complain back at them.

ezyang avatar Nov 20 '24 00:11 ezyang

So you confirm everything is working from your side? I guess that "RemoveBlanks" function is widely used and it would surface immediately if there was a bug at your side, right?

FadeFx avatar Nov 20 '24 05:11 FadeFx

I am guessing they botched their bundle. Go complain back at them.

News just ships whatever Composer gives us, is there a way to further debug this?

The initialisation in news is done like this: https://github.com/nextcloud/news/blob/594be805c85c8b06c9b9918f90453309cfd1ade3/lib/AppInfo/Application.php#L103

SMillerDev avatar Nov 20 '24 08:11 SMillerDev

I'd go look at the ConfigSchema ser and manually check it matches what's in Git

ezyang avatar Dec 03 '24 17:12 ezyang

Hello, I am not using nextcloud and have also noticed this exact issue when using the latest version of htmlpurifier v4.18.0. We have temporarily fixed it by reverting to v4.17.0.

yvonnewat avatar Jan 15 '25 22:01 yvonnewat

I also have the same issue, and I'm installing it directly from Composer.

kavanagh21 avatar Feb 06 '25 14:02 kavanagh21

It seems the nextcloud news team have narrowed the issue down to another app using htmlpurifier as well, causing dependency issues, if I got it right. Check here: https://github.com/nextcloud/news/issues/3017

FadeFx avatar Feb 06 '25 16:02 FadeFx

Sorry, I didn't write that very clearly; I'm installing HTMLPurifier directly from composer. I don't have nextcloud installed and have never used it. I've tried rolling back to 4.17.0 but that didn't fix it either, sadly.

kavanagh21 avatar Feb 06 '25 19:02 kavanagh21

What I wanted to asy, is there anything else, using htmlpurifier on your system that could cause cross dependencies?

FadeFx avatar Feb 06 '25 20:02 FadeFx

My understanding is that this is not a HTMLPurifier issue. They had the news app running v4.17.0 and the mail app running v.4.18.0. That created a conflict as Core.RemoveBlanks was only introduced in v4.18.0

bytestream avatar Feb 11 '25 12:02 bytestream