-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
类定义:
class Foo
{
protected $relations = [];
protected $name = 2;
/**
* Set the specific relationship in the model.
*
* @param string $relation
* @param mixed $value
* @return $this
*/
public function setRelation($relation, $value)
{
$this->relations[$relation] = $value;
return $this;
}
}
序列化方法
function encode($result)
{
$stream = new BytesIO();
$writer = new Writer($stream, false);
$stream->write(Tags::TagResult);
if (0 === ResultMode::Serialized) {
$stream->write($result);
}
else {
$writer->reset();
$writer->serialize($result);
}
$data = $stream->toString();
return $data;
}
调用:
$foo = new Foo();
$foo_2 = new Foo();
$foo->setRelation('sublabel', [$foo_2]);
var_dump(encode($foo));
会触发Segmentation fault, 调试了一下,里面的循环会影响到外面循环的nInternalPointer, 没再继续研究, 求助大佬帮忙看一下……^_^
(环境: php: 7.1.6, hprose: master版本也可以复现)
Metadata
Metadata
Assignees
Labels
No labels