Help us understand the problem. What is going on with this article?

PHP5.6とPHP7.3でPDO::PARAM_INTの挙動が変わる

PHP5.6 → 7.3 アップグレード時に発覚したPDOの非互換について記録しておく。

PDOでDBの値を更新するために以下のように記述

$stmt->bindParam(':param1', $float, PDO::PARAM_INT);

$floatに1.5が入力されていたとすると、

PHP5.6の場合、1.5で更新

PHP7.3の場合、1で更新

される。

小数点で更新する場合、

PDO::PARAM_STR

にすれば、どちらのバージョンでも整数に丸められず更新されるが、
PHP5.6のときは

PDO::PARAM_INT

でも、小数点が丸められずに更新できていた。

PHP7.0、7.1、7.2、7.3のどのタイミングで非互換が発生したのかは調査中。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away