Digests

Changes to twig behavior on loading files in 3.3.9 - Digests

Changes to twig behavior on loading files in 3.3.9

by pg143 » Thu Dec 08, 2022 7:43 am

I get this error on all forums since they were upgraded to phpBB 3.3.9.

This issue only affects the UCP Digests tab as far as I can tell.

Is a "fix" possible? Or can you send the updated file(s)? I'd rather not mess with your code to make the suggested changes.

We are about to include Digests (updated translation) in the French extension database and it would be nice to solve the issue beforehand.

phpBB 3.3.9
PHP 8.0.26
Digest 3.3.17
Last edited by pg143 on Fri Dec 09, 2022 4:56 pm
pg143
Registered User
Posts: 8
Joined: Sun Nov 10, 2019 6:12 pm

Re: Changes to twig behavior on loading files in 3.3.9

by MarkDHamill » Thu Dec 08, 2022 2:33 pm

All I can suggest is to purge the cache and see if the error goes away.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Changes to twig behavior on loading files in 3.3.9

by pg143 » Thu Dec 08, 2022 4:43 pm

Purging the cache didn't modify the behavior.

This link explains changes that must be applied to extensions (not only this one) in order to support phpBB 3.3.9 and avoid this known issue.

Namely:
Starting with the twig version used in phpBB 3.3.9, some extensions might display error messages like the following
Fatal error: Uncaught Twig\Error\LoaderError: Looks like you try to load a template outside configured directories (../theme/some_file.css) in "@ExtAuthor_ExtName/some_other_file.html"
This is caused by the more restrictive handling of files that are allowed to be loaded by twig.
One can easily solve this problem by using the extension prefix instead of relative paths (…)
Other includes like INCLUDEJS or the twig include will be affected by this behavior as well. It's recommended to always use the prefix for your extension as outlined above.
pg143
Registered User
Posts: 8
Joined: Sun Nov 10, 2019 6:12 pm

Re: Changes to twig behavior on loading files in 3.3.9

by MarkDHamill » Thu Dec 08, 2022 6:18 pm

Thank you for your research. The fix that works for me is here:

https://github.com/MarkDHamill/digests/ ... 557c85df50
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Changes to twig behavior on loading files in 3.3.9

by pg143 » Fri Dec 09, 2022 4:18 pm

This works. Thank you for your super fast fix!
pg143
Registered User
Posts: 8
Joined: Sun Nov 10, 2019 6:12 pm

Re: Changes to twig behavior on loading files in 3.3.9

by fiftyfournine » Sun Jan 01, 2023 11:22 am

Hello, firstly best wishes to all for the new year and a thank you for the digest extension which has really transformed the effectiveness of my forum among my non-tech-savvy members.

I moved and then upgraded my previous phpBB installation which was running phpBB v3.2 on Debian 8 to new hardware. It is now configured as:
  • Debian Bookworm sid
  • phpBB v3.3.9
  • digest v3.3.17
  • PHP v8.1.12
I’ve largely had an error free transition. I’ve resolved the ‘twig loading’ error by applying:

https://github.com/MarkDHamill/digests/ ... 557c85df50

Everything appears to be working and a full daily digests have been delivered to all users. However I’m receiving the following warnings by email from the cron daemon just prior to digest emails being sent. As far as I can tell I did not receive these warnings prior to applying the above fix.

Subject: Cron <root@debian-hp> cd "/var/www/repton_court_forum"; php ./bin/phpbbcli.php cron:run
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "style_id" in /var/www/repton_court_forum/phpbb/textformatter/s9e/renderer.php on line 181
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770
PHP Warning: Undefined array key "user_options" in /var/www/repton_court_forum/phpbb/user.php on line 770


I notice that for each batch of digests sent, the first 6 lines seem to be common, and then there are 2 lines for each email sent. So the above represents two emails.

Doesn't seem to be causing any problems although would prefer not to have these warnings. Is this related to the code fix above?
fiftyfournine
Registered User
Posts: 1
Joined: Sat Dec 31, 2022 11:50 am

Re: Changes to twig behavior on loading files in 3.3.9

by MarkDHamill » Sun Jan 01, 2023 1:22 pm

It shouldn't be related. I changed one template file to accommodate phpBB 3.3.9.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: Changes to twig behavior on loading files in 3.3.9

by roo4less1 » Wed Apr 26, 2023 7:38 pm

If there is a solution for 3.3.10 because the directory structure is different to previous versions of the board.
in 3.3.10 /styles/all/template - that's as far as the directory structure goes
earlier versions : styles/all/template/event/overall_header_head_append.html - actually does exist

Is there a solution to Mark Hamill GitHub edits https://github.com/MarkDHamill/digests/ ... 8e8be901fe

The very last edit
roo4less1
Registered User
Posts: 30
Joined: Mon Feb 28, 2022 9:32 pm

Re: Changes to twig behavior on loading files in 3.3.9

by MarkDHamill » Wed Apr 26, 2023 8:59 pm

Correct. With phpBB 3.3.9 apparently using relative paths in %INCLUDECSS statements no longer works, or this was a bug that got fixed. A number of extensions were affected, including digests.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA