-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
fix some 'undefined array key' warnings #4121
base: main
Are you sure you want to change the base?
Conversation
I'd prefer |
In my personal older fix for Select, I indeed used I was curious about the actual difference so I looked up https://stackoverflow.com/a/3210982 . So the use of But in the end, I don't care. If you insist I'll change it? |
I try to avoid |
app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php
Outdated
Show resolved
Hide resolved
....hope you have write access :p |
} | ||
|
||
$lbl = $this->escapeHtml($option['label']); // or just empty as well? | ||
return '<option value="' . $lbl . '">' . $lbl . '</option>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for setting label (instead of empty string) to option value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it, so each option has a different / its own value, what the 'value' key in the map was supposed to provide.
If you think that's not required, we can leave the value attribute of the tag empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer an empty string.
Maybe you can share the extension that causes the problem, to reproduce it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll change it to empty string then.
It's an Amazon Pay add-on from creative style. I hope I can provide it in the next days
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe its better to fix the extension itself. There some forks of it ...
https://github.com/kirchbergerknorr/magento1_creativestyle_amazon-payments
https://github.com/mothership-gmbh/magento1_creativestyle_amazon_payments
Or create a repo, or better update https://github.com/OpenMageModuleFostering/creativestyle_amazonpayments
The description of this PR:
The warning happens because there are mistakes in supplying the options in custom grids and forms. When rendering the HTML select element, the rendering functions expect the var Therefore, I object to this PR. |
As I mentioned in #4125 (comment) I think OM should handle this in a proper way.
Imho, the current way is neither fish nor fowl.... |
I am not sure:
Issue as I described earlier: The warnings in the log file are very helpful and should not be silenced..
This is the same as silencing the warning.
Potential BC, affected grids will no longer work. Consider this: PHP 7 and earlier, it throws We are concern about compatibility with PHP8 and there were many PRs on this. But this case is not about compatibility. Is it? |
How about to validate the config and log what's wrong? |
Nice idea. But if there is no developer, the log would just pile up. However |
Now, the log piles up, too, with the warnings ;) (ok, depending on cfg) So I guess, this is not really solvable without BC, be it filter out wrong options and/or throwing exceptions, in 20.x, maybe it can be done in 21.x? |
Description (*)
Sometimes, the array key "value" is not available, showing warnings in the logfile. This PR adds some isset-checks to avoid them.
Related Pull Requests
Fixed Issues (if relevant)
See for example
Warning: Undefined array key "value" in /var/www/XXX/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field.php on line 86
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)