New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning: htmlspecialchars() ... on cron runs when an update is available #4423
Comments
The problem is the t() call for the mail subject in function update_mail(). The code is syntactically correct but still wrong. Which is easier to see, if trying to apply some indentation:
A PR is available, but testing can't happen in the sandbox, it needs a bit more this time. How to test:
sql:
Sending the mail is not affected by this problem, btw, but make sure that sending mails on available updates is turned on to trigger function update_mail(). |
Update: I had to fix my own wrong usage... Now it's really correct and (hopefully) readability has improved. |
@BWPanda what are the details of this log message? |
Same as yours: |
Sure, but triggered by what? Thinking this over - the dblog message detail won't help anyway, as it only contains "Location" as a not so helpful hint. Hm... and probably you can't patch around in a Tugboat instance. It might or might not be related to this issue - we won't be able to find that out, I guess. |
I actually discovered this issue when testing my custom install profile (installing the same test site over and over again). I noticed these two warnings in the log and came searching to see if others had had them too. To my surprise this issue was only hours old 😄 Since I didn't know if my custom profile was causing it, I tested a fresh, core Backdrop install on B.org's 'demo' page, and posted the screenshot here. Will see if I can work out the cause... |
Think I found it. Using Xdebug I found where this is getting called:
The problem seems to be with this line in
Here's the call to t(
'New release(s) available for !site_name',
array(
'!site_name' => config_get_translated('system.core', 'site_name'),
array(),
array('langcode' => $langcode)
),
array('langcode' => $langcode)
); So that's where the two arrays are coming from. This seems to have been introduced in backdrop/backdrop@32a8aa9 and it looks like it's just a |
Ehm... I'm confused... Did you miss that a PR already exists? And the existing PR fixes exactly that function... Or did you try to figure out the problem with the Tugboat instance? If it's the same problem, then this PR also fixes that. |
Yeah, I guess you totally missed my PR... And didn't read my comments. |
Doh, yes 😦 Ignore me, I'll just go hide in the corner now... |
Or even better - you could do testing and/or code review. 🤣 |
Small change requested for PR. |
@BWPanda welcome back from the corner 😸 and many thanks for reviewing. The PR has been updated accordingly. |
Thanks for the change. Code looks good and fixes the issue as I was experiencing it. Don't want to commit based just on my review, so will need another RTBC before I commit the PR. |
Oh, good job both @indigoxela and @BWPanda 👍 ...just by looking at that function, I thought that the entire Anyway, code looks good now, and in fact thank you @indigoxela for breaking that function up. It's much more readable and less likely to cause confusion now 👍 |
Thanks for this @indigoxela! Merged backdrop/backdrop#3153 into 1.x and 1.16.x. |
Description of the bug
When an update is available, whenever Backdrop checks for them on my sites (according to the update interval setting (daily / weekly...)) via cron run, a php warning appears twice in dblog:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (... 2054 ...core/includes/bootstrap.inc).
Steps To Reproduce
That's a bit tricky, as this only appears when updates are available. Not if there aren't any and not if running the update check via UI. Also, it might be necessary to install an additional language. Note: the sites aren't multilingual, it's just that the default language isn't English.
Additional information
This warning isn't new, I'm not even sure, if it hasn't been there ever since I'm using Backdrop. At least I don't remember when I first saw that in dblog.
This time I was smart and put a
debug($text)
in bootstrap.inc of a dev site. This is what check_plain() gets as array then (for the two notices):array()
array('langcode' => 'en',)
The text was updated successfully, but these errors were encountered: