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
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
Good to know, thanks, I'll go compile 8.2 and give that a whirl and post back after.
Offline
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
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
I've tried with a few from whatsapp and from my own photos I've taken with my phone, same error each time.
Offline
I've moved it back to PHP 8.3 to stay true to the original post.
Offline
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.
Offline
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
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
Offline
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
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).
Offline
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
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
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