{"record":{"id":"1edf5334d20d8f88","repo":"octobercms/october","slug":"calling-s-method-on-a-request-is-blocked-in-saf","errorCode":null,"errorMessage":"Calling \"%s\" method on a request is blocked in Safe Mode.","messagePattern":"Calling \"(.+?)\" method on a request is blocked in Safe Mode\\.","errorType":"exception","errorClass":"Twig\\Sandbox\\SecurityNotAllowedMethodError","httpStatus":null,"severity":"error","filePath":"modules/system/twig/securitypolicy/SafeRequest.php","lineNumber":74,"sourceCode":"        // Locale\n        'getLocale', 'getPreferredLanguage', 'getLanguages', 'getDefaultLocale',\n    ];\n\n    /**\n     * __construct\n     */\n    public function __construct(Request $request)\n    {\n        $this->request = $request;\n    }\n\n    /**\n     * __call magic\n     */\n    public function __call($method, $parameters)\n    {\n        if (!in_array($method, $this->allowedMethods, true)) {\n            throw new SecurityNotAllowedMethodError(\n                sprintf('Calling \"%s\" method on a request is blocked in Safe Mode.', $method),\n                Request::class,\n                $method\n            );\n        }\n\n        return $this->request->{$method}(...$parameters);\n    }\n\n    /**\n     * __get proxies property access. Twig may access common request fields\n     * (e.g. {{ this.request.url }}) which Twig resolves via property access\n     * before falling back to a method call. We only expose method-call\n     * results, never the raw $server/$cookies/$headers bag properties.\n     */\n    public function __get($key)\n    {\n        if (in_array($key, $this->allowedMethods, true)) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/twig/securitypolicy/SafeRequest.php#L56-L92","documentation":"Error \"Calling \"%s\" method on a request is blocked in Safe Mode.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/system/twig/securitypolicy/SafeRequest.php:74 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"}