Announcement

#1 2022-03-14 12:18:27

matthys
Member
2014-04-02
188

Invalid charater after moving to PHP8?

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:

Code:

$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

 

#2 2022-03-14 12:41:07

matthys
Member
2014-04-02
188

Re: Invalid charater after moving to PHP8?

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

 

#3 2022-03-15 17:38:32

erAck
Only trying to help
2015-09-06
2035

Re: Invalid charater after moving to PHP8?

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.


Running Piwigo at https://erack.net/gallery/

Offline

 

#4 2022-10-24 18:57:26

pjsteane
Member
2021-02-09
5

Re: Invalid charater after moving to PHP8?

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

 

#5 2022-10-24 23:02:19

windracer
Member
St. Pete, FL
2014-12-28
458

Re: Invalid charater after moving to PHP8?

See this thread for how to fix (need to edit some core files).

https://piwigo.org/forum/viewtopic.php?id=31560

Offline

 

#6 2022-10-25 09:15:56

matthys
Member
2014-04-02
188

Re: Invalid charater after moving to PHP8?

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

 

#7 2022-10-25 09:25:53

pjsteane
Member
2021-02-09
5

Re: Invalid charater after moving to PHP8?

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

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact