Did you check the second query for the case where creativeAirMonth is null?
PHP 7.1 "A non-numeric value encountered" on DB::raw
We have a query that is working fine on PHP7.0 and Laravel 5.1
->addSelect(DB::raw("CONCAT(IFNULL(creativeAirYear,'0000'),"-",IFNULL(creativeAirMonth,'00'),"-",IFNULL(creativeAirDay,'00')) as sortAirDate"))
When we deploy to our PHP 7.1 server we get a fatal error "A non-numeric value encountered"
If we change the raw query to:
->addSelect(DB::raw("CONCAT(IF(creativeAirYear IS NOT NULL, creativeAirYear,'0000'), '-',IF(creativeAirMonth IS NOT NULL, creativeAirMonth, '00'),'-', IF(creativeAirDay IS NOT NULL, creativeAirDay, '00')) AS sortAirDate"))
the error goes away and the query works fine.
At the end of the day, the CONCAT provides the same results but it seems unnecessarily verbose and I don't understand why it would cause an error.
I have done a significant amount of research but have come up empty in finding out why. Any ideas?
Not sure, why it would work on one version. The placement of " does not seem correct in first query... either escape the double quotes or use single quotes ....
Please or to participate in this conversation.