[16.0.0, PHP 7.4] image upload: Call to undefined function str_starts_with() #2135

Closed
opened 2026-10-05 01:07:18 +02:00 by adam · 2 comments
Owner

Hello,

I was in the process of manual installation of Piwigo 16.0.0 on CentOS Linux release 7.6.1810 (Core) with PHP 7.4, MYSQL 5.6, Apache 2.2.

However, post successful installation I face an issue with image upload to album. When trying to upload any image i.e png , gif etc I see that image upload shows 100% and isn't actually uploaded.

Following is the screenshot for the same :

Image

Following is the error in apache error logs :

[{{DATE}}] PHP Fatal error:  Uncaught Error: Call to undefined function str_starts_with() in /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_metadata.php:195
Stack trace:
#0 /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_metadata.php(292): get_sync_metadata(Array)
#1 /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_upload.inc.php(403): sync_metadata(Array)
#2 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_functions/pwg.images.php(1873): add_uploaded_file('./upload/buffer...', 'logo.gif', Array, 0, 2)
#3 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_core.inc.php(605): ws_images_upload(Array, Object(PwgServer))
#4 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_protocols/rest_handler.php(41): PwgServer->invoke('pwg.images.uplo...', Array)
#5 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_core.inc.php(281): PwgRestRequestHandler->handleRequest(Object(PwgServer))
#6 /{{PATH}}/{{TO}}/{{PIWIGO}}/ws.php(22): PwgServer->run()
#7 {main}

Even 'Cancel' doesn't work in the above scenario and after hard refresh i.e reloading page or doing Ctrl + f5 and trying to re upload an image works fine sometimes :

Image

I have tested on PHP 8.0 and this error doesn't occur. Uploads work absolutely fine on PHP 8.0.

I checked on website that the official minimum requirements mention PHP 7.4 :

https://piwigo.org/guides/install/requirements

Are the PHP requirements changed or is it an issue?. Could you please replicate and fix this?.

Regards.

Hello, I was in the process of manual installation of Piwigo 16.0.0 on CentOS Linux release 7.6.1810 (Core) with PHP 7.4, MYSQL 5.6, Apache 2.2. However, post successful installation I face an issue with image upload to album. When trying to upload any image i.e png , gif etc I see that image upload shows 100% and isn't actually uploaded. Following is the screenshot for the same : <img width="1650" height="745" alt="Image" src="https://github.com/user-attachments/assets/7a8dfdec-c6d3-46fa-97ff-1beb450572b0" /> Following is the error in apache error logs : ``` [{{DATE}}] PHP Fatal error: Uncaught Error: Call to undefined function str_starts_with() in /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_metadata.php:195 Stack trace: #0 /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_metadata.php(292): get_sync_metadata(Array) #1 /{{PATH}}/{{TO}}/{{PIWIGO}}/admin/include/functions_upload.inc.php(403): sync_metadata(Array) #2 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_functions/pwg.images.php(1873): add_uploaded_file('./upload/buffer...', 'logo.gif', Array, 0, 2) #3 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_core.inc.php(605): ws_images_upload(Array, Object(PwgServer)) #4 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_protocols/rest_handler.php(41): PwgServer->invoke('pwg.images.uplo...', Array) #5 /{{PATH}}/{{TO}}/{{PIWIGO}}/include/ws_core.inc.php(281): PwgRestRequestHandler->handleRequest(Object(PwgServer)) #6 /{{PATH}}/{{TO}}/{{PIWIGO}}/ws.php(22): PwgServer->run() #7 {main} ``` Even 'Cancel' doesn't work in the above scenario and after hard refresh i.e reloading page or doing Ctrl + f5 and trying to re upload an image works fine sometimes : <img width="1869" height="927" alt="Image" src="https://github.com/user-attachments/assets/efd55c5c-0670-447c-809d-a49b3ac17533" /> I have tested on PHP 8.0 and this error doesn't occur. Uploads work absolutely fine on PHP 8.0. I checked on website that the official minimum requirements mention PHP 7.4 : https://piwigo.org/guides/install/requirements Are the PHP requirements changed or is it an issue?. Could you please replicate and fix this?. Regards. <!-- github-sync-id:3661912701 -->
adam closed this issue 2026-10-05 01:07:18 +02:00
Author
Owner
releated to https://piwigo.org/forum/viewtopic.php?pid=193371 <!-- github-comment-id:3586199779 -->
Author
Owner

I will implement this fix (thank to moberley on the forum)

I will implement this [fix](https://piwigo.org/forum/viewtopic.php?pid=193380#p193380 ) (thank to moberley on the forum) <!-- github-comment-id:3586211847 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2135