session_start with php 7.1 #562

Closed
opened 2026-10-05 00:04:32 +02:00 by adam · 9 comments
Owner

there is an error about read data for start_session () with php 7.1

"Warning: session_start(): Failed to read session data: user (path: ) in /usr/share/webapps/piwigo/include/common.inc.php on line 149"

So session does not start, and you can't login.

To resolve this, I have add in the file :
piwigo/include/functions_session.inc.php, function pwg_session_read($session_id), the following to check if the data is null :

if ($result)
{
$row = pwg_db_fetch_assoc($result);

if (is_null($row['data'])) {
return '';
}
return $row['data'];
}

else
{
return '';
}

I am not sure it is the best test to do, but it work well

there is an error about read data for start_session () with php 7.1 "Warning: session_start(): Failed to read session data: user (path: ) in /usr/share/webapps/piwigo/include/common.inc.php on line 149" So session does not start, and you can't login. To resolve this, I have add in the file : piwigo/include/functions_session.inc.php, function pwg_session_read($session_id), the following to check if the data is null : if ($result) { $row = pwg_db_fetch_assoc($result); if (is_null($row['data'])) { return ''; } return $row['data']; } else { return ''; } I am not sure it is the best test to do, but it work well <!-- github-sync-id:203953157 -->
adam closed this issue 2026-10-05 00:04:32 +02:00
Author
Owner

Hello
version of php/piwigo/server etc please ?
Thank you

Hello version of php/piwigo/server etc please ? Thank you <!-- github-comment-id:276033538 -->
Author
Owner

PHP :
PHP 7.1.1 (cli) (built: Jan 18 2017 18:44:22) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.1, Copyright (c) 1999-2017, by Zend Technologies

Web Server:
Server version: Apache/2.4.25 (Unix) Server built: Dec 20 2016 13:02:22

Host:
Linux 3.14.32-xxxx-grs-ipv6-64 #7 SMP Wed Jan 27 18:05:09 CET 2016 x86_64 GNU/Linux

I think it is due to PHP 7.1 as it return null value when there is no result from sql queries.
It look like it is a common issue for all webapp who use database to store session.

http://www.php.net/ChangeLog-7.php#7.1.0

Version 7.1.0
01 Dec 2016
Core:
Added nullable types.
....

PHP : ` PHP 7.1.1 (cli) (built: Jan 18 2017 18:44:22) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.1, Copyright (c) 1999-2017, by Zend Technologies ` Web Server: ` Server version: Apache/2.4.25 (Unix) Server built: Dec 20 2016 13:02:22 ` Host: ` Linux 3.14.32-xxxx-grs-ipv6-64 #7 SMP Wed Jan 27 18:05:09 CET 2016 x86_64 GNU/Linux ` I think it is due to PHP 7.1 as it return null value when there is no result from sql queries. It look like it is a common issue for all webapp who use database to store session. http://www.php.net/ChangeLog-7.php#7.1.0 > Version 7.1.0 > 01 Dec 2016 > Core: > Added nullable types. > .... <!-- github-comment-id:276060368 -->
Author
Owner

And it is for piwigo 2.8.5

And it is for piwigo 2.8.5 <!-- github-comment-id:276061326 -->
Author
Owner

try 2.8.6

try 2.8.6 <!-- github-comment-id:276061556 -->
Author
Owner

same with 2.8.6

same with 2.8.6 <!-- github-comment-id:276062455 -->
Author
Owner

ok Thx!

ok Thx! <!-- github-comment-id:276062546 -->
Author
Owner

@FanchTheSystem is it still a problem with PHP 7.1.5 ?

@FanchTheSystem is it still a problem with PHP 7.1.5 ? <!-- github-comment-id:303456140 -->
Author
Owner

Yes it work well with php 7.1.5 and piwigo 2.9.0

Thank you!

Yes it work well with php 7.1.5 and piwigo 2.9.0 Thank you! <!-- github-comment-id:303625773 -->
Author
Owner

Great :-) let's close this issue then!

Great :-) let's close this issue then! <!-- github-comment-id:303640755 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#562