selfthinker / dokuwiki_plugin_wrap

Wrap Plugin for DokuWiki: Universal plugin which combines functionalities of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction.
http://www.dokuwiki.org/plugin:wrap
GNU General Public License v2.0
42 stars 33 forks source link

PHP 8+ warnings, "undefined array key", margins lines 671-4 and 695 #272

Open nerun opened 1 year ago

nerun commented 1 year ago

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.

eduardomozart commented 11 months ago

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.