Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle NULL values in the code element #6559

Merged
merged 2 commits into from Nov 27, 2023
Merged

Conversation

aschempp
Copy link
Member

tl_content.code is a TEXT field that is nullable, but the HighlighterRuntime does not accept a null value for code highlighting.

@aschempp aschempp added the bug label Nov 24, 2023
@aschempp aschempp added this to the 5.2 milestone Nov 24, 2023
@aschempp aschempp requested a review from m-vo November 24, 2023 16:46
@aschempp aschempp self-assigned this Nov 24, 2023
@m-vo
Copy link
Member

m-vo commented Nov 26, 2023

IMHO we should handle this the same as with text in the TextController - so basically $template->set('code', $model->code ?: '');.

Edit: My reasoning is, that, even if the filed can be accidentally null, it should not be null as it is mandatory. So I'd handle this in the controller.

@aschempp aschempp requested review from m-vo and removed request for m-vo November 27, 2023 11:01
@leofeyer leofeyer changed the title Fixed NULL value in code highlighting Handle NULL values in the code element Nov 27, 2023
@leofeyer leofeyer merged commit 65f482e into contao:5.2 Nov 27, 2023
16 checks passed
@leofeyer
Copy link
Member

Thank you @aschempp.

@aschempp aschempp deleted the fix/highlighter branch November 27, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants