When Classified Ads module is active, I get the message below. When I deactivate the module, I no longer get the message in the logs. To my untrained eye it looks like it could be a php4 vs php5 issue around how array merge works but that would require quite a few changes?

Invalid argument supplied for foreach() in /home/xxxxxxxx/public_html/includes/common.inc on line 1983.
array_merge() [function.array-merge]: Argument #2 is not an array in /home/xxxxxxxx/public_html/includes/common.inc on line 1952.

Drupal 5.7

Configuration file Protected
Cron maintenance tasks Last run 24 min 41 sec ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
GD library bundled (2.0.34 compatible)
JQuery Update Installed correctly
The current installed version of JQuery is 1.1.2
MySQL database 5.0.51a
PHP 5.2.5
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Web server Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.4mm

CommentFileSizeAuthor
#5 ed_classified-281747-1.patch506 bytesmilesgillham

Comments

mydllurth’s picture

A similar error issues in our Drupal 6.4 installation when visiting recent log entries after Classified Ads is enabled.

strtr() [function.strtr]: The second argument is not an array. in WEBROOT/includes/common.inc on line 806.
Invalid argument supplied for foreach() in WEBROOT/includes/common.inc on line 789.

The offending errors can be halted by changing line 784 of includes/common.inc (where log reports are tested for valid parameters).

$ diff common.inc.orig common.inc
784c784
>   if (empty($args)) {
---
<   if ((empty($args)) || (!is_array($args))) {

This change eliminates all error messages as a result of other modules passing invalid watchdog messages. However completely this patch is for eliminating those error messages, the root of the problem is not with watchdog; our adjustment merely masks evidence of other modules passing inappropriate parameters according to the documented Drupal API.

http://api.drupal.org/api/function/watchdog

function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {

_edi_wd() is inconsistent for the subsequent watchdog() function call.

/**
 * shortcut - log something to the watchdog log
 */
function _edi_wd($message, $severity = WATCHDOG_NOTICE, $link = NULL) {
  watchdog(EDI_CLASSIFIED_MODULE_NAME, $message, $severity, $link);
}

As the two code sections above show, the array parameter is missing. Skipping the $variables parameter is not the same as passing an empty array().

gauravkumar87’s picture

Version: 5.x-1.5-8 » 6.x-2.x-dev

I've faced the same issue after enabling the classifieds module.

mcurry’s picture

Priority: Normal » Critical

I'll work on a fix. Thanks for the background info.

jeweller’s picture

ed_classified_utils.inc

#357
+ watchdog(EDI_CLASSIFIED_MODULE_NAME, $message, NULL, $severity, $link);
- watchdog(EDI_CLASSIFIED_MODULE_NAME, $message, $severity, $link);

do not know, faithfully, but I have sent NULL in parameter $variables = array() - message disappeared

milesgillham’s picture

Status: Active » Needs work
StatusFileSize
new506 bytes

Alright, this would appear to be an answer.

milesgillham’s picture

Status: Needs work » Fixed

Patch has been applied to development branch.

Status: Fixed » Closed (fixed)

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