1--TEST-- 2GH-15169 (stack overflow when var serialization in ext/standard/var) 3--SKIPIF-- 4<?php 5if (ini_get('zend.max_allowed_stack_size') === false) { 6 die('skip No stack limit support'); 7} 8if (getenv('SKIP_ASAN')) { 9 die('skip ASAN needs different stack limit setting due to more stack space usage'); 10} 11?> 12--INI-- 13zend.max_allowed_stack_size=512K 14--FILE-- 15<?php 16class Node 17{ 18 public $next; 19} 20$firstNode = new Node(); 21$node = $firstNode; 22for ($i = 0; $i < 30000; $i++) { 23 $newNode = new Node(); 24 $node->next = $newNode; 25 $node = $newNode; 26} 27 28try { 29 serialize($firstNode); 30} catch (Error $e) { 31 echo $e->getMessage(), "\n"; 32} 33 34while ($next = $firstNode->next) { 35 $firstNode->next = $next->next; 36} 37 38?> 39--EXPECTF-- 40Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? 41