Fix packet password on exports, move __unserialize() to EncodeUTF8::decode
This commit is contained in:
@@ -200,9 +200,9 @@ class Message extends FTNBase
|
||||
* Parse a message from a packet
|
||||
*
|
||||
* @param string $msg
|
||||
* @param Domain|null $domain
|
||||
* @param Zone|null $zone
|
||||
* @return Message
|
||||
* @throws InvalidPacketException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function parseMessage(string $msg,Zone $zone=NULL): self
|
||||
{
|
||||
@@ -402,34 +402,7 @@ class Message extends FTNBase
|
||||
*/
|
||||
public function __unserialize(array $values): void
|
||||
{
|
||||
$properties = (new \ReflectionClass($this))->getProperties();
|
||||
|
||||
$class = get_class($this);
|
||||
|
||||
foreach ($properties as $property) {
|
||||
if ($property->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $property->getName();
|
||||
$decode = in_array($name,self::cast_utf8);
|
||||
|
||||
if ($property->isPrivate()) {
|
||||
$name = "\0{$class}\0{$name}";
|
||||
} elseif ($property->isProtected()) {
|
||||
$name = "\0*\0{$name}";
|
||||
}
|
||||
|
||||
if (! array_key_exists($name, $values)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
$property->setValue(
|
||||
$this, $decode ? utf8_decode($values[$name]) : $values[$name]
|
||||
);
|
||||
}
|
||||
$this->decode($values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user