示例#1
0
	/**
	 * @todo Is the reference still needed? PHP4 needed it for objects, but PHP5 always
	 * passes objects by reference. And PHP5 uses a copy-on-write approach, so that all
	 * values are passed as "reference", in case no changes take place.
	 *
	 * @todo no type markers ("\6", for example) in this method!
	 */
	protected function writeAmf3Data(& $d) {
		if (is_int($d)) { //int
			$this->writeAmf3Number($d);
			return;
		} elseif (is_float($d)) { //double
			$this->outBuffer .= "\5";
			$this->writeDouble($d);
			return;
		} elseif (is_string($d)) { // string
			$this->outBuffer .= "\6";
			$this->writeAmf3String($d);
			return;
		} elseif (is_bool($d)) { // boolean
			$this->writeAmf3Bool($d);
			return;
		} elseif (is_null($d)) { // null
			$this->writeAmf3Null();
			return;
		} elseif (AmfUtil::is_undefined($d)) { // undefined
			$this->writeAmf3Undefined();
			return;
		} elseif (AmfUtil::is_date($d)) { // date
			$this->writeAmf3Date($d);
			return;
		} elseif (is_array($d)) { // array
			$this->writeAmf3Array($d);
			return;
		} elseif (AmfUtil::is_byteArray($d)) { //byte array
			$this->writeAmf3ByteArray($d->data);
			return;
		} elseif (AmfUtil::is_Xml ($d)) { // Xml
			$this->writeAmf3Xml($d);
			return;
		} elseif (AmfUtil::is_XmlDocument ($d)) { // XmlDoc
			$this->writeAmf3XmlDocument($d);
			return;
		} elseif (is_object($d)) {
			$this->writeAmf3Object($d);
			return;
		}
		throw new RemotingException("couldn't write object " . print_r($d, false));
	}
    /**
     * looks at the outgoing packet and sets the explicit type field so that the serializer sends it properly
     * @param mixed $deserializedResponse
     * @return mixed
     */
    public function filterDeserializedResponse($deserializedResponse){
        $deserializedResponse = AmfUtil::applyFunctionToContainedObjects($deserializedResponse, array($this, "markExplicitType"));
        return $deserializedResponse;

    }
示例#3
0
	/**
	 * readDouble reads the floating point value from the bytes stream and properly orders
	 * the bytes depending on the system architecture.
	 *
	 * @return float The floating point value of the next 8 bytes
	 */
	protected function readDouble(){
		$bytes = substr($this->rawData, $this->currentByte, 8);
		$this->currentByte += 8;
		if (AmfUtil::isSystemBigEndian()){
			$bytes = strrev($bytes);
		}
		$zz = unpack("dflt", $bytes); // unpack the bytes
		return $zz['flt']; // return the number from the associative array
	}
示例#4
0
    /**
     * looks at the response and sets the explicit type field so that the serializer sends it properly
     * @param mixed $deserializedResponse
     * @return mixed
     */
    public function filterDeserializedResponse($deserializedResponse){
        $deserializedResponse = AmfUtil::applyFunctionToContainedObjects($deserializedResponse, array($this, "convertStringFromPhpToClientCharsets"));
        return $deserializedResponse;

    }