From cbfe1863e785cc7141e067eba9cfb14379473fd8 Mon Sep 17 00:00:00 2001
From: Roderik Muit <rm@wyz.biz>
Date: Sun, 28 Jul 2013 11:58:13 +0200
Subject: [PATCH] Make _features_sanitize() really remove all 'empty' values.

---
 features.export.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/features.export.inc b/features.export.inc
index d35317e..5ccb76a 100644
--- a/features.export.inc
+++ b/features.export.inc
@@ -951,7 +951,8 @@ function _features_linetrim($code) {
  */
 function _features_sanitize(&$array) {
   if (is_array($array)) {
-    if (_features_is_assoc($array)) {
+    $is_assoc = _features_is_assoc($array);
+    if ($is_assoc) {
       ksort($array, SORT_STRING);
       $array = array_filter($array);
     }
@@ -961,6 +962,9 @@ function _features_sanitize(&$array) {
     foreach ($array as $k => $v) {
       if (is_array($v)) {
         _features_sanitize($array[$k]);
+        if ($is_assoc && empty($array[$k])) {
+          unset($array[$k]);
+        }
       }
     }
   }
-- 
1.7.12.4 (Apple Git-37)

