Index: core/amf/io/AMFSerializer.php
===================================================================
--- core/amf/io/AMFSerializer.php	(revision 6)
+++ core/amf/io/AMFSerializer.php	(working copy)
@@ -986,8 +986,31 @@
 	function writeAmf3ByteArray($d)
 	{
 		$this->writeByte(0x0C);
-		$this->writeAmf3String($d, true);
+		$this->writeAmf3ByteArrayBody($d);
 	}
+	
+	function writeAmf3ByteArrayBody($d)
+	{
+		if( ($key = patched_array_search($d, $this->storedObjects, TRUE)) === FALSE && $key === FALSE )
+		{
+			if(count($this->storedObjects) < MAX_STORED_OBJECTS)
+			{
+				$this->storedObjects[] = & $d;
+			}
+			
+			$this->storedDefinitions++;
+			
+        	$obj_length = strlen( $d );
+        	$this->writeAmf3Int( $obj_length << 1 | 0x01 );
+        	$this->outBuffer .= $d;
+		}
+		else
+		{
+			$handle = $key << 1;
+			$this->writeAmf3Int($handle);
+		}
+	}	
+	
 
 	function writeAmf3Object($d)
 	{

