Just upgraded to Alpha 2 and find that my views no longer respect the setting to display a specific number of results. Not done a full analysis yet but thought I should flag it immediately as this is such a new release. Have rolled back to Alpha 1 for now.

Comments

stevetheboater created an issue. See original summary.

fizk’s picture

Are you simply using "Display a specified number of items" under Pager to limit the number of results?

stevetheboater’s picture

Yes, it's a very simple view of fields from a specific node type but regardless of the setting I use, all results are displayed.

SRampley’s picture

I had the same issue on updating to the latest version.
This is due to the new hook implementation in the module file.

/**
 * Implements hook_views_post_build().
 */
function views_php_views_post_build($view) {
  // Clear the limit and offset
  $view->build_info['query']->range();
}

  • fizk committed b348878 on 7.x-1.x
    Issue #2613876: Cannot display specific number of items in view
    
fizk’s picture

Status: Active » Needs review

I've committed this to 7.x-1.x-dev:

https://www.drupal.org/commitlog/commit/17562/b348878140641e0eadd6486abf...

Let me know if it works for you.

  • fizk committed ff7e34c on 7.x-2.x
    Issue #2613876: Cannot display specific number of items in view
    
stevetheboater’s picture

If I apply that patch to 7.x-1.x-dev it works fine, thanks :)

fizk’s picture

Status: Needs review » Fixed

Great :)

redeight’s picture

This is still broken as far as I can tell... Limits are being ignored and the query isn't adding LIMIT anywhere.... I'm on 7.x-1.0-alpha2+1-dev

To fix it, I commented out the line containing '->range()' and it went back to working... Why are we nuking this in the first place?

redeight’s picture

Status: Fixed » Needs work

Marking as needs work because it still seems to break any view with a limit.

pandroid’s picture

+1. Breaks both normal views and blocks.
It looks like it displays all the entries instead of paging it, but if you page it you get the same entries all over again.

stevetheboater’s picture

I used the dev release but manually applied the patch referred to in #6 and that seemed to fix it for me. @fizk does the dev version need to be rolled again so that your fix can be used out of the box?

yalh’s picture

Thanks fizk, it works for me.
You saved my night ^^

fizk’s picture

@stevetheboater I thought I published an alpha3 release this morning, but it doesn't seem to be showing up. I'm trying to figure out what's going on...

fizk’s picture

@RedEight @pandroid Do you have the following code in views_php.module:

function views_php_views_post_build($view) {
   // Clear the limit and offset
   if (!empty($view->views_php) && !empty($view->build_info['query']) && is_object($view->build_info['query'])) {
     $view->build_info['query']->range();
   }
 }
fizk’s picture

It seems Drupal.org has been having issues building releases today. They said it should clear up within the next hour or so.

fizk’s picture

Status: Needs work » Fixed

The infrastructure team has fixed the releases, you should have access to alpha3 now.

stevetheboater’s picture

Can confirm that alpha 3 is available and fixes the issue. Many thanks :)

pandroid’s picture

Yes, alpha3 seems to have fixed it.

smurfxx’s picture

Will you update also the dev version? I use that and I still have the bug. Thanks!

fizk’s picture

@smurfxx Thanks, I didn't notice that. I've pinged the infrastructure team.

smurfxx’s picture

I thank you too @fizk!

Status: Fixed » Closed (fixed)

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

pipep’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.0-alpha3
Status: Closed (fixed) » Active

Hi, this is not fixed at all.

I have a Services View and when adding a Global PHP field, the view doesn't work anymore.

Even after alpha 3 views php broke the view completely.

Removing

/**
 * Implements hook_views_post_build().
 */
function views_php_views_post_build($view) {
  // Clear the limit and offset
  if (!empty($view->views_php) && !empty($view->build_info['query']) && is_object($view->build_info['query'])) {
    $view->build_info['query']->range();
  }
}

from views_php.module fixes the issue, so that it's definitely the problem.

While debugging I found that the process list on the db showed that the view wasn't filtering the number of specified items, and instead it was processing all of them, so it's the same problem still...

Thanks for the fix though !

Cheers.

fizk’s picture

Status: Active » Closed (fixed)

@pipep The committed fix seems to work for others. Can you please create a new issue for the issue you're seeing?

frosty29’s picture

I already had used the patch mentioned here from when I came across the problem some time ago. Had the problem again today using latest dev release - this time in a new view of custom entities (rather than nodes) and I had to do as #25 - comment out the clear of range. Can't shed any more light, sorry.

brian16803’s picture

Latest dev 2.x has this bug. It didn't become apparent right away though as many things were working fine still with my views elsewhere.

It really messed up my Views Rules. I even tried switching to Views Bulk Operations: Fetch a list of Ids -- as an alternate solution... and the problem still there.

I can confirm this is an issue for the 7.x-2.x-dev - 11/13/15. Was able to fix easily commenting out function views_php_views_post_build (like post #25). Thanks pipep - saved my day!

parasolx’s picture

I also confirm with the latest release the code comment in #25 is still there. Not sure why the code is there to unlock all the limit query done in first place.

However, removing the line code also didn't solved all problem. When using with pager, it didn't come out as Views PHP already override default range(). Currently I remove all PHP field in Views, and convert back using template override.