Open MartijnSanders opened 3 months ago
Mikio was originally based on the bootstrap 4 style and elements, but doesn't use bootstrap itself, so it being EOL doesn't affect this. It has been slowly moving in its own direction.
The box issue is being caused by PHP 8.1 moving 'Undefined array key' from a notice to a warning. This should be able to be fixed by updating the grid-row*
and grid-col*
options to have an empty default, similar to the margin
option. This will then create the array key if it doesn't exist.
If you are happy to do the PR to fix this, that would be fantastic. Thank you so much.
(I originally was posted this using the wrong github account)
FOUND IT: behavior was result of handle() caching result based on old version of $options. Message can be ignored.
Thought is was easy, but am encountering some issues. Adding empty default values does not work. Reason is that not all the default option values are set for the box class.
Changes: added box.php; 1) default values in $options 2) logging 3) explicit call to cleanOptions Result: Debug log shows that default values are not set in $data when render_lexer_enter is called.
For reference here is a fragment from box.php
class syntax_plugin_mikioplugin_box extends syntax_plugin_mikioplugin_core {
public $tag = 'box';
public $requires_tag = 'grid';
public $hasEndTag = true;
public $options = array(
'attr' => array('type' => 'text', 'default' => ''),
'round' => array('type' => 'size', 'default' => '0'),
'border-color' => array('type' => 'color', 'default' => ''),
'border-width' => array('type' => 'multisize', 'default' => ''),
'reveal' => array('type' => 'boolean', 'default' => 'false'),
'reveal-text' => array('type' => 'text', 'default' => 'Reveal'),
'url' => array('type' => 'url', 'default' => ''),
'color' => array('type' => 'color', 'default' => ''),
'padding' => array('type' => 'multisize', 'default' => ''),
'margin' => array('type' => 'multisize', 'default' => ''),
'grid-row' => array('type' => 'text', 'default' => ''),
'grid-row-start' => array('type' => 'number', 'default' => ''),
'grid-row-end' => array('type' => 'number', 'default' => ''),
'grid-row-span' => array('type' => 'number', 'default' => ''),
'grid-col' => array('type' => 'text', 'default' => ''),
'grid-col-start' => array('type' => 'number', 'default' => ''),
'grid-col-end' => array('type' => 'number', 'default' => ''),
'grid-col-span' => array('type' => 'number', 'default' => ''),
);
public function __construct() {
$this->addCommonOptions('width height type shadow text-align links-match vertical-align');
}
public function getPType() { return 'normal'; }
public function render_lexer_enter(Doku_Renderer $renderer, $data) {
Logger::debug("syntax_plugin_mikioplugin_box data ".print_r($data,true));
$data2 = $this->cleanOptions($data, $this->options);
Logger::debug("syntax_plugin_mikioplugin_box data2 ".print_r($data2,true));```
For reference here is a fragment from the debug log for the tag
2024-07-15 11:52:47 syntax_plugin_mikioplugin_box data Array
(
[text-align] => center
[round] => 0
[border-color] =>
[border-width] =>
[reveal] =>
[reveal-text] => Reveal
[url] =>
[color] =>
[padding] =>
[margin] =>
[width] =>
[height] =>
[type] =>
[shadow] =>
[links-match] =>
[vertical-align] =>
)
2024-07-15 11:52:47 syntax_plugin_mikioplugin_box data2 Array
(
[text-align] => center
[round] => 0rem
[border-color] =>
[border-width] =>
[reveal] =>
[reveal-text] => Reveal
[url] => /dokuwiki/doku.php?id=start
[color] =>
[padding] =>
[margin] =>
[width] => 1rem
[height] => 1rem
[type] =>
[links-match] =>
[attr] =>
[grid-row] =>
[grid-row-start] =>
[grid-row-end] =>
[grid-row-span] =>
[grid-col] =>
[grid-col-start] =>
[grid-col-end] =>
[grid-col-span] =>
[shadow] =>
[vertical-align] =>
)
box.php is throwing many 'Undefined array key' errors
is this something that should be fixed or is the plan to deprecate box (as 4 is EOL already)? If the first i can fix and PR the fix.