Skip to content

Fixed issue #267: PHP warnings about margins in helper.php. #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2023
Merged

Fixed issue #267: PHP warnings about margins in helper.php. #268

merged 2 commits into from
Aug 13, 2023

Conversation

nerun
Copy link
Contributor

@nerun nerun commented Jul 16, 2023

PHP Warning:  Undefined array key "padding-left" in .../public_html/wiki/lib/plugins/wrap/helper.php on line 398
PHP Warning:  Undefined array key "margin-left" in .../public_html/wiki/lib/plugins/wrap/helper.php on line 466
PHP Warning:  Undefined array key "margin-right" in .../public_html/wiki/lib/plugins/wrap/helper.php on line 467
PHP Warning:  Undefined array key "margin-top" in .../public_html/wiki/lib/plugins/wrap/helper.php on line 468
PHP Warning:  Undefined array key "margin-bottom" in .../public_html/wiki/lib/plugins/wrap/helper.php on line 469
  • Using master branch, not the package from dokuwiki.
  • PHP 8.1 here.

@fiwswe
Copy link
Contributor

fiwswe commented Jul 16, 2023

Wouldn't it be easier and shorter to use the Null Coalescing Operator here?

E.g. instead of:

        if ( isset($properties ['margin-left']) ) {
            $properties ['padding-left'] = $properties ['margin-left'];
        } else {
            $properties ['padding-left'] = null;
        }

the same functionality can be expressed as:

        $properties ['padding-left'] = $properties ['margin-left'] ?? null;

@nerun
Copy link
Contributor Author

nerun commented Jul 16, 2023

Thank you, i am very new in php.

@Klap-in Klap-in merged commit a705163 into selfthinker:master Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants