Код вполне себе такой:
<?php
class a
{
public function getNewB()
{
$b = new b();
$b->a = $this;
return $b;
}
}
class b
{
public $a = null;
public $b = null;
}
class x
{
public static $a = null;
public static $b = null;
public static function foo()
{
self::$a = new a();
self::$b = self::$a->getNewB();
self::bar(self::$b);
}
public static function bar($b)
{
$b->b = self::$a->getNewB();
self::bar($b->b);
}
}
x::foo();
~$ php test.php
Segmentation fault
Про окружение:
~$ php -v
PHP 5.6.22-0+deb8u1 (cli) (built: Jun 13 2016 07:55:54)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
~$ cat /etc/debian_version
8.5