Changeset View
Changeset View
Standalone View
Standalone View
src/channel/PhutilPHPObjectProtocolChannel.php
Context not available. | |||||
*/ | */ | ||||
protected function encodeMessage($message) { | protected function encodeMessage($message) { | ||||
$message = serialize($message); | $message = serialize($message); | ||||
$len = pack('N', strlen($message)); | $len = pack('N', @strlen($message)); | ||||
return "{$len}{$message}"; | return "{$len}{$message}"; | ||||
} | } | ||||
Context not available. | |||||
$this->buf .= $data; | $this->buf .= $data; | ||||
$objects = array(); | $objects = array(); | ||||
while (strlen($this->buf) >= $this->byteLengthOfNextChunk) { | while (@strlen($this->buf) >= $this->byteLengthOfNextChunk) { | ||||
switch ($this->mode) { | switch ($this->mode) { | ||||
case self::MODE_LENGTH: | case self::MODE_LENGTH: | ||||
$len = substr($this->buf, 0, self::SIZE_LENGTH); | $len = @substr($this->buf, 0, self::SIZE_LENGTH); | ||||
$this->buf = substr($this->buf, self::SIZE_LENGTH); | $this->buf = @substr($this->buf, self::SIZE_LENGTH); | ||||
$this->mode = self::MODE_OBJECT; | $this->mode = self::MODE_OBJECT; | ||||
$this->byteLengthOfNextChunk = head(unpack('N', $len)); | $this->byteLengthOfNextChunk = head(unpack('N', $len)); | ||||
break; | break; | ||||
case self::MODE_OBJECT: | case self::MODE_OBJECT: | ||||
$data = substr($this->buf, 0, $this->byteLengthOfNextChunk); | $data = @substr($this->buf, 0, $this->byteLengthOfNextChunk); | ||||
$this->buf = substr($this->buf, $this->byteLengthOfNextChunk); | $this->buf = @substr($this->buf, $this->byteLengthOfNextChunk); | ||||
$obj = @unserialize($data); | $obj = @unserialize($data); | ||||
if ($obj === false) { | if ($obj === false) { | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0