invalid cookie lang=de-DE #2205

Closed
opened 2026-10-05 01:09:41 +02:00 by adam · 4 comments
Owner

Browser language de-DE will be stored in Cookie lang. On login this value is invalid, an error message appears. After deleting this single cookie, login is working.

Here is the error message (German):
Piwigo ist auf einen nicht behebbaren Fehler gestoßen.
[Hacking attempt] the input parameter "de-DE" is not valid

1 log_user /var/www/html/piwigo/include/functions_user.inc.php(1330)
2 pwg_login /var/www/html/piwigo/include/functions_plugins.inc.php(214)
3 trigger_change /var/www/html/piwigo/include/functions_user.inc.php(1238)
4 try_log_user /var/www/html/piwigo/identification.php(65)

Browser language de-DE will be stored in Cookie lang. On login this value is invalid, an error message appears. After deleting this single cookie, login is working. Here is the error message (German): Piwigo ist auf einen nicht behebbaren Fehler gestoßen. [Hacking attempt] the input parameter "de-DE" is not valid 1 log_user /var/www/html/piwigo/include/functions_user.inc.php(1330) 2 pwg_login /var/www/html/piwigo/include/functions_plugins.inc.php(214) 3 trigger_change /var/www/html/piwigo/include/functions_user.inc.php(1238) 4 try_log_user /var/www/html/piwigo/identification.php(65) <!-- github-sync-id:4088324797 -->
adam closed this issue 2026-10-05 01:09:41 +02:00
Author
Owner

During install, I also get this:

Image

ie invalid "en_US" while "en_GB" is requested in the URL

During install, I also get this: <img width="619" height="209" alt="Image" src="https://github.com/user-attachments/assets/31076038-b94a-44f7-9de6-061ac9823a87" /> ie invalid "en_US" while "en_GB" is requested in the URL <!-- github-comment-id:4366169290 -->
Author
Owner

I have added a code line to debug this at the beginning of install.php:

echo '<pre>'; print_r($_COOKIE); echo '</pre>';

and I get :

Array
(
    [pwg_id] => 1bb6g9387f6hoolt0c8kmetn2f
    [phavsz] => 2172x1478x2
    [caps] => 2x1512x860
    [ld_user] => 02154421f55f5d6fb8c7150338cc042e
    [mode] => light
    [lang] => en_US
)

I have no idea where this lang comes from. I don't have any idea where other variables come from. Certainly not from this fresh not-yet-installed instance of Piwigo. We need to be less "punitive" in function log_user I think.

I have added a code line to debug this at the beginning of `install.php`: ``` echo '<pre>'; print_r($_COOKIE); echo '</pre>'; ``` and I get : ``` Array ( [pwg_id] => 1bb6g9387f6hoolt0c8kmetn2f [phavsz] => 2172x1478x2 [caps] => 2x1512x860 [ld_user] => 02154421f55f5d6fb8c7150338cc042e [mode] => light [lang] => en_US ) ``` I have no idea where this `lang` comes from. I don't have any idea where other variables come from. Certainly not from this fresh not-yet-installed instance of Piwigo. We need to be less "punitive" in function `log_user` I think. <!-- github-comment-id:4366229170 -->
Author
Owner

@HWFord I made a quick fix for Piwigo version 16.4.0 but we need to rethink a bit this management of $_COOKIE['lang']. We should use Piwigo cookie function pwg_get_cookie_var and pwg_set_cookie_var, to avoid mixing with other installs of Piwigo (or other web applications using the same cookie names) of the same host.

@HWFord I made a quick fix for Piwigo version 16.4.0 but we need to rethink a bit this management of `$_COOKIE['lang']`. We should use Piwigo cookie function `pwg_get_cookie_var` and `pwg_set_cookie_var`, to avoid mixing with other installs of Piwigo (or other web applications using the same cookie names) of the same host. <!-- github-comment-id:4366256859 -->
Author
Owner
See https://github.com/Piwigo/Piwigo/commit/f12323d1c9e6bff8f03d859758334115eb6d53c4 <!-- github-comment-id:4385763382 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2205