Mobile album photo view in 13.1.0 not working anymore due to syntax error in footer.tpl in smartpocket theme (with PHP 7.x) #1544

Closed
opened 2026-10-05 00:47:46 +02:00 by adam · 14 comments
Owner

Hello,

i updated to 13.1.0 recently, but the photo view inside an album is not working anymore. Thrown error in GUI:

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "file:/var/www/vhosts/xxxx/xxxx/themes/smartpocket/template/footer.tpl" on line 20 "document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';" - Unexpected " ? ", expected one of: "}" <-- thrown in /var/www/vhosts/xxxx/xxxxx/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 20

Standard view works fine. Albums are still listed on mobile, but when opening an album, no photos are shown and the error is listed at the bottom of the page

Hello, i updated to 13.1.0 recently, but the photo view inside an album is not working anymore. Thrown error in GUI: ` Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "file:/var/www/vhosts/xxxx/xxxx/themes/smartpocket/template/footer.tpl" on line 20 "document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';" - Unexpected " ? ", expected one of: "}" <-- thrown in /var/www/vhosts/xxxx/xxxxx/include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 20 ` Standard view works fine. Albums are still listed on mobile, but when opening an album, no photos are shown and the error is listed at the bottom of the page <!-- github-sync-id:1419717485 -->
adam closed this issue 2026-10-05 00:47:46 +02:00
Author
Owner

Uploading 52F3062F-BD2E-4886-859F-4FC48147AE96.jpeg…

![Uploading 52F3062F-BD2E-4886-859F-4FC48147AE96.jpeg…]() <!-- github-comment-id:1288062973 -->
Author
Owner

64F451EB-BE05-4A7D-BCE0-816CB0053CEF
5A33AFF6-8305-423A-91E9-2A4963AC13CA
44C02F11-30D4-47DE-A034-A39ED6C7F762

![64F451EB-BE05-4A7D-BCE0-816CB0053CEF](https://user-images.githubusercontent.com/2866102/197384497-88fb949e-4664-46c4-ad65-0e4aafebf9ec.jpeg) ![5A33AFF6-8305-423A-91E9-2A4963AC13CA](https://user-images.githubusercontent.com/2866102/197384502-e7ac83a1-62c8-4f6b-8433-8708548c720a.jpeg) ![44C02F11-30D4-47DE-A034-A39ED6C7F762](https://user-images.githubusercontent.com/2866102/197384540-1f64fb15-d1ae-4a11-bac9-a7cd7bdea889.jpeg) <!-- github-comment-id:1288063119 -->
Author
Owner

I checked the footer template in
themes/smartpocket/template/footer.tpl
I changed the line 20 from:
document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';
to
document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={$COOKIE_PATH}';

So I reverted this commit https://github.com/Piwigo/piwigo-smartpocket/commit/1e948e4a12ad1c01dcf4292bd1f0b8cb299f9f81 . The template error is gone and all photos are showing properly.
Unfortunately I dont know how the syntax should be in a corrected way, so I cannot fix it and commit :-(...

I checked the footer template in themes/smartpocket/template/footer.tpl I changed the line 20 from: `document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';` to `document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={$COOKIE_PATH}';` So I reverted this commit https://github.com/Piwigo/piwigo-smartpocket/commit/1e948e4a12ad1c01dcf4292bd1f0b8cb299f9f81 . The template error is gone and all photos are showing properly. Unfortunately I dont know how the syntax should be in a corrected way, so I cannot fix it and commit :-(... <!-- github-comment-id:1288151049 -->
Author
Owner

I tried this syntax:
document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={$COOKIE_PATH|default:''}';
Not sure if correct, if confirmed to be working for others, this would be a solution...

I tried this syntax: `document.cookie = 'screen_size='+jQuery(document).width()+'x'+jQuery(document).height()+';path={$COOKIE_PATH|default:''}';` Not sure if correct, if confirmed to be working for others, this would be a solution... <!-- github-comment-id:1288154812 -->
Author
Owner

This part
+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';
of course is wrong for the levels of single quotes forming string literals to assemble.
I'd guess it should instead be

+';path='{isset($COOKIE_PATH) ? $COOKIE_PATH : ''};

See also https://piwigo.org/forum/viewtopic.php?id=32263

This part `+';path={isset($COOKIE_PATH) ? $COOKIE_PATH : ''}';` of course is wrong for the levels of single quotes forming string literals to assemble. I'd guess it should instead be ``` +';path='{isset($COOKIE_PATH) ? $COOKIE_PATH : ''}; ``` See also https://piwigo.org/forum/viewtopic.php?id=32263 <!-- github-comment-id:1288206027 -->
Author
Owner
Tested my patch (https://github.com/Piwigo/Piwigo/issues/1766#issuecomment-1288154812) also on PHP 8 - works so far. I created a PR https://github.com/Piwigo/piwigo-smartpocket/pull/8 <!-- github-comment-id:1290089377 -->
Author
Owner

Any work around in the meantime?

Any work around in the meantime? <!-- github-comment-id:1295331758 -->
Author
Owner

Sure, try the patch of the pull request mentioned and give feedback whether it works for you. Or try the change of my previous comment. One of them should work. Or replace that line with the old code as mentioned above in https://github.com/Piwigo/Piwigo/issues/1766#issuecomment-1288151049 .

Sure, try the patch of the pull request mentioned and give feedback whether it works for you. Or try the change of my previous comment. One of them should work. Or replace that line with the old code as mentioned above in https://github.com/Piwigo/Piwigo/issues/1766#issuecomment-1288151049 . <!-- github-comment-id:1295762082 -->
Author
Owner

The patch of the pull request works for me and my PHP 7.4.32.

The patch of the pull request works for me and my PHP 7.4.32. <!-- github-comment-id:1295930253 -->
Author
Owner

+';path={$COOKIE_PATH|default:''}';

I'm not convinced of that approach, see my comment at the patch https://github.com/Piwigo/piwigo-smartpocket/pull/8#discussion_r1008836712 .

> `+';path={$COOKIE_PATH|default:''}';` I'm not convinced of that approach, see my comment at the patch https://github.com/Piwigo/piwigo-smartpocket/pull/8#discussion_r1008836712 . <!-- github-comment-id:1296225870 -->
Author
Owner

@erAck @bigcookie have you tested the commit pushed by @MatthieuLP ? https://github.com/Piwigo/piwigo-smartpocket/commit/738dcde354d73fad6b08442dcebdc9b5e8fbc002

@erAck @bigcookie have you tested the commit pushed by @MatthieuLP ? https://github.com/Piwigo/piwigo-smartpocket/commit/738dcde354d73fad6b08442dcebdc9b5e8fbc002 <!-- github-comment-id:1296252315 -->
Author
Owner

@plegall @MatthieuLP yes that works, thanks!

@plegall @MatthieuLP yes that works, thanks! <!-- github-comment-id:1296279347 -->
Author
Owner

I don't have a phone with this problem but my friend says the site is now working for her.

I don't have a phone with this problem but my friend says the site is now working for her. <!-- github-comment-id:1296298151 -->
Author
Owner

@plegall the patch from @MatthieuLP works for me.
I agree, that I didnt understand to replace a missing string with an empty one. I just tried to fix the syntax error. The new patch looks better to me.
I will cancel my PR.

@plegall the patch from @MatthieuLP works for me. I agree, that I didnt understand to replace a missing string with an empty one. I just tried to fix the syntax error. The new patch looks better to me. I will cancel my PR. <!-- github-comment-id:1296362828 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1544