Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I searched the other issues but couldn't find this strict warning:
Strict warning: Declaration of views_handler_argument::get_value() should be compatible with that of views_handler::get_value() in _registry_check_code() (line 2811 of C:\temp\xampp\htdocs\cms\includes\bootstrap.inc).
Not sure how to fix this. The attached patch simply adds $values, $field = NULL to the method declaration. Fix seems harmless but of course just adding parameters to a method might break a lot of things..
Comment | File | Size | Author |
---|---|---|---|
#6 | 1100052-get_value-to-field.patch | 1.5 KB | dawehner |
views_handler_argument-strict warning.patch | 620 bytes | michielnugter | |
Comments
Comment #1
dawehnerCommited a slighly different version (c&p from views_handler) to both 6.x-3.x and 7.x-3.x
Thanks for the patch.
Comment #2
bojanz CreditAttribution: bojanz commentedDo we really want to reuse the get_value() function name here?
get_value() does a completely different thing outside of arguments, so maybe the argument one should be renamed to something like get_argument_value().
Plus, I'm not sure where the argument get_value() is called from, but it didn't receive any parameters before, and now it wants the (unused) $values, which means we have a possible fatal error somewhere.
Comment #3
michielnugter CreditAttribution: michielnugter commentedGlad to be of help.
#2
You can call a method without any parameters while it has some declared as required, can't remember why, think it has something to do with:
EDIT: I do agree however the method name should be different if the implementation / usage differs from the original method.
Comment #4
johnvThis fix makes things worse then before. The function decarations is now: function get_value($values, $field = NULL) .
Modules calling get_value() now get the following warning (taken from GMap)
Warning: Missing argument 1 for views_handler_argument::get_value(), called in ...\modules\gmap\gmap_plugin_style_gmap.inc on line 147 and defined in views_handler_argument->get_value() (line 975 of ...\modules\views\handlers\views_handler_argument.inc).
Why should $values be obligatory, even when the function doesn't use it?
Comment #5
johnvcorss-reference: posted #1105200: Notice: Undefined index: format in views_handler->get_value() as duplicate.
Comment #6
dawehnerAs bojanz said on irc he doesn't need get_value anymore in area handler because this doesn't have a field alias at the moment.
So here is a patch: move get_value back to handlers/views_handler_field.inc but keep sanitize_value because this definitive could be helpful for the other handlers. For example the argument handler to sanitize the title etc/the area hander to display something.
Comment #7
bojanz CreditAttribution: bojanz commentedI'm actually using get_value() quite nicely in the area handlers (Drupal Commerce). Keep it where it is. We just need to rename this get_value() because it has no connection to the newer one.
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedThe older get_value() is in use in contrib, such as project.module
Comment #9
dawehnerSo the only way to fix it is that the area handlers provide them for themselves.
@bojanz
Didn't you said that the method is pointless because you don't have field_alias availible?
Comment #10
bojanz CreditAttribution: bojanz commentedOkay, then. I'm providing my own get_value() in the area handlers, so I can do that even with the original function somewhere else.
EDIT: Of course, you need to revert the change from the beginning of this issue as well (but that doesn't need to be in the patch).
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted and #1 reverted at the same time.