I have this PHP snippet below in a PHP 5 legacy project environment(local and production):
<?php
ini_set('display_errors', 'on');
error_reporting(E_ALL);
error_reporting(-1);
ini_set('error_reporting', E_ALL);
try {
number_format("");
} catch (\Exception $e) {
throw new Exception($e->getMessage());
}
?>
I know that this is a problem since number_format expects float or double. However it does not trigger the exception in localhost but it does in the production.
The actual message is Warning: number_format() expects parameter 1 to be double, string given in /path-to-file.php
I also tried changing ini_set('display_errors', 'on'); to ini_set('display_errors', 1); and error_reporting(E_ALL); to error_reporting(E_ALL | E_STRICT); but it does not return the expected exception.
I also tried removing the try/catch and just use the number_format as is just so that exception error will popup the exception error did not display.
Also tried to add the display_errors = on in php.ini same result.