Hello,

I just created a test site to test my hypothesis that Views Calc breaks after changing to PHP 5.3 from PHP 5.2. This is how you can recreate the problem:

- I am using Acquia Dev Desktop 1.2.39 that comes with the PHP version selector. I installed Drupal 6.26 using PHP 5.2.
- Installed only the necessary modules to get Views and Views Calc running with Devel Generate to generate spoof page nodes (type=node).
- Generated 1000 pages (type=node) without deleting earlier contents. Limited only 3 words for the title.
- Set Views Calc to allow MySQL's count. Added it under Views Calc's settings.
- Added a Views Calc field with the mentioned MySQL command (COUNT(*)). Type set to 'integer'.
- Made a default view with an exposed 'starts with' title filter, just for the sake of testing the functionality of Views Calc of returning result count. Enabled pager. Added fields node title and node body.
- Added a 'page' display. Set a path.
- Added an 'attachment' display. Set to inherit arguments and exposed filters, do not inherit pager and render pager. Position it before the 'page' display so that it will be displayed at the top of the 'page' display.
- Set to override the fields of the 'attachment' display. Removed the fields node title and node body. Added Views Calc COUNT(*) that I added before. Rewrote the output to '[cid1] results found'. Hide it if result set is empty. Other settings left as it was.
- Save the view. Now test the page, it should display 1000 results found. Type 'm' at the exposed filter, it should display how many nodes which the title starts with 'm'.
- Back to Acquia Dev Desktop, now change it to use PHP 5.3. Restart the engine. The error below should be thrown right in front.

warning: intval() expects parameter 2 to be long, string given in C:\Users\Anonymous\Documents\acewebworks\wwwroot\acewebworks\sites\all\modules\views_calc\views_calc_field_handler.inc on line 94.

This is the only thing that breaks all my other views that uses Views Calc. I tested under many other circumstances like dumping MySQL database, changing MySQL version, Drupal core, Views and whatnot. It only breaks after changing to PHP 5.3.

Comments

amal850720’s picture

Anyway, worked around the problem by inserting below PHP code in the view's header:

  $view = views_get_current_view();
  print $view->total_rows; 
KarenS’s picture

Status: Active » Closed (won't fix)

The D6 version is no longer supported.