Announcement

#1 2024-01-22 11:17:25

John R
Member
2023-04-17
25

Piwigo 14.1.0 and PHP 8.3 blows up

Hello/Hi/Greetings, I'm seeing the following error when trying to upload images with the IOS app and wondering if my PHP version is causing an issue, can someone please advise on the current level of PHP known working with Piwigo 14.1.0?

Thanks in advance for any guidance.

[Mon Jan 22 03:03:52.475558 2024] [php:error] [pid 29554] [client 10.0.0.35:54961] PHP Fatal error:  Uncaught mysqli_sql_exception: Incorrect datetime value: '2023-04-30 2:38:36\xe2\x80\xafpm' for column `piwigo`.`piwigo_images`.`date_creation` at row 1 in /usr/local/www/piwigo/include/dblayer/functions_mysqli.inc.php:132\nStack trace:\n#0 /usr/local/www/piwigo/include/dblayer/functions_mysqli.inc.php(132): mysqli->query('\\nUPDATE `piwigo...')\n#1 /usr/local/www/piwigo/include/dblayer/functions_mysqli.inc.php(478): pwg_query('\\nUPDATE `piwigo...')\n#2 /usr/local/www/piwigo/include/ws_functions/pwg.images.php(1891): single_update('piwigo_images', Array, Array)\n#3 /usr/local/www/piwigo/include/ws_core.inc.php(600): ws_images_uploadAsync(Array, Object(PwgServer))\n#4 /usr/local/www/piwigo/include/ws_protocols/rest_handler.php(41): PwgServer->invoke('pwg.images.uplo...', Array)\n#5 /usr/local/www/piwigo/include/ws_core.inc.php(281): PwgRestRequestHandler->handleRequest(Object(PwgServer))\n#6 /usr/local/www/piwigo/ws.php(22): PwgServer->run()\n#7 {main}\n  thrown in /usr/local/www/piwigo/include/dblayer/functions_mysqli.inc.php on line 132



    Piwigo 14.1.0
    Installed on 16 March 2023, 10 months 6 days ago
    Operating system: FreeBSD
    PHP: 8.3.2  [2024-01-22 10:00:31]
    MySQL: 10.11.6-MariaDB [2024-01-22 10:00:31]
    Graphics Library: ImageMagick 7.1.1-26
    Cache size 900.53 Mo   calculated 1 month ago

Offline

 

#2 2024-01-22 12:49:17

homdax
Member
Sweden
2015-02-02
294

Re: Piwigo 14.1.0 and PHP 8.3 blows up

According to the release notes Piwigo 14.1.0 is only compatible with PHP up to 8.2.

https://piwigo.org/release-14.0.0

Last edited by homdax (2024-01-22 12:49:31)

Offline

 

#3 2024-01-22 12:58:38

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Good to know, thanks, I'll go compile 8.2 and give that a whirl and post back after.

Offline

 

#4 2024-01-22 13:29:41

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Unfortunately PHP 8.2 is still throwing up the same error relating to Incorrect datetime value.

Last edited by John R (2024-01-22 13:30:13)

Offline

 

#5 2024-01-22 13:53:28

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13793

Re: Piwigo 14.1.0 and PHP 8.3 blows up

It doesn't look like a PHP error.

Willy works with PHP 8.3 and didn't report any specific issue for now.

There are unexpected characters in the date_creation.

Does it happen with all photos?

Offline

 

#6 2024-01-22 13:56:13

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

I've tried with a few from whatsapp and from my own photos I've taken with my phone, same error each time.

Offline

 

#7 2024-01-22 14:02:26

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

I've moved it back to PHP 8.3 to  stay true to the original post.

Offline

 

#8 2024-01-22 14:30:11

erAck
Only trying to help
2015-09-06
2043

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Take the "Incorrect datetime value" literally, the string (unhexed)
2023-04-30 2:38:36â ¯pm
(and with 0x80 padding character instead of the space in "â ¯") certainly is a bad DateTime value. If that happens on all photos taken with your phone then likely your phone's camera app writes bad values to the EXIF field and you need to preprocess them to clean before uploading to Piwigo. (and Piwigo maybe could check validity). You'll also have to sanitize data in the piwigo_images table's date_creation column.


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

Offline

 

#9 2024-01-22 14:53:27

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Sounds good in theory, but exporting all the photo's as-is, and importing via the admin interface works with no issues, so I think it's an issue with the IOS app. So to my mind, it's not a badly formed exif thing, more the way the app is interpreting it.

Last edited by John R (2024-01-22 14:56:30)

Offline

 

#10 2024-01-22 21:24:31

cryopad
Piwigo Team
Grenoble, France
2015-11-01
192

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Hi John,

First time I hear about an issue like this.

The creation date is encoded in UTF-8 on the iOS app when uploading photos.
Which MySQL and HTTP encodings do you use on your server?

Cheers,
Eddy


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 

#11 2024-01-22 21:30:14

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=

Offline

 

#12 2024-01-23 02:00:00

erAck
Only trying to help
2015-09-06
2043

Re: Piwigo 14.1.0 and PHP 8.3 blows up

cryopad wrote:

The creation date is encoded in UTF-8 on the iOS app when uploading photos.
Which MySQL and HTTP encodings do you use on your server?

That may indeed hint into the right direction, 0xE280AF is the UTF-8 sequence for U+202F NARROW NO-BREAK SPACE, NNBSP; which for the example would had been the original string
2023-04-30 2:38:36 pm

Stored in and retrieved from an 8-bit (instead of UTF-8) text encoding database it could lead to the crippled value encountered.


John R wrote:

LANG=en_GB.UTF-8
...

Those are your shell environment locale settings, not the database (nor HTTP) text encoding. Use for example phpMyAdmin to inspect the database's Structure, the Collation property of all and specifically the piwigo_images table should be utf8mb3_general_ci. If it is something else then likely that's the culprit.  (utf8mb4_... would also be ok but shouldn't be the case here).


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

Offline

 

#13 2024-01-23 02:12:30

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

I queried mariadb and it reported SYSTEM as the setting for both global and session time_zone, which I'd expect (that's why I provided the system settings, lc_time_names shows as en_US and I can't seem to change that, will dig further. Apache doesn't have any timezone settings in it, but php has Europe/London.

Offline

 

#14 2024-01-23 03:06:15

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Setting lc_time_names in my.cnf has moved me on somewhat, now I get

[Tue Jan 23 01:57:31.778751 2024] [php:warn] [pid 8513] [client 10.0.0.35:49743] PHP Warning:  Undefined array key 118 in /usr/local/www/piwigo/include/ws_functions/pwg.categories.php on line 188
[Tue Jan 23 01:57:31.779014 2024] [php:warn] [pid 8513] [client 10.0.0.35:49743] PHP Warning:  Undefined array key 118 in /usr/local/www/piwigo/include/ws_functions/pwg.categories.php on line 192

The image doesn't load into the album I made but I can manually move it there, but it doesn't have a thumbnail. I'm losing more hair follicles than I can afford with this, lol

Offline

 

#15 2024-01-24 06:03:59

John R
Member
2023-04-17
25

Re: Piwigo 14.1.0 and PHP 8.3 blows up

Think I've found a possible solution to try, when I created the db I didn't set CHARACTER SET utf8, time to back up  the contents and delete the db and  reconfigure it. A job for a more sane hour...

The clue was here...
https://project.altservice.com/issues/861

CREATE DATABASE piwigodb CHARACTER SET utf8;

Last edited by John R (2024-01-24 06:06:32)

Offline

 

Board footer

Powered by FluxBB

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