Ad

Different Behavior In Laravel Homestead & Laravel Forge

- 1 answer

I had a simple mistake in my PHP Code:

$string += 'something' . $Car->id . ',';

Which resulted in different behavior in Homestead and Forge:

Homestead Result of $string:

0

Forge Result:

Error: A non-numeric value encountered

Does Anybody know why? And how can I change the Homestead behavior to the same like the forge one? It's absolutely better..


Update

I'm sorry I wasn't totally clear in my question. The question wasn't about the mistake itself += instead of .=, I was aware of that.

The question is why in one environment the error appears and in the other one not.

Both environments are configured the same way (php.ini):

error_reporting = E_ALL
display_errors = On

And it was not just a notice, it's an error.

Ad

Answer

The PHP Version of Laravel Homestead was 7.0.8 and the PHP Version of Laravel Forge 7.1.0-3.

I updated Laravel Homestead to the newest which uses PHP 7.1.0-2, and now Homestead shows up the right error:

Error: A non-numeric value encountered

I'm not shure if it's just the PHP Version or if it's an other change in Homestead with the new version. Thats just what I've found out.

Ad
source: stackoverflow.com
Ad