warning: Invalid argument supplied for foreach() in...

deemuzi - March 7, 2008 - 13:09
Project:Resource Conflict
Version:5.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:deemuzi
Status:closed
Description

there is empty variable $conflict->{$field} when you use more then one resource conflict contents, or maybe it depends on my module configuration

patch:

        foreach($fields as $field) {
          foreach($node->{$field} as $instance) {
            foreach ($overlap_nodes as $conflict) {
 
  // my code :) don't ask me why ;))
  if (empty($conflict->{$field})) { continue; }
 
              foreach($conflict->{$field} as $conflict_instance) {
                if ($instance['nid'] == $conflict_instance['nid']) {
                  $booked_resource = node_load($instance['nid']);
                  form_set_error('Resource Conflict',
                    t('There is a resource conflict. "%resource" is currently booked. Please choose a different time or a different resource.',
                      array('%resource' => $booked_resource->title)));
                }
              }
            }
          }
        }

#1

deviantintegral - April 22, 2008 - 17:04
Status:active» postponed (maintainer needs more info)

Did you have this problem on your testing site as well? Anyone else having this issue?

Thanks,
--Andrew

#2

gnucifer - April 27, 2008 - 10:01

I have this problem aswell, as you say the problem should arise when other event-enabled contenttypes are missing the same node reference field as in the current node. Thanks for the patch by the way!

#3

deviantintegral - June 28, 2008 - 17:35
Status:postponed (maintainer needs more info)» fixed

I've committed this in CVS 124098 to the -dev version. In the future, be sure to follow the patching guidelines for drupal.

Thanks!
--Andrew

#4

Anonymous (not verified) - July 12, 2008 - 17:44
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.