From e3dd84caef928f10acfd5d40a3c07c4354dd896d Mon Sep 17 00:00:00 2001 From: Zauberfisch Date: Thu, 16 Jul 2020 13:51:24 +0200 Subject: [PATCH 1/3] Fixed php7.4 deprecation notice for magic quotes --- core/Constants.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/Constants.php b/core/Constants.php index e0537eda543..48f10103b85 100644 --- a/core/Constants.php +++ b/core/Constants.php @@ -167,9 +167,10 @@ function stripslashes_recursively(&$array) { */ } else { /** - * Fix magic quotes setting + * Check if magic quotes are enabled (only relevant for php 5.3) + * get_magic_quotes_gpc() call is suppressed to avoid php7.4 deprecation notice */ - if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { + if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) { if($_REQUEST) stripslashes_recursively($_REQUEST); if($_GET) stripslashes_recursively($_GET); if($_POST) stripslashes_recursively($_POST); From 69a8836910789d73f3aac86a55957d124885cd2d Mon Sep 17 00:00:00 2001 From: Samuel Amoser Date: Tue, 18 Aug 2020 15:16:07 +0200 Subject: [PATCH 2/3] PATCH: Prevents calling strpos with empty needle We happen to run into this warning: ``` [Warning] strpos(): Empty needle Line 2618 in ./framework/i18n/i18n.php 2618 strpos($theme, (string)Config::inst()->get('SSViewer', 'theme')) === 0 ``` I suggest to test the needle against emptyness before invoking strpos. --- i18n/i18n.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/i18n/i18n.php b/i18n/i18n.php index 909d3d1df0f..35c0c872307 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -2614,8 +2614,10 @@ public static function include_by_locale($locale, $clean = false) { $themesBase = Director::baseFolder() . '/themes'; if(is_dir($themesBase)) { foreach(scandir($themesBase) as $theme) { + $themename = (string)Config::inst()->get('SSViewer', 'theme'); if( - strpos($theme, (string)Config::inst()->get('SSViewer', 'theme')) === 0 + !empty($themename) + && strpos($theme, $themename) === 0 && file_exists("{$themesBase}/{$theme}/lang/") ) { $filename = $adapter->getFilenameForLocale($locale); From 28a81bb97d06fea2008c0dae35d855504b75fb17 Mon Sep 17 00:00:00 2001 From: Sang Lostrie Date: Wed, 26 Aug 2020 19:44:11 +0100 Subject: [PATCH 3/3] Update 05_Coding_Conventions.md Fixed typo --- docs/en/00_Getting_Started/05_Coding_Conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/00_Getting_Started/05_Coding_Conventions.md b/docs/en/00_Getting_Started/05_Coding_Conventions.md index f2559244b38..0ee36b4494d 100644 --- a/docs/en/00_Getting_Started/05_Coding_Conventions.md +++ b/docs/en/00_Getting_Started/05_Coding_Conventions.md @@ -48,7 +48,7 @@ Class and filenames are in `UpperCamelCase` format: class MyClass {} ``` -new word must be capitalized. Successive capitalized letters are used in +new words must be capitalized. Successive capitalized letters are used in acronyms, e.g. a class `XMLImporter` is used while `XmlImporter` is not. ### Methods