Skip to content
Permalink
Browse files

Fix #2116 - allow property set inside unserialize

  • Loading branch information...
muglug committed Sep 10, 2019
1 parent deb36e8 commit 8784812739777b2ec1a9acb2d540ae61918bf58f
@@ -628,7 +628,8 @@ public static function analyzeInstance(
&& ($appearing_property_class === $context->self
|| $codebase->classExtends($context->self, $appearing_property_class))
&& (!$context->calling_method_id
|| \strpos($context->calling_method_id, '::__construct'))
|| \strpos($context->calling_method_id, '::__construct')
|| \strpos($context->calling_method_id, '::unserialize'))

This comment has been minimized.

Copy link
@staabm

staabm Sep 10, 2019

Contributor

Does php magic __wakeup() also qualify for this case?

)
) {
if (IssueBuffer::accepts(
@@ -193,6 +193,32 @@ public function __toString()
}
}'
],
'allowPropertyAssignmentInUnserialize' => [
'<?php
/**
* @psalm-immutable
*/
class Foo implements \Serializable {
/** @var string */
private $data;
public function __construct() {
$this->data = "Foo";
}
public function serialize() {
return $this->data;
}
public function unserialize($data) {
$this->data = $data;
}
public function getData(): string {
return $this->data;
}
}'
],
];
}

0 comments on commit 8784812

Please sign in to comment.
You can’t perform that action at this time.