reeze/php-leveldb

PHP7 branch: Segfault when `include`ing a file after closing a DB

dktapps opened this issue · 1 comments

I'm using https://github.com/pmmp/leveldb-mcpe/tree/linux-compile to use Minecraft Pocket Edition worlds on a PocketMine-MP server, and been encountering a few irritating segfaults. I've spent a while debugging the issue, and gotten it down to the test case below:

test.php

<?php

$db = new \LevelDB("db");
$db->close();
include("dummy.php");

dummy.php

<?php

class A extends \stdClass{}

The above test case will produce a segmentation fault when running test.php.

PHP: 7.0.19 ZTS DEBUG
PHP-LevelDB: 5d05f06
OS: Windows 10 and Ubuntu 17.04 (reproduced on both)

Seems that the pthreads extension is involved with this issue. Without pthreads this issue does not seem to occur.