mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 19:05:54 +03:00
[GH-ISSUE #266] Use of undefined constant warning in php7.3 #192
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @amurad on GitHub (Dec 18, 2019).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/266
I am running in debian with nginx 16.1 and php7.3. I am getting following warning when trying to open image or pdf file:
@alan67160 commented on GitHub (Jan 3, 2020):
I'm using Ubuntu Server 19.10 at Raspberry Pi 4B(4GB Ram/128GB SD card) with Nginx 1.16.1 and php7.3-fpm, but I can't see any error.
@yumyo commented on GitHub (Jan 22, 2020):
I see all the warnings on PHP 5.5.9 when setting error_reporting to true. I assume the same should happen for PHP 7.3 as the correct way to set arrays as constant values is to serialize and unserialize the array. https://stackoverflow.com/a/19444381
So changing line 359 to:
defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', serialize($exclude_items));and line 2298 to:
if(!in_array($file, unserialize(FM_EXCLUDE_ITEMS)) && !in_array("*.$ext", unserialize(FM_EXCLUDE_ITEMS))) {Solve all fo the notices and warnings at once.
@yumyo commented on GitHub (Jan 22, 2020):
Actually, In PHP 7, array values are also accepted, so you can either apply the fix above or upgrade PHP if possible. But it also seems that serializing and unserializing it is still a good practice for constant values.