dokuwiki_plugin_wrap
dokuwiki_plugin_wrap copied to clipboard
PHP 8+ warnings, "undefined array key", margins lines 671-4 and 695
PHP Warnings:
Undefined array key "margin-top" in .../lib/plugins/wrap/helper.php on line 671
Undefined array key "margin-right" in .../lib/plugins/wrap/helper.php on line 672
Undefined array key "margin-bottom" in .../lib/plugins/wrap/helper.php on line 673
Undefined array key "margin-left" in .../lib/plugins/wrap/helper.php on line 674
Undefined array key "float" in .../lib/plugins/wrap/helper.php on line 695
In helper.php (lines 671-4 and 695), I have changed these lines:
$margin_top = $css_properties ['margin-top'];
$margin_right = $css_properties ['margin-right'];
$margin_bottom = $css_properties ['margin-bottom'];
$margin_left = $css_properties ['margin-left'];
...
$frame_props ['float'] = $css_properties ['float'];
To:
$margin_top = $css_properties ['margin-top'] ?? null;
$margin_right = $css_properties ['margin-right'] ?? null;
$margin_bottom = $css_properties ['margin-bottom'] ?? null;
$margin_left = $css_properties ['margin-left'] ?? null;
...
$frame_props ['float'] = $css_properties ['float'] ?? null;
But i don't know if this really fix the issue, because these warnings doesn't happens frequently.
I was able to reproduce the float warning and created the PR #274 to fix this issue. I tested it and it seems to be working as expected now.