|
@ -139,12 +139,13 @@ class Pack { |
|
|
* @return string | boolean |
|
|
* @return string | boolean |
|
|
*/ |
|
|
*/ |
|
|
public function unpack(string $pack) { |
|
|
public function unpack(string $pack) { |
|
|
$ret = unpack($this->makeFormat(true), $pack); |
|
|
|
|
|
|
|
|
|
|
|
if ($ret['type'] == self::DATA_TYPE_SAMPLE_DATA |
|
|
|
|
|
&& $ret['length'] == strlen($ret['data']) |
|
|
|
|
|
&& (int) $ret['length'] <= self::$packageMaxLength) { |
|
|
|
|
|
return $ret; |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
$ret = unpack($this->makeFormat(true), $pack); |
|
|
|
|
|
if ($ret['type'] === self::DATA_TYPE_SAMPLE_DATA && $ret['length'] == strlen($ret['data']) && (int) $ret['length'] <= self::$packageMaxLength) { |
|
|
|
|
|
return $ret; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
return false; |
|
|
} |
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|