From 5c0c5f5e04d1cf701102ddf9cfc809eb8a36f908 Mon Sep 17 00:00:00 2001 From: "Ilya A. Zhulin" Date: Sat, 2 Dec 2023 12:12:32 +0300 Subject: [PATCH 1/2] Remove notice with empty description This `trim` isn't really needed here, but PHP 8+ shows a message like ```Deprecated: trim(): Passing null to parameter #1 of type string is deprecated``` when field description is empty. --- libraries/cck/_/plugin/field.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/cck/_/plugin/field.php b/libraries/cck/_/plugin/field.php index 70d4de77b..b19c60a5a 100644 --- a/libraries/cck/_/plugin/field.php +++ b/libraries/cck/_/plugin/field.php @@ -851,7 +851,7 @@ public static function g_onCCK_FieldPrepareForm( &$field, &$config = array() ) if ( trim( $field->label ) ) { $field->label = JText::_( 'COM_CCK_' . str_replace( ' ', '_', trim( $field->label ) ) ); } - if ( trim( $field->description ) ) { + if ( $field->description) { $desc = trim( strip_tags( $field->description ) ); if ( $desc ) { $field->description = JText::_( 'COM_CCK_' . str_replace( ' ', '_', $desc ) ); @@ -1336,4 +1336,4 @@ public static function g_isStaticVariation( &$field, $variation, $strict = false } } } -?> \ No newline at end of file +?> From ff4fbf1eeab540b88485701c13d76d08a55ff719 Mon Sep 17 00:00:00 2001 From: "Ilya A. Zhulin" Date: Sat, 2 Dec 2023 12:54:09 +0300 Subject: [PATCH 2/2] Update field.php --- libraries/cck/_/plugin/field.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/cck/_/plugin/field.php b/libraries/cck/_/plugin/field.php index b19c60a5a..0af93ecaf 100644 --- a/libraries/cck/_/plugin/field.php +++ b/libraries/cck/_/plugin/field.php @@ -815,7 +815,7 @@ public static function g_onCCK_FieldPrepareContent( &$field, &$config = array() if ( trim( $field->label ) ) { $field->label = JText::_( 'COM_CCK_' . str_replace( ' ', '_', trim( $field->label ) ) ); } - if ( trim( $field->description ) ) { + if ( $field->description ) { $desc = trim( strip_tags( $field->description ) ); if ( $desc ) { $field->description = JText::_( 'COM_CCK_' . str_replace( ' ', '_', $desc ) ); @@ -969,7 +969,7 @@ public function g_onCCK_FieldPrepareSearch( &$field, &$config = array() ) if ( trim( $field->label ) ) { $field->label = JText::_( 'COM_CCK_' . str_replace( ' ', '_', trim( $field->label ) ) ); } - if ( trim( $field->description ) ) { + if ( $field->description ) { $desc = trim( strip_tags( $field->description ) ); if ( $desc ) { $field->description = JText::_( 'COM_CCK_' . str_replace( ' ', '_', $desc ) ); @@ -1009,7 +1009,7 @@ public function g_onCCK_FieldPrepareStore( &$field, $name, $value, &$config = ar if ( trim( $field->label ) ) { $field->label = JText::_( 'COM_CCK_' . str_replace( ' ', '_', trim( $field->label ) ) ); } - if ( trim( $field->description ) ) { + if ( $field->description ) { $desc = trim( strip_tags( $field->description ) ); if ( $desc ) { $field->description = JText::_( 'COM_CCK_' . str_replace( ' ', '_', $desc ) );