Album creation / renaming failed if containing apostrophe with PHP 8.1 #1488

Closed
opened 2026-10-05 00:45:50 +02:00 by adam · 1 comment
Owner

HI,

I have a Piwigo installed on my server for many years now, and it works like a charm, I love this soft, thanks for all the hard work ! ❤️

I open this issue to report a new error that I did not have when using Piwigo on PHP 7.x, and seems to have appeared when updating to PHP 8.1: when creating or renaming an album, if the name contains an apostrophe, I get the following error (when trying for example to create an album "vacances d'été 2022"):

Fatal error: Uncaught mysqli\_sql\_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'été 2022', `comment` = NULL, `commentable` = 'true' WHERE `id` = ...' at line 3 in /photos/piwigo/include/dblayer/functions\_mysqli.inc.php:132 Stack trace: #0 //piwigo/include/dblayer/functions\_mysqli.inc.php(132): mysqli->query() #1 /photos/piwigo/include/dblayer/functions\_mysqli.inc.php(478): pwg\_query() #2 /photos/piwigo/admin/cat\_modify.php(118): single\_update() #3 /photos/piwigo/admin/album.php(60): include('...') #4 //photos/piwigo/admin.php(320): include('...') #5 {main} thrown in /photos/piwigo/include/dblayer/functions\_mysqli.inc.php on line 132

As I am French, I have many existing albums with apostrophe, and there was no issue in the past. So I guess this is an issue with PHP 8 ? Note that when using Vacances d\'été 2022 for example, escaping the apostrophe with a \ the issue does not occur.

I am afraid this might also be a security issue, if the content of the SQL requests are not parsed to make sure unwanted characters are not interpreted ?

Thanks for your time !

HI, I have a Piwigo installed on my server for many years now, and it works like a charm, I love this soft, thanks for all the hard work ! :heart: I open this issue to report a new error that I did not have when using Piwigo on PHP 7.x, and seems to have appeared when updating to PHP 8.1: when creating or renaming an album, if the name contains an apostrophe, I get the following error (when trying for example to create an album "vacances d'été 2022"): `` Fatal error: Uncaught mysqli\_sql\_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'été 2022', `comment` = NULL, `commentable` = 'true' WHERE `id` = ...' at line 3 in /photos/piwigo/include/dblayer/functions\_mysqli.inc.php:132 Stack trace: #0 //piwigo/include/dblayer/functions\_mysqli.inc.php(132): mysqli->query() #1 /photos/piwigo/include/dblayer/functions\_mysqli.inc.php(478): pwg\_query() #2 /photos/piwigo/admin/cat\_modify.php(118): single\_update() #3 /photos/piwigo/admin/album.php(60): include('...') #4 //photos/piwigo/admin.php(320): include('...') #5 {main} thrown in /photos/piwigo/include/dblayer/functions\_mysqli.inc.php on line 132 `` As I am French, I have many existing albums with apostrophe, and there was no issue in the past. So I guess this is an issue with PHP 8 ? Note that when using `Vacances d\'été 2022` for example, escaping the apostrophe with a `\` the issue does not occur. I am afraid this might also be a security issue, if the content of the SQL requests are not parsed to make sure unwanted characters are not interpreted ? Thanks for your time ! <!-- github-sync-id:1326079738 -->
adam closed this issue 2026-10-05 00:45:50 +02:00
Author
Owner

Problem also occurs when you rename an album

Problem also occurs when you rename an album <!-- github-comment-id:1257864876 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1488