Locating $modSetting['disableEntityCheck']
November 18, 2020, 04:26:57 pm
I'm in trouble locating an error with the handling of links in notification mails. Without going into too much detail, the problem comes down to doing a word wrap with the wrong (=too short) line length when the link contains entities, like "&". In the link it is replaced with "&", but he string length counts it as 1 character, when in the textual representation it's 5 characters. The function in question is Utils::strlen(). There I can spot logic that deals with exactly this problem. The code checks whether $modSetting['disableEntityCheck'] is set. I'm in deep trouble spotting the place where this setting flag comes from. It is not to be found anywhere else in the code. Also I couldn't find anything like this in the admin screens. Can someone shed light on this? Where could I find this setting, to check if that helps with my initial problem?
Re: Locating $modSetting['disableEntityCheck']
Reply #1 – November 18, 2020, 07:57:56 pm
Without knowing the cod,e,JP, my, perhaps stupid, question is whether it can be recoded as a constant (to test for effect) 'disableEntityCheck=True' / False? If that is feasible at least you'll discover whether you're chasing a rabbit or a fairy (or an orphan).
Re: Locating $modSetting['disableEntityCheck']
Reply #2 – November 19, 2020, 05:55:59 pm
disableEntityCheck is a very, very old setting in SMF that as far as I know has never been enabled anywhere for any reason. And it probably should not ever be enabled. Something else is wrong. The link is doing the correct thing in wrapping in emails; they're presumably being embedded as HTML links and encoding an ampersand in HTML is absolutely doing the correct thing in terms of encoding the link. Is the link to something inside the site? If so why is it even using an ampersand? Where are you getting the assertion from that the strlen length is even relevant (because there is no scenario in which it should be)? Instead of focusing on what you think the cause is, how about starting with what the actual problem is? An example maybe of the symptoms you're seeing would be useful.
Re: Locating $modSetting['disableEntityCheck']
Reply #7 – November 26, 2020, 06:27:14 pm
I didn't spend any effort on it really, just I remember how this stuff worked because I've been using it for years. Integrating Threadloom - I've only seen it done on vBulletin and XenForo, I guess there's no market for them for the free packages. Integrating SendGrid, I haven't done in years, and the integration I did for Mailgun I'd have to rewrite to port it to ElkArte - but since I don't actually use ElkArte... that would be difficult. I was just trying to be helpful given the shared DNA between ElkArte and SMF. Interesting that my tweak doesn't work - it makes me wonder if there is some other problem involved because as far as I could see that happened late enough that this should have already been only encoded the ones. Changing the Markdown parser as you've done will probably break links in posts, you really do need to leave the conversion to entity form for all web use because you cannot have it not encode for the web. But I've already provided enough warnings on that subject, hope it doesn't break too badly for you.