From e88459ca9ffb82e6777c4b08d0f7e28b6a25bd3f Mon Sep 17 00:00:00 2001
From: alvaro <alvaro@alia.(none)>
Date: Thu, 5 Apr 2012 16:35:03 -0700
Subject: [PATCH] Improvind Length filter by including number of vars in object

---
 lib/Haanga/lib/Haanga/Extension/Filter/Length.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Length.php b/lib/Haanga/lib/Haanga/Extension/Filter/Length.php
index d0fb5262..952f377c 100644
--- a/lib/Haanga/lib/Haanga/Extension/Filter/Length.php
+++ b/lib/Haanga/lib/Haanga/Extension/Filter/Length.php
@@ -7,6 +7,7 @@ class Haanga_Extension_Filter_Length
     {
         $count  = hexec('count', $args[0]);
         $strlen = hexec('strlen', $args[0]);
+        $vars   = hexec('count', hexec('get_object_vars', $args[0]));
         $guess  = hexpr_cond(hexec('is_array', $args[0]), hexec('count', $args[0]),
                             hexec('strlen', $args[0]));
 
@@ -18,8 +19,10 @@ class Haanga_Extension_Filter_Length
                 return $count;
             } else if  (is_string($value)) {
                 return $strlen;
+            } else if  (is_object($value)) {
+                return $vars;
             } else {
-                return $guess;
+                return $gess;
             }
         }
 
-- 
GitLab