{"record":{"id":"b703a34aa1aa822c","repo":"lionsoul2014/ip2region","slug":"invalid-verstion-name-ver-name","errorCode":null,"errorMessage":"invalid verstion name `{$ver_name}`","messagePattern":"invalid verstion name `(.+?)`","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"binding/php/xdb/Searcher.class.php","lineNumber":77,"sourceCode":"        $r = strcmp($ip1, $ip2);\n        if ($r < 0) {\n            return -1;\n        } else if ($r > 0) {\n            return 1;\n        } else {\n            return 0;\n        }\n    }\n\n    // version parse\n    public static function versionFromName($ver_name) {\n        $name = strtoupper($ver_name);\n        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) {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/lionsoul2014/ip2region/blob/c1a1fc7d5941760db3f8431dc05c48cf7f0e30a1/binding/php/xdb/Searcher.class.php#L59-L95","documentation":"PHP versionFromName sentinel: the uppercased name matches neither V4/IPV4 nor V6/IPV6, so no Version instance can be constructed from the given string.","triggerScenarios":"Thrown at binding/php/xdb/Searcher.class.php:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass 'v4', 'ipv4', 'v6' or 'ipv6' (case-insensitive)","Use versionFromHeader to derive the version from the xdb file itself","Validate the config value against a whitelist before calling the searcher factory"],"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"}