[Sungrazr-svn] [99] Sungrazr_Server_Adapter_JsonRpc: [CHG] Confirm that parameter elements are all objects, as per JSON-RPC 1.0 spec.

0 views
Skip to first unread message

cl...@killersoft.com

unread,
Dec 18, 2007, 6:15:30 PM12/18/07
to Sungra...@googlegroups.com
Revision
99
Author
clay
Date
2007-12-18 15:15:30 -0800 (Tue, 18 Dec 2007)

Log Message

Sungrazr_Server_Adapter_JsonRpc: [CHG] Confirm that parameter elements are all objects, as per JSON-RPC 1.0 spec.

Modified Paths

Diff

Modified: trunk/Sungrazr/Server/Adapter/JsonRpc.php (98 => 99)


--- trunk/Sungrazr/Server/Adapter/JsonRpc.php	2007-12-18 23:14:42 UTC (rev 98)
+++ trunk/Sungrazr/Server/Adapter/JsonRpc.php	2007-12-18 23:15:30 UTC (rev 99)
@@ -339,12 +339,24 @@
      */
     protected function _validateParameterType()
     {
+        // params should be an array
         if (! is_array($this->params)) {
             return $this->fault(
                 "JSON-RPC expects \"params\" to be an array of objects.",
                 400
             );
         }
+        
+        // each element of params should be an object
+        foreach ($this->params as $param) {
+            if (! is_object($param)) {
+                return $this->fault(
+                    "JSON-RPC expects \"params\" to be an array of objects.",
+                    400
+                );                
+            }
+        }
+        
         return true;        
     }
     
Reply all
Reply to author
Forward
0 new messages