PHP 7.1 and template.class.php incompatability #550

Closed
opened 2026-10-05 00:03:23 +02:00 by adam · 7 comments
Owner

Hi
I tried to enable PHP 7.1 today and run into problem in template.class.php
you would see something like

Warning: A non-numeric value encountered in .../include/template.class.php on line 1791

This version of PHP is more strict with left/right values math expressions.
Ex: '' + 0 would cause warning above

Fix is quite trivial and seems to work in my hotpatch

$ret = intval($s1->load_mode) - intval($s2->load_mode);

Piwigo version: 2.8.4
PHP version: 7.1
MySQL version: 5.6

Hi I tried to enable PHP 7.1 today and run into problem in template.class.php you would see something like Warning: A non-numeric value encountered in .../include/template.class.php on line 1791 This version of PHP is more strict with left/right values math expressions. Ex: '' + 0 would cause warning above Fix is quite trivial and seems to work in my hotpatch ``` $ret = intval($s1->load_mode) - intval($s2->load_mode); ``` Piwigo version: 2.8.4 PHP version: 7.1 MySQL version: 5.6 <!-- github-sync-id:198173245 -->
adam closed this issue 2026-10-05 00:03:23 +02:00
Author
Owner

@SergeD is it still an issue with latest PHP 7.1 version ? (7.1.5 was released on May 11th 2017)

@SergeD is it still an issue with latest PHP 7.1 version ? (7.1.5 was released on May 11th 2017) <!-- github-comment-id:303459860 -->
Author
Owner

Hi

I did install latest release without making further changes to the code to fix it

So it appears to be working

From: Pierrick Le Gall [mailto:notifications@github.com]
Sent: Tuesday, May 23, 2017 9:36 AM
To: Piwigo/Piwigo Piwigo@noreply.github.com
Cc: SergeD webmaster@dragonsoft.us; Mention mention@noreply.github.com
Subject: Re: [Piwigo/Piwigo] PHP 7.1 and template.class.php incompatability (#596)

@SergeD https://github.com/serged is it still an issue with latest PHP 7.1 version ? (7.1.5 was released on May 11th 2017)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Piwigo/Piwigo/issues/596#issuecomment-303459860 , or mute the thread https://github.com/notifications/unsubscribe-auth/AAGmI9KmBnlK0XjFCPgSQdRkZGHWwzwlks5r8wrqgaJpZM4LYTCT . https://github.com/notifications/beacon/AAGmI3l5gLtI2qpRO8KqEqLKIi61BpJlks5r8wrqgaJpZM4LYTCT.gif

Hi I did install latest release without making further changes to the code to fix it So it appears to be working From: Pierrick Le Gall [mailto:notifications@github.com] Sent: Tuesday, May 23, 2017 9:36 AM To: Piwigo/Piwigo <Piwigo@noreply.github.com> Cc: SergeD <webmaster@dragonsoft.us>; Mention <mention@noreply.github.com> Subject: Re: [Piwigo/Piwigo] PHP 7.1 and template.class.php incompatability (#596) @SergeD <https://github.com/serged> is it still an issue with latest PHP 7.1 version ? (7.1.5 was released on May 11th 2017) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/Piwigo/Piwigo/issues/596#issuecomment-303459860> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AAGmI9KmBnlK0XjFCPgSQdRkZGHWwzwlks5r8wrqgaJpZM4LYTCT> . <https://github.com/notifications/beacon/AAGmI3l5gLtI2qpRO8KqEqLKIi61BpJlks5r8wrqgaJpZM4LYTCT.gif> <!-- github-comment-id:303579116 -->
Author
Owner

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

Great :-) let's close this issue then! <!-- github-comment-id:303640861 -->
Author
Owner

Piwigo 2.9.1
Operating system: Linux
PHP: 7.1.4 (Show info) [2017-06-28 00:16:50]
MySQL: 5.5.56-MariaDB [2017-06-28 02:16:50]
Graphics Library: GD bundled (2.1.0 compatible)

I encountered this same issue and had to make the change SergeD did by changing line 1791 from
$ret = $s1->load_mode - $s2->load_mode;
to

$ret = intval($s1->load_mode) - intval($s2->load_mode);
Which fixes the issue but using the latest version should also fix it right?

> Piwigo 2.9.1 > Operating system: Linux > PHP: 7.1.4 (Show info) [2017-06-28 00:16:50] > MySQL: 5.5.56-MariaDB [2017-06-28 02:16:50] > Graphics Library: GD bundled (2.1.0 compatible) I encountered this same issue and had to make the change SergeD did by changing line 1791 from ` $ret = $s1->load_mode - $s2->load_mode;` to ` $ret = intval($s1->load_mode) - intval($s2->load_mode);` Which fixes the issue but using the latest version should also fix it right? <!-- github-comment-id:311521361 -->
Author
Owner
Piwigo 2.9.1
Operating system: Linux
PHP: 7.1.7 (Show info) [2017-07-07 21:26:42]
MySQL: 5.5.5-10.2.6-MariaDB [2017-07-07 21:26:42]
Graphics Library: GD 2.2.4

Run in the same issue after upgrade to Piwigo 2.9.1 and solved with the change SergeD did by changing line 1791.

Thanks for the recipe!

Piwigo 2.9.1 Operating system: Linux PHP: 7.1.7 (Show info) [2017-07-07 21:26:42] MySQL: 5.5.5-10.2.6-MariaDB [2017-07-07 21:26:42] Graphics Library: GD 2.2.4 Run in the same issue after upgrade to Piwigo 2.9.1 and solved with the change SergeD did by changing line 1791. Thanks for the recipe! <!-- github-comment-id:313773270 -->
Author
Owner

Hi,
this issue should be reopened and the patch merged as the problem is still present (as I discovered it while migrating from php 7.0 to 7.1)

Piwigo 2.9.2
PHP: 7.1.13-1
Hi, this issue should be reopened and the patch merged as the problem is still present (as I discovered it while migrating from php 7.0 to 7.1) ``` Piwigo 2.9.2 PHP: 7.1.13-1 ``` <!-- github-comment-id:364653508 -->
Author
Owner

And still present in piwigo 2.9.3

And still present in piwigo 2.9.3 <!-- github-comment-id:368629072 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#550