php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81310 Clarify UPGRADING entry (bug?)
Submitted: 2021-07-29 17:37 UTC Modified: 2021-07-29 21:06 UTC
From: alec@php.net Assigned:
Status: Not a bug Package: PDO MySQL
PHP Version: 8.1.0beta1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alec@php.net
New email:
PHP Version: OS:

 

 [2021-07-29 17:37 UTC] alec@php.net
Description:
------------
In UPGRADING there's this:
"
- PDO MySQL:
  . Integers and floats in result sets will now be returned using native PHP
    types instead of strings when using emulated prepared statements. This
    matches the behavior of native prepared statements. You can restore the
    previous behavior by enabling the PDO::ATTR_STRINGIFY_FETCHES option.
"

In my code I don't use prepare()/execute(), nor PDO::ATTR_EMULATE_PREPARES. All I use is query()/fetch(). However, I noticed that I started getting integers instead of strings now.

So, is that a bug? Maybe query() uses prepared queries internally. But then maybe it should be clarified, that it has really nothing to do with prepared statements mode.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-29 19:01 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2021-07-29 19:01 UTC] requinix@php.net
pdo_mysql enables emulated prepares by default.
 [2021-07-29 21:06 UTC] cmb@php.net
> Maybe query() uses prepared queries internally.

Right.  That has recently been clarified in the documentation[1]:

| PDO::query() prepares and executes an SQL statement in a single
| function call, […]

[1] <https://www.php.net/manual/en/pdo.query.php>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC