fix: a custom field with no help text is not an error - #864
Merged
blaipr merged 1 commit intoAug 23, 2026
Conversation
`CustomFieldDefinition.help` is `varchar(255) DEFAULT NULL`, and `getHelp()` agrees it is `?string`. `CustomFieldItem` declares `string $help`. `ItemTrait::getCustomFieldsForItem()` passed the column straight into the constructor, so a definition saved with the Help box left empty — which the form allows, and which is an ordinary thing to do — made every read of that item's custom fields a TypeError. On the web that is a 500. Through the API it is a 500 whose body carries the class, the method and the server's absolute path, which is the disclosure shape this codebase has already had to fix once on the parameter readers. It is the odd one out rather than a class of problem: `required` and `showInList` are nullable too and are cast on the lines either side, and every other column reaching this constructor — the definition's name, the type's name and text — is NOT NULL in the schema. `help` was the only one passed through as it came. The API's category view is where this surfaced. It carries the same `customFields=1` include that Client and Account do, and the fixture has two CATEGORY-module definitions with a null help, so the endpoint answered 500 for every category. That test had been left marked skipped with the defect written out in its docblock; it now asserts the 200 and the populated include instead. Checked by putting the raw column back: the unit test errors with exactly `CustomFieldItem::__construct(): Argument #3 ($help) must be of type string, null given`.
blaipr
deleted the
fix/a-custom-field-without-help-text-is-not-an-error
branch
August 23, 2026 22:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CustomFieldDefinition.helpisvarchar(255) DEFAULT NULL, andgetHelp()agrees it is?string.CustomFieldItemdeclaresstring $help.ItemTrait::getCustomFieldsForItem()passed the column straight into the constructor, so a definition saved with the Help box
left empty — which the form allows, and which is an ordinary thing to do — made every
read of that item's custom fields a TypeError.
On the web that is a 500. Through the API it is a 500 whose body carries the class, the
method and the server's absolute path, which is the disclosure shape this codebase has
already had to fix once on the parameter readers.
It is the odd one out rather than a class of problem:
requiredandshowInListarenullable too and are cast on the lines either side, and every other column reaching this
constructor — the definition's name, the type's name and text — is NOT NULL in the
schema.
helpwas the only one passed through as it came.The API's category view is where this surfaced. It carries the same
customFields=1include that Client and Account do, and the fixture has two CATEGORY-module definitions
with a null help, so the endpoint answered 500 for every category. That test had been
left marked skipped with the defect written out in its docblock; it now asserts the 200
and the populated include instead.
Checked by putting the raw column back: the unit test errors with exactly
CustomFieldItem::__construct(): Argument #3 ($help) must be of type string, null given.