From 918dc8098304f112d5dac49bc9eabd48d17f6e14 Mon Sep 17 00:00:00 2001 From: "Ilya A. Zhulin" Date: Sat, 2 Dec 2023 13:05:18 +0300 Subject: [PATCH] Remove Deprecarted notices with PHP8+ and empty description `Trim` isn't needed here, but PHP8+ shows this notice ```Deprecated: trim(): Passing null to parameter #1 of type string is deprecated```. If field description is empty, `$field->description` is not defined. --- libraries/cck/_/plugin/field.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/cck/_/plugin/field.php b/libraries/cck/_/plugin/field.php index c046e3553..cef0a3e7d 100644 --- a/libraries/cck/_/plugin/field.php +++ b/libraries/cck/_/plugin/field.php @@ -836,7 +836,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 ) ); @@ -872,7 +872,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 ) ); @@ -990,7 +990,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 ) ); @@ -1030,7 +1030,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 ) ); @@ -1357,4 +1357,4 @@ public static function g_isStaticVariation( &$field, $variation, $strict = false } } } -?> \ No newline at end of file +?>