The default depth is large enough to cause stack overflows in
msan builds, though apparently only on old clang versions. Avoiding
a stack overflow there requires making the depth *much* smaller,
less than 1000. As I don't think that's reasonable for all the other
setups where 4k works fine, I'm just dropping this part of the test.
['max_depth' => 128]
));
-// Default depth is 4096
-echo "Default depth:\n";
-var_dump(unserialize(create_nested_data(4096, 'a:1:{i:0;', '}')) !== false);
-var_dump(unserialize(create_nested_data(4097, 'a:1:{i:0;', '}')));
-
// Depth can also be adjusted using ini setting
echo "Ini setting:\n";
ini_set("unserialize_max_depth", 128);
Notice: unserialize(): Error at offset 2834 of 2971 bytes in %s on line %d
bool(false)
-Default depth:
-bool(true)
-
-Warning: unserialize(): Maximum depth of 4096 exceeded. The depth limit can be changed using the max_depth unserialize() option or the unserialize_max_depth ini setting in %s on line %d
-
-Notice: unserialize(): Error at offset 36869 of 40974 bytes in %s on line %d
-bool(false)
Ini setting:
bool(true)