Hey All!
I had turned on J error reporting to maximum while working on something outside of Fabrik and forgot to "dial it down" before I opened a Fabrik form. I was prompted with the following Depreciated notice regarding passing null to the trim() function in the field and jdate elements. The following addressed the errors for me and I wondered if within one of the next releases, something similar should be included? It doesn't break anything to leave as is.
Here are the full error messages:
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/centralparking.ca/plugins/fabrik_element/jDate/jDate.php on line 1084
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/centralparking.ca/plugins/fabrik_element/field/field.php on line 191
Within jdate.php (on line 1084), I replaced:
$value = trim($value, "'");
$value = $value == "" ? null : $value;
With:
if (!empty($value)){
$value = trim($value, "'");
} else {
$value = $value == "" ? null : $value;
}
Within field.php (on line 191), I replaced:
$bits['value'] = htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false);
With:
if (!empty($value)){
$bits['value'] = htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false);
}
I had turned on J error reporting to maximum while working on something outside of Fabrik and forgot to "dial it down" before I opened a Fabrik form. I was prompted with the following Depreciated notice regarding passing null to the trim() function in the field and jdate elements. The following addressed the errors for me and I wondered if within one of the next releases, something similar should be included? It doesn't break anything to leave as is.
Here are the full error messages:
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/centralparking.ca/plugins/fabrik_element/jDate/jDate.php on line 1084
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/centralparking.ca/plugins/fabrik_element/field/field.php on line 191
Within jdate.php (on line 1084), I replaced:
$value = trim($value, "'");
$value = $value == "" ? null : $value;
With:
if (!empty($value)){
$value = trim($value, "'");
} else {
$value = $value == "" ? null : $value;
}
Within field.php (on line 191), I replaced:
$bits['value'] = htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false);
With:
if (!empty($value)){
$bits['value'] = htmlspecialchars($value, ENT_COMPAT, 'UTF-8', false);
}