Bug #81405 [Opn]: Values of PDO::PARAM_ constants have changed
| From: | nikic@php.net | Date: | Wed, 01 Sep 2021 09:14:03 +0000 |
| Subject: | Bug #81405 [Opn]: Values of PDO::PARAM_ constants have changed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236204@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81405&edit=1
ID: 81405
Updated by: nikic@php.net
Reported by: me at derrabus dot de
Summary: Values of PDO::PARAM_ constants have changed
Status: Open
Type: Bug
Package: PDO Core
Operating System: macOS 11.5
PHP Version: 8.1.0beta3
Block user comment: N
Private report: N
New Comment:
In what way do Symfony and Doctrine use hard-coded values for PDO::PARAM_* constants?
If you had submitted this issue just one day earlier I'd have simply changed the values. But
ABI for PHP 8.1 is frozen now, and changing this would result in an ABI break.
Previous Comments:
------------------------------------------------------------------------
[2021-09-01 09:07:22] me at derrabus dot de
Description:
------------
While patching the test suites of Symfony and Doctrine for PHP 8.1, I have discovered that the
internal values of several PDO constants have changed.
While I am aware that as a developer I should not rely on the value of those constants but rather
use them as-is, I am afraid that this change might break existing application in interesting ways.
My assumption is that the actual values of those constants should not matter much to PDO because
they are used in switch-like constructs, but I might be wrong here. Under my assumption, the change
feels a bit arbitrary and unnecessary.
In the interest of providing a smooth upgrade path from PHP 8.0 to 8.1 for everyone, I'd kindly
ask to restore the listed constants to their values from PHP 8.0.
Test script:
---------------
<?php
echo 'PDO::PARAM_NULL => ' . \PDO::PARAM_NULL . "\n";
echo 'PDO::PARAM_BOOL => ' . \PDO::PARAM_BOOL . "\n";
echo 'PDO::PARAM_INT => ' . \PDO::PARAM_INT . "\n";
echo 'PDO::PARAM_STR => ' . \PDO::PARAM_STR . "\n";
echo 'PDO::PARAM_LOB => ' . \PDO::PARAM_LOB . "\n";
echo 'PDO::PARAM_STMT => ' . \PDO::PARAM_STMT . "\n";
Expected result:
----------------
PDO::PARAM_NULL => 0
PDO::PARAM_BOOL => 5
PDO::PARAM_INT => 1
PDO::PARAM_STR => 2
PDO::PARAM_LOB => 3
PDO::PARAM_STMT => 4
Actual result:
--------------
PDO::PARAM_NULL => 0
PDO::PARAM_BOOL => 1
PDO::PARAM_INT => 2
PDO::PARAM_STR => 3
PDO::PARAM_LOB => 4
PDO::PARAM_STMT => 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81405&edit=1