Looking for some pointers as to what might be causing the following warning messages upon enabling Views module?
I've been trying to customize an addressbook module based on someone's code available here http://www.plaatsoft.nl/wiibrew/addressbook/
In the essence, the code runs without any issues on its own. As soon as I would enable "Views" module, I get the following errors and the Views module starts acting weird... So it seems as if there is some collision happening since each module works fine on it's own.
While the addressbook module was initially developed for Drupal 5.x, I used the Deadwood module to help convert the module to 6.x platform.
Here are the warning messages I get:
* warning: Invalid argument supplied for foreach() in /htdocs/includes/common.inc on line 3298.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /htdocs/includes/common.inc on line 3180.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /htdocs/includes/common.inc on line 3180.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /htdocs/includes/common.inc on line 3180.
* warning: array_merge() [function.array-merge]: Argument #1 is not an array in /htdocs/includes/common.inc on line 3180.
warning: Invalid argument supplied for foreach() in /usr/local/apache2/htdocs/sandbox.soroki.com/includes/common.inc on line 3298.
3287 /**
3288 * Fill in required default values for table definitions returned by hook_schema().
3289 *
3290 * @param $module
3291 * The module for which hook_schema() was invoked.
3292 * @param $schema
3293 * The schema definition array as it was returned by the module's
3294 * hook_schema().
3295 */
3296 function _drupal_initialize_schema($module, &$schema) {
3297 // Set the name and module key for all tables.
3298 foreach ($schema as $name => $table) {
3299 vsm_trace();
3300 if (empty($table['module'])) {
3301 $schema[$name]['module'] = $module;
3302 }
3303 if (!isset($table['name'])) {
3304 $schema[$name]['name'] = $name;
3305 }
3306 }
3307 }
warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/local/apache2/htdocs/sandbox.soroki.com/includes/common.inc on line 3180.
3151 /**
3152 * Get the schema definition of a table, or the whole database schema.
3153 *
3154 * The returned schema will include any modifications made by any
3155 * module that implements hook_schema_alter().
3156 *
3157 * @param $table
3158 * The name of the table. If not given, the schema of all tables is returned.
3159 * @param $rebuild
3160 * If true, the schema will be rebuilt instead of retrieved from the cache.
3161 */
3162 function drupal_get_schema($table = NULL, $rebuild = FALSE) {
3163 static $schema = array();
3164
3165 if (empty($schema) || $rebuild) {
3166 // Try to load the schema from cache.
3167 if (!$rebuild && $cached = cache_get('schema')) {
3168 $schema = $cached->data;
3169 }
3170 // Otherwise, rebuild the schema cache.
3171 else {
3172 $schema = array();
3173 // Load the .install files to get hook_schema.
3174 module_load_all_includes('install');
3175
3176 // Invoke hook_schema for all modules.
3177 foreach (module_implements('schema') as $module) {
3178 $current = module_invoke($module, 'schema');
3179 _drupal_initialize_schema($module, $current);
3180 $schema = array_merge($schema, $current);
3181 vsm_trace();
3182 }
3183
3184 drupal_alter('schema', $schema);
3185 cache_set('schema', $schema);
3186 }
3187 }
3188
3189 if (!isset($table)) {
3190 return $schema;
3191 }
3192 elseif (isset($schema[$table])) {
3193 return $schema[$table];
3194 }
3195 else {
3196 return FALSE;
3197 }
3198 }
Here is my setup:
Drupal core 6.13
Views 6.x-2.x-dev
PHP 5.2.9
Apache/2.2.11
If I missed any details, please let me know.
Thanks in advance!
Comments
Comment #1
dave reidCould you post into pastebin the code from your modified addressbook.install file?
Comment #2
mike15 commentedSure. Here it is: http://pastebin.com/m2159618c
thanks!
Comment #3
dawehnerif you don't have a $schema remove your hook_scheme or return an empty array;
in your hook_schema $schema is null.
Comment #4
mike15 commentedThank you very much @dereine for pointing me in the right direction
Removing it fixed my issue
- Mike