After updating to PHP 7.1 I got several warnings:

Warning: A non-numeric value encountered in function views_plugin_pager_full->query() (line 256 in file .../sites/all/modules/contrib/views/plugins/views_plugin_pager_full.inc).

Warning: A non-numeric value encountered in function views_handler_field_counter->render() (line 58 in file .../sites/all/modules/contrib/views/handlers/views_handler_field_counter.inc).

Comments

Plazik created an issue. See original summary.

plazik’s picture

Status: Active » Needs review
StatusFileSize
new1.55 KB

This is because "offset" sometimes is not set.

Status: Needs review » Needs work

The last submitted patch, 2: views_plugin_pager_full-query()-2885660-2.patch, failed testing. View results

StefanPr’s picture

I've added filter_var to another variable that was being used in a sum as a string.

StefanPr’s picture

Added patch for 3.18

natanmoraes’s picture

Status: Needs work » Reviewed & tested by the community

Patch from #5 works for me on views 3.17

The last submitted patch, 4: views_plugin_pager_full-query-2885660-4.patch, failed testing. View results

manuel garcia’s picture

Status: Reviewed & tested by the community » Needs work

Patch #4 is failing tests.

thebigmacmurray’s picture

Patch #5 does not work for me on Views 3.20

manuel garcia’s picture

Patch #4 still applies cleanly on 7.x-3.x .

+++ b/plugins/views_plugin_pager_full.inc
@@ -246,14 +246,16 @@ class views_plugin_pager_full extends views_plugin_pager {
+    $this->options['offset'] = 0;

Why hardcode this to 0?

steinmb’s picture

Status: Needs work » Needs review
StatusFileSize
new764 bytes

I do not think we can do type hinting. That would req. everyone to use minimum PHP 7.0. https://secure.php.net/manual/en/functions.arguments.php#functions.argum...

Tried on one site generating these warning to step through. Sometime do I get the string "", sometime string 0 and sometime int. 0. Could we do something along these lines to make sure it is a integer before calculate?

joelpittet’s picture

@steinmb How about just cast it to an (int)?

$ php -r "var_dump((int) '');"
int(0)
$ php -r "var_dump((int) '0');"
int(0)
$ php -r "var_dump((int) 0);"
int(0)

I don't see how a float offset would be useful.

joelpittet’s picture

StatusFileSize
new3 KB

Here's my thought in patch form

steinmb’s picture

Status: Needs review » Reviewed & tested by the community

No idea what I was thinking. Must have been mad or tired. I think I got tricked by https://wiki.php.net/rfc/integer_semantics. Sure casting like this will work in older versions PHP.

manuel garcia’s picture

+1 to RTBC #13

nikolabintev’s picture

#13 works for me with PHP 7.1

dsnopek’s picture

Issue tags: +panopoly

RTBC+1! Used in Panopoly

damienmckenna’s picture

  • DamienMcKenna committed 88cbaab on 7.x-3.x authored by Plazik
    Issue #2885660 by StefanPr, Plazik, steinmb, joelpittet, Manuel Garcia,...
damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joegraduate’s picture

Issue tags: +PHP 7.1
Annelies Van der Wee’s picture

#13 fixed it, Thanks!!

wylbur’s picture

FYI - the patch in comment #19 still applied cleanly to the 7.x-3.21 version of views.

wylbur’s picture

FYI - the patch in comment #19 still applied cleanly to the 7.x-3.22 version of views.

We'll be delighted with this reaches the officially stable release of views...

manuel garcia’s picture

Re #25:

FYI - the patch in comment #19 still applied cleanly to the 7.x-3.22 version of views.

Good to hear that the patch at least applies cleanly to the latest release :)

We'll be delighted with this reaches the officially stable release of views...

The good news is that as far as I understand, this will be included inn the upcoming 7.x-3.23 release. Please see #2960871: Plan for Views 7.x-3.23 release for plans, what needs to happen first, etc.