Using modle->chunk and seeing this error each time it runs:
in_array(): Argument #2 ($haystack) must be of type array, null given
at Laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:2113
2109▕ // If the attribute is listed as a date, we will convert it to a DateTime
2110▕ // instance on retrieval, which makes it quite convenient to work with
2111▕ // date fields without having to create a mutator for each property.
2112▕ if ($value !== null
➜ 2113▕ && \in_array($key, $this->getDates(), false)) {
2114▕ return $this->asDateTime($value);
2115▕ }
2116▕
2117▕ return $value;
If I change "$this->getDates()" to "$this->getDates() ?? []" the failure doesn't happen and the code completes.
Of course, altering Laravel code isn't the answer, so what is my problem?
I removed the protected $dates = [ 'var1', 'varx' ] lines from all models that had $dates defined, as directed in the Upgrade guide. then added those attributes to the $casts list.
Then as part of debugging I reversed that for the model I was using ->chunk() on, but that didn't fix it.
I am pretty certain this as something to do with $dates and $casts, but that'ss just a guess.
Any help would be appriiated.