Jump to:
| Project: | Drupal core |
| Version: | 6.15 |
| Component: | statistics.module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
Causes infamously familiar error:
preg_match() expects parameter 2 to be string, array given in .../includes/bootstrap/inc 777The full (and at times painful) diagnosis is at forum page: How diagnose: warning: preg_match() expects parameter 2 to be string, array given in .../includes/bootstrap.inc 777
The culprit seems to be statistics.module 85:
$links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 read', '@count reads');I switch Statistics 6.15 off, the warning vanishes; i switch it back on, the warning reappears.
So, does this mean that nobody has switched on the statistics.module for Drupal 6.15 ? Surely somebody must have noticed this one before the release of 6.15. And surely by now everybody who touches Drupal, let alone Drupal core, knows to avoid the infamous drupal_validate_utf8($text) problem.
Full backtrace (as much as Drupal coding style with so much hidden as string keys of arrays and hash parameters permits) attached as image.
I just spent hours on a goose chase because of this after an upgrade; please take the minutes needed to fix it.
Yes, truly annoyed, I can't stand the way Drupal is coded, it wastes my time, it frustrates me beyond belief, and in short, it make me (as a true UML0-driven Java fan) really hesitant to get any deeper involved in Drupal. Nearly all problems like this could be avoided if only Drupal would embrace some truly basic object-oriented practices, instead of insisting on throwing strings around as function names, and using vars instead of strings as array keys everywhere (and it is NOT more efficient, it's just stubborn),
Dr Darren Kelly (Webel IT Australia)
I run 5 Drupal sites; now why would I run more when this keeps happening ? I've just spent days unpaid debugging Drupal code and contributed messes, all of which could be avoided through proper object-orientation.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| ppi_BUG_validate_array_not_string.png | 95.99 KB | Ignored: Check issue status. | None | None |
Comments
#1
BTW nobody can say I just complain. I've helped solve many bugs in Drupal, and make very detailed reports, all on my own time. But god knows it need not be as hard as Drupal coding style makes it, it drives me nuts, and it simply turns me off contributing more to the Drupal community, because I find the coding style of drupal so bad to deal with and code against, and the API (so much of which is in fact only strings one has to magically know and pass as very loosely defined args) plain awful.
#2
If this was truly a bug in core, we'd have this bug reported much, much sooner. It's likely a contrib module messing with the links somehow. Try disabling your contrib modules group by group to help narrow it down to the problem.
#3
I get the same bug showing up and I have the statistics module turned off.
Here's the enabled modules I have on my site:
Site: dev1.chicagodrupalauthority.com
Install dir: /home/chicagodrupalauthority/webroot/drupal/dev1.chicagodrupalauthority.com
Drupal version: 6.17-dev (tag DRUPAL-6)
Installed non-Contrib Themes: equipsite
Installed non-Contrib Modules: format: : {modules active from that installation}
equipsite_com: equipsite_com
Installed Contrib Modules:
format: (): {modules active from that installation}
admin_menu (tag DRUPAL-6--3): admin_menu
adminblock (tag DRUPAL-6--1): adminblock
advanced_help (branch DRUPAL-6--1-2): advanced_help
better_formats (tag DRUPAL-6--1): better_formats
captcha (branch DRUPAL-6--2-0): captcha image_captcha
cck (tag DRUPAL-6--2): content number optionwidgets text
date (tag DRUPAL-6--2): date date_api date_popup date_timezone
fckeditor (tag DRUPAL-6--2): *NONE*
Installed library file: FCKeditor_2.6.5.tar.gz
filefield (branch DRUPAL-6--3-2): filefield
google_analytics (tag DRUPAL-6--2): googleanalytics
image_fupload (branch HEAD): image_fupload image_fupload_imagefield
imageapi (tag DRUPAL-6--1): imageapi imageapi_gd imageapi_imagemagick
imagecache (tag DRUPAL-6--2): imagecache
imagefield (branch DRUPAL-6--3-2): imagefield
imce (tag DRUPAL-6--1): imce
jquery_ui (tag DRUPAL-6--1): jquery_ui
login_destination (tag DRUPAL-6--2): login_destination
logintoboggan (tag DRUPAL-6--1): logintoboggan
page_title (tag DRUPAL-6--2): page_title
path_access (tag DRUPAL-6--1): path_access
pathauto (tag DRUPAL-6--1): pathauto
pngfix (tag DRUPAL-6--1): *NONE*
seo_checklist (tag DRUPAL-6--2): seochecklist
tableofcontents (tag DRUPAL-6--3): tableofcontents
thickbox (tag DRUPAL-6--1): thickbox
token (tag DRUPAL-6--1): token
transliteration (tag DRUPAL-6--3): transliteration
views (tag DRUPAL-6--2): views views_or views_ui
views_or (branch HEAD): views_or
webform (tag DRUPAL-6--2): webform
(cool report generated with 'drupalReport.sh status', part of my Drupal Script Library -- toddgee.com/drupalScripts)
#4
@toddg You have a broken contrib module. check_plain shouldn't get an array passed.
Please see #225211: warning: preg_match() expects parameter 2 to be string - SRSLY, WON'T FIX, EVER. for debugging steps and open an issue in the correct issue queue.