Project:Quickstats
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi everyone !

I have a little problem with this module.
I'm using OG Group, and flashvideos(videos for the group for sure... :D).
When I activate de QuickStats module, i have this error

warning: preg_match() expects parameter 2 to be string, array given in /var/www/html/includes/bootstrap.inc on line 771

Any advice to solve the problem?

See ya ;)

Comments

#1

Do you get this when you visit specific pages? Related to OG maybe?

#2

I do not have any OG modules and got the error using Quickstats.

I had Quickstats activated for a few weeks and did not see the error. Then I tried to run the patch to make Quickstats available to Views, templates, etc.

Running the included patch does not work on 6.10 node.module, so I tried to hack node.module myself to get a node_load to return the quickstats_views field.

I had to undo the node.module hack and disable, then uninstall quickstats entirely to get the error to go away.

I've seen a lot of issue queues report this error regarding various contrib modules. It's not just Quickstats that runs afoul of this bootstrap error.

This is the line in bootstrap by the way:

<?php
function drupal_validate_utf8($text) {
  if (
strlen($text) == 0) {
    return
TRUE;
  }
  return (
preg_match('/^./us', $text) == 1); // THIS is line 771
}
?>

Again, simply un-doing the changes I made to node.module seemed to have no effect. The error continued until I removed Quickstats entirely.

#3

I have the same error.
when I start the statistics module and enabled the popular block!

#4

Still haven't figured out how Quickstats triggers it.

On the good side, I figured out how the Quickstats module could be changed to not require the node.module patch. Node.module used to retrieve specific data fields for a node_load by listing them in a SQL call - which is the call the patch alters, by adding quickstats_views to the list of fields being loaded.

The more recent node.module just calls all fields in node table (SELECT *) for a node_load, using the node table schema. To get the quickstats_views field in there, the quickstats.install file needs a schema hook to add the field into the default node schema, which in turn is used for the node_load function.

However, even finding an alternative to patching the node.module directly, the preg_match error still shows up.

It's not like there aren't other integer fields in the node table, so I don't know why preg_match has a problem. I'll try to trap specifically what it doesn't like. Might be a few days before I get to it.

#5

Thanks ccshannon - I don't have a clue of what could be causing this either, its not like the module is doing complicated things with the node table.

#6

I also get the same error can someone please help?

#7

It is triggered because the core Statistics module is in conflict with Quickstats and duplicate entries are created.

You've got 2 options until this is fixed :

1) Don't use the core Statistics module (and any modules that are based on that). You should disable the module AND uninstall it to delete the stats that it created

2) Don't use the quickstats module and use the core Statistics instead

#8

You are using the wrong key in your hook_link implementation:

<?php
$links
['statistics_counter']['title'] = format_plural($statistics['quickstats_views'], '1 read', '@count reads');
?>

This will then be passed back to module_invoke_all and recursively merged into the results (this might classify as a core bug).

Instead, use hook_link_alter, or use quickstat_statistics_counter as key.

#9

Thanks Heine for tracking this down, I was left totally puzzled by this one for a long time. I'll try to fix this asap.

#10

hi,

i'm having the same problem.
htmlspecialchars() expects parameter 1 to be string,array given in includes\bootstrap.inc on line 856.

so, is there a solution for it? or only #7?

nobody click here