Should a PHP application handle error handling with invalid database values?

Imagine ... I have a field in the database called current_round. It can only be in the range of 0,1,2,3.

Within the application logic, it is impossible to get a number higher than 3 or less than 0 in the database.

Should there be an on-site verification error to find out if the value is distorted (i.e. not in the range 0-3)? Or is it just extra overhead? Is it possible to assume that the values ​​in the database are correctly formatted / changed, etc. (Assuming you sanitize / properly evaluate all user input?)

+3
source share
5 answers

. . 0, 1, 2, 3 , ( ).

, , - / , , .

+3

​​ , .

. :

  • -?
  • - , Active Record, Gateway Data Mapper ?
  • , ?

, .

, . , , , .

+2

, . (. DB2 Express-C http://FreeDB2.com) . , . , , . , , , . , , - , , , .

+2

, , , . . , , , - , "" . , , , , , .

0

, - , - /

0

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


All Articles