{"record":{"id":"6e7e5da6038bc14e","repo":"gchq/CyberChef","slug":"unknown-type-kind","errorCode":null,"errorMessage":"Unknown type: ${kind}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/PHPDeserialize.mjs","lineNumber":161,"sourceCode":"                case \"a\":\n                    expect(\":\");\n                    return \"{\" + handleArray() + \"}\";\n\n                case \"s\": {\n                    expect(\":\");\n                    const length = readUntil(\":\");\n                    expect(\"\\\"\");\n                    const value = read(length);\n                    expect('\";');\n                    if (args[0]) {\n                        return '\"' + value.replace(/\"/g, '\\\\\"') + '\"'; // lgtm [js/incomplete-sanitization]\n                    } else {\n                        return '\"' + value + '\"';\n                    }\n                }\n\n                default:\n                    throw new OperationError(\"Unknown type: \" + kind);\n            }\n        }\n\n        const inputPart = input.split(\"\");\n        return handleInput();\n    }\n\n}\n\nexport default PHPDeserialize;\n","sourceCodeStart":143,"sourceCodeEnd":172,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/PHPDeserialize.mjs#L143-L172","documentation":"The switch on the first character (kind) of a serialized element does not match any known type marker. Supported types are n (null), i (integer), d (double), b (boolean), a (array), and s (string). PHP objects (O:) and any other type are not supported, as stated in the operation description.","triggerScenarios":"The input contains a PHP serialized object: O:4:\"Date\":0:{}. The input is not PHP serialized data at all (starts with an unexpected character). A private/protected property serialization using null-byte prefixes that the lowercase read misinterprets.","commonSituations":"Trying to deserialize data that includes PHP objects (the operation explicitly states 'This function does not support object tags'). Feeding arbitrary non-serialized text into the operation.","solutions":["Remove or convert serialized object (O:) elements before deserializing — only null, int, double, bool, array, and string are supported","Verify the input is genuinely PHP-serialized data and not another format","If objects are needed, convert them to associative arrays (a:) in PHP before serializing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check: reject serialized objects (O:) which are unsupported\nfunction hasObjects(s) {\n  return /(^|;)O:\\d+:\"/.test(s);\n}\nif (hasObjects(input)) {\n  throw new Error(\"PHP serialized objects (O:) are not supported by this operation.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = chef.phpDeserialize(input, [true]);\n} catch (e) {\n  if (/Unknown type/i.test(e.message)) {\n    console.error(\"Unsupported type encountered — objects (O:) are not supported\");\n  } else { throw e; }\n}","preventionTips":["Convert PHP objects to associative arrays before serializing","Verify the input only uses n, i, d, b, a, s type markers"],"tags":["php","deserialization","parsing","unsupported-type"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}