public static function getLV(&$p, $l = 1, $nul = false, $lrev = false)
    {
        $s = static::b2i(mb_orig_substr($p, 0, $l), !!$lrev);
        $p = mb_orig_substr($p, $l);
        if ($s === 0) {
            return '';
        }
        $r = '';
        if (mb_orig_strlen($p) < $s) {
            Daemon::log('getLV error: buf length (' . mb_orig_strlen($p) . '): ' . Debug::exportBytes($p) . ', must be >= string length (' . $s . ")\n");
        } elseif ($nul) {
            $lastByte = mb_orig_substr($p, -1);
            if ($lastByte !== "\x00") {
                Daemon:
                log('getLV error: Wrong end of NUL-string (' . Debug::exportBytes($lastByte) . '), len ' . $s . "\n");
            } else {
                $d = $s - 1;
                if ($d < 0) {
                    $d = 0;
                }
                $r = mb_orig_substr($p, 0, $d);
                $p = mb_orig_substr($p, $s);
            }
        } else {
            $r = mb_orig_substr($p, 0, $s);
            $p = mb_orig_substr($p, $s);
        }
        return $r;
    }