You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Integer field type does not allow null values for config #8932
#1203 allows for null except for config. I'm not sure the reason for this, but I'm in a situation where I need to set the max value to null, so that there will not be a maximum.
How to reproduce
Set integer default to null in config fields and it will be set as 0. The code prevents null values from being set.
The original problem here — Integer::preProcessConfig() casting to (int) and turning null into 0 — no longer exists on 6.x. That override was removed in #12395, so config values now fall through to preProcess(), which returns null untouched. A config field of 'type' => 'integer' with no default stays null.
While confirming that, I found the mirror-image bug and fixed it: Integer::rules() and Floatval::rules() used truthy checks (if ($min = $this->config('min'))), so a legitimate min: 0 or max: 0 was silently dropped and never validated. Now that Min/Max/Step are user-facing config fields on both fieldtypes, that was easy to hit. Both now use is_null() checks.
Activity
duncanmcclean commentedon Nov 8, 2023
Can you provide your blueprint?
maurice-ellis commentedon Nov 14, 2023
duncanmcclean commentedon Aug 13, 2026
The original problem here —
Integer::preProcessConfig()casting to(int)and turningnullinto0— no longer exists on6.x. That override was removed in #12395, so config values now fall through topreProcess(), which returnsnulluntouched. A config field of'type' => 'integer'with no default staysnull.While confirming that, I found the mirror-image bug and fixed it:
Integer::rules()andFloatval::rules()used truthy checks (if ($min = $this->config('min'))), so a legitimatemin: 0ormax: 0was silently dropped and never validated. Now that Min/Max/Step are user-facing config fields on both fieldtypes, that was easy to hit. Both now useis_null()checks.