mewebstudio / Purifier

HTMLPurifier for Laravel 5/6/7/8/9/10/11
MIT License
1.89k stars 230 forks source link

CleanHtml cast returns an empty string when database value is null #175

Open lyyka opened 2 years ago

lyyka commented 2 years ago

I have a field in database, i.e. html_content. The field is nullable and by default is null, but it may contain some HTML content.

Model casts this field using CleanHtml class and the result of $model->html_content when html_content is null is an empty string, instead of null value.

Isn't it supposed to return null value, because null value may indicate certain things when rendering pages on the front-end, etc.?