Is standard practice disabling error log notifications for PHP development

I come from the background of J2EE, and it seems that PHP developers very often have to turn off and ignore notifications using the operator: error_reporting (E_ALL and ~ E_NOTICE);

Is the application I'm working in filled with messages about undefined variables? It seems very strange to me.

+3
source share
5 answers

This is bad practice, but it is quite common.

You could say that this is considered standard practice, as it is a standard installation out of the box.

However, the fact that its default value in PHP should not be taken as meaning it is a good idea! (cough register_globalscough)

, E_NOTICE undefined, undefined, , .

, , $var, $this->var. , undefined, undefined .

, PHP 5.3 ( ), , .

+10

, PHP.

, , , , ( , ) , .

, .

, , .

PHP

:)

0

, ( ). PHP:

PHP 4 PHP 5 - E_ALL ~ E_NOTICE. E_NOTICE. .

, , - , ( ). , -, Java-, ...

0

, , , :

  • Xampp;
  • Lampp;
  • Mampp;
  • Wamp;

PHP, . error_reporting(E_ALL);.

, , , , PHP script:

, :

error_reporting(E_ALL & ~E_NOTICE | E_STRICT);

:

error_reporting(E_ALL);

:

error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);

PHP Script .

PS: .


PHP.ini .

PHP.ini 514º .

.

EDIT: 514º, 504º.

0

php.ini , , . , , (, ), , . ( , , .) IME. , , . PHP-, .

, . , , , . .

0
source

Source: https://habr.com/ru/post/1719457/


All Articles