mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
853b7945bc
This issue has been resolved[1], so the tests are expected to pass on
Windows again.
[1] <0a03291b51
>
50 lines
943 B
PHP
50 lines
943 B
PHP
--TEST--
|
|
Bug #77345 (Segmentation faults stack overflow in cyclic garbage collector) (Bug #77427)
|
|
--INI--
|
|
zend.enable_gc = 1
|
|
--FILE--
|
|
<?php
|
|
|
|
class Node
|
|
{
|
|
/** @var Node */
|
|
public $previous;
|
|
/** @var Node */
|
|
public $next;
|
|
}
|
|
|
|
var_dump(gc_enabled());
|
|
var_dump('start');
|
|
|
|
function xxx() {
|
|
$firstNode = new Node();
|
|
$firstNode->previous = $firstNode;
|
|
$firstNode->next = $firstNode;
|
|
|
|
$circularDoublyLinkedList = $firstNode;
|
|
|
|
for ($i = 0; $i < 300000; $i++) {
|
|
$currentNode = $circularDoublyLinkedList;
|
|
$nextNode = $circularDoublyLinkedList->next;
|
|
|
|
$newNode = new Node();
|
|
|
|
$newNode->previous = $currentNode;
|
|
$currentNode->next = $newNode;
|
|
$newNode->next = $nextNode;
|
|
$nextNode->previous = $newNode;
|
|
|
|
$circularDoublyLinkedList = $nextNode;
|
|
}
|
|
}
|
|
|
|
xxx();
|
|
gc_collect_cycles();
|
|
|
|
var_dump('end');
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
string(5) "start"
|
|
string(3) "end"
|