{"record":{"id":"965f0b3e5903d05b","repo":"octobercms/october","slug":"calling-any-method-on-a-s-object-is-blocked","errorCode":null,"errorMessage":"Calling any method on a \"%s\" object is blocked.","messagePattern":"Calling any method on a \"(.+?)\" object is blocked\\.","errorType":"exception","errorClass":"Twig\\Sandbox\\SecurityNotAllowedMethodError","httpStatus":null,"severity":"error","filePath":"modules/system/twig/SecurityPolicy.php","lineNumber":246,"sourceCode":"            $methodNames = $obj->getTwigMethodNames();\n            if (in_array($method, $methodNames)) {\n                return;\n            }\n        }\n\n        // Contractual wildcard\n        if ($obj instanceof \\October\\Contracts\\Twig\\CallsAnyMethod) {\n            return;\n        }\n\n        // Check general methods\n        $allowMethod = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');\n        if (in_array($allowMethod, $this->allowMethods)) {\n            return;\n        }\n\n        $className = get_class($obj);\n        throw new SecurityNotAllowedMethodError(sprintf('Calling any method on a \"%s\" object is blocked.', $className), $className, $method);\n    }\n\n    //\n    // Block-list\n    //\n\n    /**\n     * checkMethodAllowedBlocklist\n     */\n    protected function checkMethodAllowedBlocklist($obj, $method)\n    {\n        $blockedMethod = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');\n\n        // Check direct class blocklists\n        foreach ($this->blockedClassMethods as $blockedClass => $blockedMethods) {\n            if (is_a($obj, $blockedClass) && in_array($blockedMethod, $blockedMethods)) {\n                throw new SecurityNotAllowedMethodError(sprintf('Calling \"%s\" method on a \"%s\" object is blocked.', $method, $blockedClass), $blockedClass, $method);\n            }","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/twig/SecurityPolicy.php#L228-L264","documentation":"Error \"Calling any method on a \"%s\" object is blocked.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/system/twig/SecurityPolicy.php:246 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":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}