go to bug id or search bugs for
It turns out that the fourth parameter (I haven't verified for the others) appears to function "on reference"; i.e. it changes the variable types of set flags from booleans into integers. But what's more, it also changes the variable types on unrelated variables as well.
$dsn = "mysql:host=127.0.0.1;dbname=application_base";
$user = "root";
$password = "";
$flags = [
PDO::MYSQL_ATTR_FOUND_ROWS => true,
PDO::MYSQL_ATTR_LOCAL_INFILE => true
$std = new StdClass();
$std->flags = $flags;
// The values are still booleans.
new PDO($dsn, $user, $password, $flags);
// Booleans have turned into integers (as if the $flags parameter is on reference, which would be undocumented).
// Booleans have ALSO turned into integers! Which does not make sense, even if the $flags parameter had been on reference.
The array in the last two var dumps only contains booleans, not integers.
The array in the last two var dumps suddenly converted both integers into booleans and there is no way to work around that.
Add a Patch
Add a Pull Request
Automatic comment on behalf of email@example.com
Log: Fixed bug #70389 (PDO constructor changes unrelated variables)
We found that resolution of this bug by http://git.php.net/?p=php-src.git;a=commit;h=ef1bd8f0e6f88b1d123cea1c0b5079cfde7f90df introduces regression and crashes.
Please look into #71569 for details and proposed solution.
Related To: Bug #71569