PHPUnit Segmentation fault

后端 未结 13 786
故里飘歌
故里飘歌 2020-12-28 14:56

When a PHPUnit test fails normally on my dev box (Linux Mint), it causes a \"Segmentation Fault\" on my Continous Integration box (Centos). Both machines are running the sam

13条回答
  •  既然无缘
    2020-12-28 15:36

    if you have an object with property pointing to the same object, or other sort of pointer loops, you will have this message while running

    serialize($object);
    

    And if you are a Laravel user, and you are dealing with models. And if you think, you will never have this problem, because you avoiding pointer loops by using $hidden property on your models, please be advised, the $hidden property does not affect serialize, it only affects casting to JSON and array.

    I had this problem, when I had a model saved into a property of a Mailable object.

    fixed with

    $this->model->refresh(); 
    

    in a __construct method , just before the whole object is serialized.

提交回复
热议问题