Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Use Civi::statics in CRM_Utils_File instead of php static #25498

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CRM/Utils/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ public static function stripComments($string) {
* @return bool
*/
public static function isExtensionSafe($ext) {
static $extensions = NULL;
if (!$extensions) {
if (!isset(Civi::$statics[__CLASS__]['file_extensions'])) {
$extensions = CRM_Core_OptionGroup::values('safe_file_extension', TRUE);

// make extensions to lowercase
Expand All @@ -370,9 +369,10 @@ public static function isExtensionSafe($ext) {
unset($extensions['html']);
unset($extensions['htm']);
}
Civi::$statics[__CLASS__]['file_extensions'] = $extensions;
}
// support lower and uppercase file extensions
return (bool) isset($extensions[strtolower($ext)]);
return (bool) isset(Civi::$statics[__CLASS__]['file_extensions'][strtolower($ext)]);
}

/**
Expand Down