You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/09/10 14:11:57 UTC

svn commit: r693810 - in /incubator/shindig/trunk/php/src/social-api/converters: OutputAtomConverter.php OutputXmlConverter.php

Author: chabotc
Date: Wed Sep 10 05:11:56 2008
New Revision: 693810

URL: http://svn.apache.org/viewvc?rev=693810&view=rev
Log:
Enums can have empty keys, don't make the xml/atom converters crash on that :)

Modified:
    incubator/shindig/trunk/php/src/social-api/converters/OutputAtomConverter.php
    incubator/shindig/trunk/php/src/social-api/converters/OutputXmlConverter.php

Modified: incubator/shindig/trunk/php/src/social-api/converters/OutputAtomConverter.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/converters/OutputAtomConverter.php?rev=693810&r1=693809&r2=693810&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/converters/OutputAtomConverter.php (original)
+++ incubator/shindig/trunk/php/src/social-api/converters/OutputAtomConverter.php Wed Sep 10 05:11:56 2008
@@ -268,11 +268,12 @@
 			}
 		} elseif (is_object($data)) {
 			if ($data instanceof Enum) {
-				// enums are output as : <NAME key="$key">$displayValue</NAME> 
-				$keyEntry = $newElement->appendChild($this->doc->createAttribute('key'));
-				$keyEntry->appendChild($this->doc->createTextNode($data->key));
-				$newElement->appendChild($this->doc->createTextNode($data->getDisplayValue()));
-			
+				if (isset($data->key)) {
+					// enums are output as : <NAME key="$key">$displayValue</NAME> 
+					$keyEntry = $newElement->appendChild($this->doc->createAttribute('key'));
+					$keyEntry->appendChild($this->doc->createTextNode($data->key));
+					$newElement->appendChild($this->doc->createTextNode($data->getDisplayValue()));
+				}			
 			} else {
 				$vars = get_object_vars($data);
 				foreach ($vars as $key => $val) {

Modified: incubator/shindig/trunk/php/src/social-api/converters/OutputXmlConverter.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/converters/OutputXmlConverter.php?rev=693810&r1=693809&r2=693810&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social-api/converters/OutputXmlConverter.php (original)
+++ incubator/shindig/trunk/php/src/social-api/converters/OutputXmlConverter.php Wed Sep 10 05:11:56 2008
@@ -167,11 +167,12 @@
 			}
 		} elseif (is_object($data)) {
 			if ($data instanceof Enum) {
-				// enums are output as : <NAME key="$key">$displayValue</NAME> 
-				$keyEntry = $newElement->appendChild($this->doc->createAttribute('key'));
-				$keyEntry->appendChild($this->doc->createTextNode($data->key));
-				$newElement->appendChild($this->doc->createTextNode($data->getDisplayValue()));
-			
+				if (isset($data->key)) {
+					// enums are output as : <NAME key="$key">$displayValue</NAME>
+					$keyEntry = $newElement->appendChild($this->doc->createAttribute('key'));
+					$keyEntry->appendChild($this->doc->createTextNode($data->key));
+					$newElement->appendChild($this->doc->createTextNode($data->getDisplayValue()));
+				}			
 			} else {
 				$vars = get_object_vars($data);
 				foreach ($vars as $key => $val) {