php8.1 issue when accessing home - Alpine containerized VM - Root cause: REMOTE_ADDR = '/srv/mp/socket' #1672

Open
opened 2026-10-05 00:52:26 +02:00 by adam · 0 comments
Owner

After upgrading to last version on an Alpine containerized VM (Piwigo 13.7 & PHP 8.1), the home access crash with:

Fatal error: Uncaught ValueError: The arguments array must contain 2 items, 1 given in /var/www/include/functions_session.inc.php:114 Stack trace: #0 /var/www/include/functions_session.inc.php(114): vsprintf() #1 /var/www/include/functions_session.inc.php(131): get_remote_addr_session_hash() #2 [internal function]: pwg_session_read() #3 /var/www/include/common.inc.php(150): session_start() #4 /var/www/index.php(11): include_once('...') #5 {main} thrown in /var/www/include/functions_session.inc.php on line 114

https://github.com/Piwigo/Piwigo/blob/bb023d09ad1e8b73a7a95038b11c31f11c08f732/include/functions_session.inc.php#L109-L116

In this case $_SERVER['REMOTE_ADDR'] give /srv/mp/socket and not the end-user IP.

Seems related to PHP 8.1 and current OS environment, but small fix to robustify test:

if (strpos($_SERVER['REMOTE_ADDR'],':')===false && strpos($_SERVER['REMOTE_ADDR'],'.')) 

Full environment details:

[Piwigo](https://fr.piwigo.org/) 13.7.0
Système d'exploitation: Linux
PHP: 8.1.19
MySQL: 10.6.13-MariaDB [2023-05-15 12:34:10]
Bibliothèque graphique: ImageMagick 7.1.0-62
After upgrading to last version on an Alpine containerized VM (Piwigo 13.7 & PHP 8.1), the home access crash with: ``` Fatal error: Uncaught ValueError: The arguments array must contain 2 items, 1 given in /var/www/include/functions_session.inc.php:114 Stack trace: #0 /var/www/include/functions_session.inc.php(114): vsprintf() #1 /var/www/include/functions_session.inc.php(131): get_remote_addr_session_hash() #2 [internal function]: pwg_session_read() #3 /var/www/include/common.inc.php(150): session_start() #4 /var/www/index.php(11): include_once('...') #5 {main} thrown in /var/www/include/functions_session.inc.php on line 114 ``` https://github.com/Piwigo/Piwigo/blob/bb023d09ad1e8b73a7a95038b11c31f11c08f732/include/functions_session.inc.php#L109-L116 In this case `$_SERVER['REMOTE_ADDR']` give `/srv/mp/socket` and not the end-user IP. Seems related to PHP 8.1 and current OS environment, but small fix to robustify test: ``` if (strpos($_SERVER['REMOTE_ADDR'],':')===false && strpos($_SERVER['REMOTE_ADDR'],'.')) ``` ---- Full environment details: ``` [Piwigo](https://fr.piwigo.org/) 13.7.0 Système d'exploitation: Linux PHP: 8.1.19 MySQL: 10.6.13-MariaDB [2023-05-15 12:34:10] Bibliothèque graphique: ImageMagick 7.1.0-62 ``` <!-- github-sync-id:1709810243 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1672