{"record":{"id":"fca3a282ec725a44","repo":"octobercms/october","slug":"cms-lang-cms-object-invalid-property","errorCode":null,"errorMessage":"cms::lang.cms_object.invalid_property","messagePattern":"cms::lang\\.cms_object\\.invalid_property","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/Lang.php","lineNumber":237,"sourceCode":"\n        $this->fileName = $fileName;\n        $this->originalFileName = $fileName;\n        $this->mtime = File::lastModified($filePath);\n        $this->content = $content;\n        $this->exists = true;\n\n        return $this;\n    }\n\n    /**\n     * Sets the object attributes.\n     * @param array $attributes A list of attributes to set.\n     */\n    public function fill(array $attributes)\n    {\n        foreach ($attributes as $key => $value) {\n            if (!in_array($key, $this->fillable)) {\n                throw new ApplicationException(LangHelper::get(\n                    'cms::lang.cms_object.invalid_property',\n                    ['name' => $key]\n                ));\n            }\n\n            $this->$key = $value;\n        }\n    }\n\n    /**\n     * save the object to the disk\n     */\n    public function save(array $options = [])\n    {\n        $this->validateFileName();\n\n        $fullPath = $this->getFilePath();\n","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/Lang.php#L219-L255","documentation":"ApplicationException thrown by `Lang::fill(array $attributes)` when a key being mass-assigned is not in the model's `$fillable` list (for theme lang files: `fileName` and `content`). This is a strict mass-assignment whitelist: any extra key aborts the whole fill instead of being ignored.","triggerScenarios":"Calling `fill($request->all())` on a Lang object when the request contains extra fields (e.g. 'title', 'locale', 'id'); a plugin or seed script passing an options array with keys the Lang class does not define.","commonSituations":"Forwarding unfiltered HTTP request data into the CMS object model; migrating code from a version that tolerated extra keys; third-party plugins extending lang-file forms with additional POST fields that then hit fill().","solutions":["Filter input before filling: `array_intersect_key($data, array_flip(['fileName', 'content']))`.","Remove extra keys (unset) from the attributes array your code builds before calling fill().","If you truly need more assignable attributes, subclass the Lang class and extend its `$fillable`."],"exampleFix":"// before\n$lang->fill($request->all()); // request also carries 'id', 'title', ...\n\n// after\n$lang->fill(array_intersect_key($request->all(), array_flip(['fileName', 'content'])));","handlingStrategy":"validation","validationCode":"$allowedKeys = array_flip(['fileName', 'content']);\n$safe = array_intersect_key($request->all(), $allowedKeys);\n// keys outside the whitelist are dropped, never filled\n$lang->fill($safe);","typeGuard":null,"tryCatchPattern":"try {\n    $lang->fill($attributes);\n} catch (Cms\\Classes\\CmsObjectException $e) { // ApplicationException\n    // report which key was rejected so the caller can fix its payload\n    Log::info('Rejected mass-assignment', ['keys' => array_keys($attributes)]);\n    throw $e;\n}","preventionTips":["Never forward $request->all() into fill(); always intersect with the model's fillable list.","Use $model->getFillable() when building the filter so it stays in sync with the model.","Prefer explicit property assignment for the two known fields in small scripts."],"tags":["mass-assignment","validation","lang","cms-object"],"backgroundTag":"mass-assignment-rejected","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}