For node types that don't enable any location fields, the following code (near line 222) is problematic:

case 'insert':
case 'update':
      $posted_location = $_POST['edit']['location'];
      foreach ($posted_location as $posted_field => $posted_value) ...

If $_POST['edit']['location'] is unset (as will happen if no location forms are enabled), then we get an invalid argument error on the foreach statement. I've corrected this by inserting an additional condition before the foreach:

if (count($posted_location)) {
foreach ($posted_location as $posted_field => $posted_value) ...

This will keep the foreach, or any of the other nodeapi code, from being run if $_POST['edit']['location'] has 0 elements to it.

If you implement this fix, be sure to close the additional bracket you open!

CommentFileSizeAuthor
#1 location.module_0.diff6.7 KBankur

Comments

ankur’s picture

StatusFileSize
new6.7 KB

Thanks josh. Here's the patch I commited.

Anonymous’s picture