Skip to content

Instantly share code, notes, and snippets.

@mente
Last active October 6, 2016 18:02
Show Gist options
  • Save mente/e8e4bd6bf3ba11d2a75ff5a5a4ae73e1 to your computer and use it in GitHub Desktop.
Save mente/e8e4bd6bf3ba11d2a75ff5a5a4ae73e1 to your computer and use it in GitHub Desktop.
igbinary segfault reproduce on php7
<?php
$result = [];
for ($i = 0; $i < 40; $i++) {
$inner = new stdClass;
$inner->a = $i % 25;
$result[0][$inner->a][$i] = $inner;
$result[1][] = $inner;
}
igbinary_unserialize(igbinary_serialize($result));
@mente
Copy link
Author

mente commented Oct 6, 2016

With 10 items it doesn't segfault

@mente
Copy link
Author

mente commented Oct 6, 2016

If replace

$result[1][] = $inner;

with

$result[1][] = clone $inner;

it does not segfault either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment