Hmmmm .... did upgrade Piwigo to PHP8 and encounter another problem.
It I use the ' character (like in don't do this) in description field I get this:
have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't do this',
`date_creation` = '2022-02-21 00:00:00'
...
00:00:00'
WHERE `id` = '7603' in /var/www/localhost/include/dblayer/functions_mysqli.inc.php on line 847
PS ... I already have this in my Local conf:
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_.()!]+$/';
Piwigo 12.2.0
Operating system: Linux
PHP: 8.0.8 (Show info) [2022-03-14 12:16:57]
MySQL: 8.0.28-0ubuntu0.21.10.3 [2022-03-14 12:16:57]
Graphics Library: External ImageMagick 6.9.11-60
Last edited by matthys (2022-03-14 12:21:01)
Offline
If I do not edit other field accept the Description with "don't do this", I get:
Warning: [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't do this',
`date_creation` = NULL
WHERE `id` = '7604'' at line 6
UPDATE `piwigo_images`
SET `id` = '7604',
`name` = 'DE-11543281 front',
`author` = NULL,
`level` = '0',
`comment` = 'don't do this',
`date_creation` = NULL
WHERE `id` = '7604' in /var/www/localhost/include/dblayer/functions_mysqli.inc.php on line 847
PS .. not sure why, before I used PHP 7.4 also with MySQL 8 and worked fine.
Last edited by matthys (2022-03-14 12:44:00)
Offline
sync_chars_regex is unrelated, that's only for directory and file names encountered during physical/ftp sync (and anyway doesn't work with an ' apostrophe).
Tripping over an ' apostrophe in description field's content context is yet another badly escaped SQL query bug. However that could work with PHP 7.4 but not with PHP 8 I don't know.
Offline
I've just upgraded to PHP8.0 and I am seeing this same problem when I put an apostrophe in the comment field. I don't remember seeing with with 7.4, but maybe I didn't use any apostrophes.
I get the error message when I submit a change using Batch Manager, single mode. if I make the change from the Edit Photo page, the same problem occurs but no error message is visible.
Environment
Piwigo 13.1.0 Check for upgrade
Installed on 15 August 2019, 3 years 2 months 1 week 1 day ago
Operating system: Linux
PHP: 8.0.24 (Show info) [2022-10-24 18:47:10]
MySQL: 5.7.38-log [2022-10-24 18:47:10]
Graphics Library: External ImageMagick 6.9.10-23
Cache size 7665.84 MB calculated right now Refresh
Activated plugin list 4
LocalFiles Editor
Meta Open Graph
SmartAlbums
Take A Tour of Your Piwigo
Offline
See this thread for how to fix (need to edit some core files).
https://piwigo.org/forum/viewtopic.php?id=31560
Offline
Thanks for that update. I already noticed and updated the code manually as I'm not yet on the 13 version.
Sorry I didn't update this topic. Solutions works fine :-)
Offline
Thank you 'windracer' for the useful reply, all now works OK. I did a search before my posting but didn't find that link.
As has been said on that other thread, it does seem strange that there are no standard text handling routines for this sort of thing.
Offline