mikeytown2’s picture

Status:Active» Needs review
1.28 KB

also includes a whitespace fix

mikeytown2’s picture

2.35 KB
rooby’s picture

Status:Needs review» Fixed

Fixed in all branches.
I also added isset() checks for other elements of the location so that we never get undefined index notifications for anything in template_preprocess_location().

+++ plugins/contexts/	7 Oct 2010 23:27:25 -0000
@@ -48,15 +48,21 @@ function location_context_create_locatio
   if ($conf) {
     $lid = is_array($data) && isset($data['lid']) ? $data['lid'] : (is_object($data) ? $data->lid : 0);
     if (is_array($data) || !empty($reload)) {
-      $nid = $data['nid'];
+      if (isset($data['nid'])) {
+        $nid = $data['nid'];
+      }
       $data = location_load_location($lid);
-      $data['nid'] = $nid;
+      if (isset($nid)) {
+        $data['nid'] = $nid;
+      }
   if (!empty($data))  {
     $context->data = $data;
-    $context->title = $data['city'];
+    if (!empty($data['city'])) {
+      $context->title = $data['city'];
+    }
     $context->argument = $data['lid'];
     return $context;

Also, this section is not related to this issue so was not included in this fix.
If it is fixing some other problem please open a separate issue for that (if there is not already one).

Powered by Dreditor.

bdragon’s picture

Status:Fixed» Active


Please revert your additions to the commit. You introduced a bug in the line 1536 band (breaking the 'coords' "magic" key). It's only unsafe to unset deep into arrays without checks, and isset() checks are not needed when doing an empty() check.

rooby’s picture

Whoops sorry, I'll get that one later today.

rooby’s picture

Status:Fixed» Closed (fixed)

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

bdlangton’s picture

Just putting a patch out there that is a combination of the two commits already made to the codebase.