Statistics 6.16

I spend many hours to isolate that bug. When access log is active in Statistics module, many strange behaviors occurs;
* When deactivating - activating the View module, a white page is displayed with a single error message line.
* All tests fails from the module SimpleTest, giving a strange error message containing HTML code and weird characters.

Everything is fine when access log is not active.

Comments

gaellafond’s picture

Title: SimpleTest fail all tests with Views and Access Log enabled » Access Log broke other features
Project: SimpleTest » Drupal core
Version: 6.x-2.10 » 6.16
Component: Code » statistics.module
StatusFileSize
new43.38 KB
new60.89 KB

I tried to look for a solution, but I can't find one. Now, the "deactivating - activating the View module" bug is gone (it was a bug with the cache I guess), but I still have a bug with the SimpleTest module.
In attachment:
with-access-log.png: SimpleTest run on itself, with "Enable access log" set to "Enabled" => Fatal error
without-access-log.png: SimpleTest run on itself, with "Enable access log" set to "Disabled" => Pass successfully
NOTE: If I deactivate the Views module and run a test with Access Log activated, I have no error.

I can reproduce this bug in all my Drupal installations. Maybe it's due to the extra DB call made by the access log module:
[...] Enabling the log adds one database call per page displayed by Drupal [...]
[http://drupal.org/handbook/modules/statistics]

gaellafond’s picture

Same error with last version of Views

I upgrade the module Views from 6.x-2.8 to 6.x-2.10 and now, when I run a test with access log enabled, I have a more descriptive error message:

An error occurred. /batch?id=117&op=do { "status": true, "percentage": 33, "message": "\x3cbr/\x3eProcessed test 1 of 3 - \x3cem\x3eMenu links\x3c/em\x3e.\x3cdiv class=\"simpletest-pass\"\x3eOverall results: 16 passes, 0 fails, and 0 exceptions\x3c/div\x3e\x3cdiv class=\"item-list\"\x3e\x3cul\x3e\x3cli class=\"first last\"\x3e\x3cdiv class=\"simpletest-pass\"\x3eMenu links: 16 passes, 0 fails, and 0 exceptions\x3c/div\x3e\x3c/li\x3e\n\x3c/ul\x3e\x3c/div\x3e" }<br /> <b>Fatal error</b>: Call to a member function override_option() on a non-object in <b>/home/[...]/www/sites/all/modules/views/modules/statistics.views_default.inc</b> on line <b>22</b><br />

The error occur when the method "override_option()" is called:

<?php
  $handler = $view->new_display('default', 'Defaults', 'default');
  $handler->override_option('fields', array(
    [...]
?>

The method $view->new_display() return a null value... Since I'm running a test, the view do not have to display anything. Maybe there is no display at all it that case...

I added a few block to check if the handler is null in the views_default.inc:

<?php
if (!is_null($handler)) {
  [...]
}
?>

and ended with the exact same error as before (view.inc on line 372).

gaellafond’s picture

Title: Access Log broke other features » SimpleTest fail all tests with Views and Access Log enabled
Project: Drupal core » SimpleTest
Version: 6.16 » 6.x-2.10
Component: statistics.module » Code

Seems to be a Bug in SimpleTest...

Environment:
OS: Ubuntu
DB: MySQL
PHP: 5.2.10-2ubuntu6.4
Drupal Core: 6.16
SimpleTest: 6.x-2.10
Views: 6.x-2.10

Just tell me if you need any more information.

gaellafond’s picture

Title: Access Log broke other features » Access Log with Views module make all SimpleTest fail

Bug cause:

I discover the real cause of the bug.

I think the workflow is pretty close to the following: When access log is enable, it log all page access by the Web site, including the pages requested during the tests. Access log is using Views when Views is enabled. When the test initialised, it request a page (using Ajax I guess, to run the test as a separate process), but Access Log is not able to log the page access because the Views module is not initialised in the context of the test. The error do not occur it the module Views is enabled in the test.

This result in a error that makes all tests to fail.

If
I disable Access Log from Administer > Reports > Access log settings
OR
I disable Views module
OR
I add Views on the test setUp function,
the test execute nicely.

  function setUp() {
    parent::setUp('views');
  }

I guess it's a Bug in access log after all.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.