Hi Matthew,

As was pointed out before ZEROFILL is getting deprecated. It has been
deprecated by MySQL and I assume MariaDB will follow soon.
The change you are referring to is only to fix inconsistency in PHP. The
problem with ZEROFILL has been present since forever as far as I know.

The setting PDO::ATTR_STRINGIFY_FETCHES is not going to affect the result
either, because the value isn't stored with zeros. The length of integers
columns only signifies how MySQL displays it in the result.

Storing non-numerical values like phone numbers or zip codes in integer
columns is just a terrible idea. If the zip code has a leading zero that is
part of the data then it should be stored in a text column. MySQL doesn't
store the leading zeros. It only pads the output.

If you want you can always cast the number to a character SELECT
CAST(`ZEROFILL` as CHAR)  FROM `zerofill` which will tell MySQL to pad the
output.

The change that Nikita did is the correct one. As to whether PHP should do
anything with regards to ZEROFILL_FLAG is a separate question.

Re Pierre's confusion: I believe you are confusing prepared statements with
emulation of prepared statements, but this is orthogonal to this
discussion.

Kind Regards,
Kamil

Reply via email to