{"record":{"id":"098bdbd5c21fc390","repo":"phalcon/cphalcon","slug":"input-number-must-be-a-positive-integer","errorCode":null,"errorMessage":"Input number must be a positive integer","messagePattern":"Input number must be a positive integer","errorType":"exception","errorClass":"InvalidRandomInput","httpStatus":null,"severity":"error","filePath":"phalcon/Encryption/Security/Random.zep","lineNumber":274,"sourceCode":"    }\n\n    /**\n     * Generates a random number between 0 and $len\n     *\n     * Returns an integer: 0 <= result <= $len.\n     *\n     *```php\n     * $random = new \\Phalcon\\Encryption\\Security\\Random();\n     *\n     * echo $random->number(16); // 8\n     *```\n     * @throws Exception If secure random number generator is not available,\n     *                   unexpected partial read or $len <= 0\n     */\n    public function number(int len) -> int\n    {\n        if unlikely len <= 0 {\n            throw new InvalidRandomInput();\n        }\n\n        return random_int(0, len);\n    }\n\n    /**\n     * Generates a v4 random UUID (Universally Unique IDentifier)\n     *\n     * The version 4 UUID is purely random (except the version). It does not\n     * contain meaningful information such as MAC address, time, etc. See RFC\n     * 4122 for details of UUID.\n     *\n     * Delegates to `Phalcon\\Encryption\\Security\\Uuid::v4()`. For other UUID\n     * versions or object-based access use that class directly.\n     *\n     *```php\n     * $random = new \\Phalcon\\Encryption\\Security\\Random();\n     *","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Encryption/Security/Random.zep#L256-L292","documentation":"Error \"Input number must be a positive integer\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Encryption/Security/Random.zep:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}