protected function rebuildPickleParts($pickleSection, array $dsos_add, array $dsos_del = array())
{
$lines = explode("\n", $pickleSection);
$new = [];
$names = array();
foreach ($dsos_add as $dso) {
$new[] = $this->buildDsoIniLine($dso);
}
foreach ($lines as $l) {
$l = trim($l);
if (0 !== strpos($l, 'hhvm.pickle_extensions[')) {
continue;
}
list(, $dllname) = explode('=', $l);
if (in_array(trim($dllname), $dsos_add)) {
/* don't create a duplicated item */
continue;
}
if (in_array(trim($dllname), $dsos_del)) {
/* don't restore as it should be deleted */
continue;
}
$new[] = $l;
}
return implode("\n", $new);
}