ME 1.39.6
PHP 8.1.27
Cargo @fc658e0df5c2369090a7d37970432f2d2124017c
The following three Cargo deprecation errors appear in my logs. I added a patch with a workaround solution that solves them in my case. I figured, you can spot the affected code more easily this way. Essentially they all share the fact that a cargo field value is `null`. I did not inspect any further, if you need to know how to actually reproduce all three of them, please let me know.
```
diff --git a/includes/formats/CargoListFormat.php b/includes/formats/CargoListFormat.php
index a8869fc..aa815fd 100644
--- a/includes/formats/CargoListFormat.php
+++ b/includes/formats/CargoListFormat.php
@@ -33,7 +33,7 @@ class CargoListFormat extends CargoDisplayFormat {
if ( !array_key_exists( $fieldName, $row ) ) {
continue;
}
- $fieldValue = $row[$fieldName];
+ $fieldValue = is_null($row[$fieldName]) ? '' : $row[$fieldName];
if ( trim( $fieldValue ) == '' ) {
continue;
}
diff --git a/includes/formats/CargoTemplateFormat.php b/includes/formats/CargoTemplateFormat.php
index 5586707..52e2ced 100644
--- a/includes/formats/CargoTemplateFormat.php
+++ b/includes/formats/CargoTemplateFormat.php
@@ -33,6 +33,7 @@ class CargoTemplateFormat extends CargoDisplayFormat {
} else {
$value = $row[$fieldName];
}
+ $value = is_null($value) ? '' : $value;
// Escape pipes within the values so that they
// aren't interpreted as template pipes.
$value = str_replace( '|', '{{!}}', $value );
diff --git a/includes/parserfunctions/CargoStore.php b/includes/parserfunctions/CargoStore.php
index fe57c6b..3fa4c88 100644
--- a/includes/parserfunctions/CargoStore.php
+++ b/includes/parserfunctions/CargoStore.php
@@ -393,7 +393,8 @@ class CargoStore {
if ( $fieldDescription->mIsList ) {
$fieldTableName = $tableName . '__' . $fieldName;
$delimiter = $fieldDescription->getDelimiter();
- $individualValues = explode( $delimiter, $tableFieldValues[$fieldName] );
+ $valuesForField = is_null($tableFieldValues[$fieldName]) ? '' : $tableFieldValues[$fieldName];
+ $individualValues = explode( $delimiter, $valuesForField );
$valueNum = 1;
foreach ( $individualValues as $individualValue ) {
$individualValue = trim( $individualValue );
```