CERN Components Error Messages

Hi,

After upgraded to Drupal 9 (https://ams02.space/), we keep noticing error messages like this one:

Notice : Trying to access array offset on value of type bool in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension::renderThis() (line 632 of /app/web/modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php )

The website looks okay, but the error constantly shows up in the admin portal.
Could you help me to check the source of the error message?

Thank you!
Jiahui

Hi Jiahui

Can you please confirm which version of cern_components you have installed?

Thanks!

Hi, it is 2.7.17.

Hi again

Thanks for confirming.

We will investigate.

Thanks!

Hello,

Was this issue fixed at any point?
I have a similar issue. The site works well but first time I log in as admin the message shows up, If I refresh then goes away.

Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Undefined array key “field_p_background_image” in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Warning: Trying to access array offset on value of type null in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).
Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\cern_components\TwigExtension\CernComponentsTwigExtension->getImgSrc() (line 352 of modules/custom/cern-components/src/TwigExtension/CernComponentsTwigExtension.php).

The version of CERN_components I am using is: Version: 3.0.19

Hi,

I have the same error message here…

Hi,

please go to: Administration>> Configuration >>Development >>Performance
Once here, click the button to “Clear all caches”

The issue should disappear

Thanks @ldelpian for your help.
FYI This didn’t solve the problem.
For now I am sticking to the solution suggested by @fborgesa to hide the warning messages in admin/config/development/logging

Cheers,
Imanol