Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
drdzyk committed Dec 20, 2022
1 parent d3bdea0 commit 0d5cd3d
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/phpt/dl/1042_to_array_debug_reursion_limit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@ok
<?php
require_once 'kphp_tester_include.php';

class Chain {
public ?Chain $next = null;
}

function test_chain_objects() {
$obj = new Chain;
$obj->next = new Chain;
var_dump(instance_to_array($obj));
}

function test_max_depth_level() {
$obj = new Chain;
$ptr = $obj;
for ($i = 0; $i < 64; ++$i) {
$ptr->next = new Chain;
$ptr = $ptr->next;
}

// 64 lvl depth is ok
var_dump(count(instance_to_array($obj)));

$ptr->next = new Chain;

// allowed depth exceeded
var_dump(instance_to_array($obj));
}

test_chain_objects();
test_max_depth_level();

0 comments on commit 0d5cd3d

Please sign in to comment.