Trying to access array offset on value of type int
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy_optimise.php — line 599
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy_optimise.php — line 88
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy.php — line 934
/wp-content/plugins/bm-custom-login/bm-custom-login.php — line 241
/wp-content/plugins/bm-custom-login/bm-custom-login.php — line 208
/wp-includes/class-wp-hook.php — line 324
/wp-includes/class-wp-hook.php — line 348
/wp-includes/plugin.php — line 517
/wp-login.php — line 127
/wp-login.php — line 1482
-
This reply was modified 1 year, 8 months ago by
zecompadre.
Trying to access array offset on value of type int
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy_optimise.php — line 599
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy_optimise.php — line 88
/wp-content/plugins/bm-custom-login/csstidy/class.csstidy.php — line 934
/wp-content/plugins/bm-custom-login/bm-custom-login.php — line 241
/wp-content/plugins/bm-custom-login/bm-custom-login.php — line 208
/wp-includes/class-wp-hook.php — line 324
/wp-includes/class-wp-hook.php — line 348
/wp-includes/plugin.php — line 517
/wp-login.php — line 127
/wp-login.php — line 1482
PHP error in the csstidy library, which is used by the BM Custom Login plugin to parse and optimize CSS code. The error occurs on line 599 of the class.csstidy_optimise.php file, where the code is trying to access an array offset on a value of type int.
I am NOT a developer but used AI to update the merge_4value_shorthands function and so far the errors are gone.
FIX:
static function merge_4value_shorthands($array) {
$return = $array;
$shorthands = &$GLOBALS['csstidy']['shorthands'];
foreach ($shorthands as $key => $value) {
// Check if $value is an array and has at least 4 elements
if (is_array($value) && count($value) >= 4) {
if (isset($array[$value[0]]) && isset($array[$value[1]]) &&
isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0) {
$return[$key] = '';
$important = '';
for ($i = 0; $i < 4; $i++) {
$val = $array[$value[$i]];
if (csstidy::is_important($val)) {
$important = '!important';
$return[$key] .= csstidy::gvw_important($val) . ' ';
} else {
$return[$key] .= $val . ' ';
}
unset($return[$value[$i]]);
}
$return[$key] = csstidy_optimise::shorthand(trim($return[$key] . $important));
}
}
}
return $return;
}
Hi @nikkers and @zecompadre,
thank you for reporting the issue. We just released the new version of this plugin, where CSSTidy library is entirely removed – please update the plugin to version 2.4.0 to get rid of these PHP warnings.
Details: instead of CSSTidy library, we used the same CSS sanitization approach as WordPress core uses for CSS defined in customizer or theme.json – that means, it’s up to the user to provide valid CSS, and it’s up to us to ensure its stored and rendered securely. With this context, we decided that CSSTidy library is a bit too heavy for this simple use case, hence the removal.
Hope that makes sense!