{"record":{"id":"197cce7016eed660","repo":"lionsoul2014/ip2region","slug":"invalid-xdb-structure-version-header-version-197cce","errorCode":null,"errorMessage":"invalid xdb structure version `{$header['version']}`","messagePattern":"invalid xdb structure version `(.+?)`","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"binding/php/xdb/Searcher.class.php","lineNumber":90,"sourceCode":"        if ($name == \"V4\" || $name == \"IPv4\") {\n            return IPv4::default();\n        } else if ($name == \"V6\" || $name == \"IPv6\") {\n            return IPv6::default();\n        } else {\n            throw new Exception(\"invalid verstion name `{$ver_name}`\");\n        }\n    }\n\n    // version parse from header\n    public static function versionFromHeader($header) {\n        // Old structure 2.0 with IPv4 supports ONLY\n        if ($header['version'] == Structure_20) {\n            return IPv4::default();\n        }\n\n        // structure 3.0 after IPv6 supporting\n        if ($header['version'] != Structure_30) {\n            throw new Exception(\"invalid xdb structure version `{$header['version']}`\");\n        }\n\n        if ($header['ipVersion'] == IPv4VersionNo) {\n            return IPv4::default();\n        } else if ($header['ipVersion'] == IPv6VersionNo) {\n            return IPv6::default();\n        } else {\n            throw new Exception(\"invalid ip version number `{$header['ipVersion']}`\");\n        }\n    }\n\n    // binary string chars implode with space\n    public static function bytesToString($buff, $offset, $length) {\n        $sb = [];\n        for ($i = 0; $i < $length; $i++) {\n            $sb[] = ord($buff[$offset+$i]) & 0xFF;\n        }\n        return '['.implode(' ', $sb).']';","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/php/xdb/Searcher.class.php#L72-L108","documentation":"PHP versionFromHeader: the header's structure version is neither 2.0 (IPv4-only) nor 3.0, so the loaded file is not a recognized xdb database — usually corruption, truncation, or the wrong file.","triggerScenarios":"Thrown at binding/php/xdb/Searcher.class.php:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the searcher at a valid, current-generation xdb file","Re-generate the database with the official maker","Check file integrity (size, first bytes) after copying/downloading"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1","analyzedAt":"2026-09-02T16:58:39.988Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}