Skip to content

Commit e16d04c

Browse files
authored
ext/pdo: document the PHP 8.5 fetch mode changes and deprecations (#5817)
1 parent 8871302 commit e16d04c

5 files changed

Lines changed: 120 additions & 4 deletions

File tree

‎reference/pdo/pdo.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,17 @@
492492
</row>
493493
</thead>
494494
<tbody>
495+
<row>
496+
<entry>8.5.0</entry>
497+
<entry>
498+
Driver-specific constants of the <classname>PDO</classname> class have
499+
been deprecated in favor of the equivalent constants of the
500+
driver-specific subclasses (<classname>Pdo\Dblib</classname>,
501+
<classname>Pdo\Firebird</classname>, <classname>Pdo\Mysql</classname>,
502+
<classname>Pdo\Odbc</classname>, <classname>Pdo\Pgsql</classname>,
503+
<classname>Pdo\Sqlite</classname>).
504+
</entry>
505+
</row>
495506
<row>
496507
<entry>8.4.0</entry>
497508
<entry>

‎reference/pdo/pdo/construct.xml‎

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
the DSN string. The URI can specify a local file or a remote URL.
6161
</para>
6262
<para><userinput>uri:file:///path/to/dsnfile</userinput></para>
63+
<warning>
64+
<simpara>
65+
The <userinput>uri:</userinput> DSN scheme is deprecated as of
66+
PHP 8.5.0 due to security concerns with DSNs coming from remote
67+
URIs.
68+
</simpara>
69+
</warning>
6370
</listitem>
6471
</varlistentry>
6572
<varlistentry><term>Aliasing</term>
@@ -113,11 +120,33 @@
113120

114121
<refsect1 role="errors">
115122
&reftitle.errors;
116-
<para>
117-
A <classname>PDOException</classname> is thrown if the attempt
123+
<simpara>
124+
A <exceptionname>PDOException</exceptionname> is thrown if the attempt
118125
to connect to the requested database fails,
119126
regardless of which <constant>PDO::ATTR_ERRMODE</constant> is currently set.
120-
</para>
127+
</simpara>
128+
</refsect1>
129+
130+
<refsect1 role="changelog">
131+
&reftitle.changelog;
132+
<informaltable>
133+
<tgroup cols="2">
134+
<thead>
135+
<row>
136+
<entry>&Version;</entry>
137+
<entry>&Description;</entry>
138+
</row>
139+
</thead>
140+
<tbody>
141+
<row>
142+
<entry>8.5.0</entry>
143+
<entry>
144+
The <userinput>uri:</userinput> DSN scheme is now deprecated.
145+
</entry>
146+
</row>
147+
</tbody>
148+
</tgroup>
149+
</informaltable>
121150
</refsect1>
122151

123152
<refsect1 role="examples">

‎reference/pdo/pdostatement/fetchall.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@
152152
</row>
153153
</thead>
154154
<tbody>
155+
<row>
156+
<entry>8.5.0</entry>
157+
<entry>
158+
Using <constant>PDO::FETCH_INTO</constant> as a fetch mode now throws a
159+
<exceptionname>ValueError</exceptionname>, similar to
160+
<constant>PDO::FETCH_LAZY</constant>.
161+
Using <constant>PDO::FETCH_PROPS_LATE</constant> with a fetch mode
162+
other than <constant>PDO::FETCH_CLASS</constant> now throws a
163+
<exceptionname>ValueError</exceptionname>.
164+
</entry>
165+
</row>
155166
<row>
156167
<entry>8.0.0</entry>
157168
<entry>

‎reference/pdo/pdostatement/setattribute.xml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,39 @@
6464
</para>
6565
</refsect1>
6666

67+
<refsect1 role="errors">
68+
&reftitle.errors;
69+
<simpara>
70+
As of PHP 8.5.0, when using the Firebird driver, a
71+
<exceptionname>ValueError</exceptionname> is thrown if the cursor name set via
72+
<constant>PDO::ATTR_CURSOR_NAME</constant> is too long.
73+
</simpara>
74+
</refsect1>
75+
76+
<refsect1 role="changelog">
77+
&reftitle.changelog;
78+
<informaltable>
79+
<tgroup cols="2">
80+
<thead>
81+
<row>
82+
<entry>&Version;</entry>
83+
<entry>&Description;</entry>
84+
</row>
85+
</thead>
86+
<tbody>
87+
<row>
88+
<entry>8.5.0</entry>
89+
<entry>
90+
When using the Firebird driver, a <exceptionname>ValueError</exceptionname>
91+
is now thrown if the cursor name set via
92+
<constant>PDO::ATTR_CURSOR_NAME</constant> is too long.
93+
</entry>
94+
</row>
95+
</tbody>
96+
</tgroup>
97+
</informaltable>
98+
</refsect1>
99+
67100
<refsect1 role="seealso">
68101
&reftitle.seealso;
69102
<para>

‎reference/pdo/pdostatement/setfetchmode.xml‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
<term><parameter>constructorArgs</parameter></term>
7070
<listitem>
7171
<simpara>
72-
Constructor arguments.
72+
Constructor arguments. As of PHP 8.5.0, string keys act as named
73+
arguments. To pass a variable by reference, use a reference element:
74+
<code>$constructorArgs = [&amp;$valByRef]</code>.
7375
</simpara>
7476
</listitem>
7577
</varlistentry>
@@ -92,6 +94,16 @@
9294
</simpara>
9395
</refsect1>
9496

97+
<refsect1 role="errors">
98+
&reftitle.errors;
99+
<simpara>
100+
As of PHP 8.5.0, an <exceptionname>Error</exceptionname> is thrown if this method
101+
is called during a call to <methodname>PDOStatement::fetch</methodname>,
102+
<methodname>PDOStatement::fetchObject</methodname>, or
103+
<methodname>PDOStatement::fetchAll</methodname>.
104+
</simpara>
105+
</refsect1>
106+
95107
<refsect1 role="changelog">
96108
&reftitle.changelog;
97109
<informaltable>
@@ -103,6 +115,26 @@
103115
</row>
104116
</thead>
105117
<tbody>
118+
<row>
119+
<entry>8.5.0</entry>
120+
<entry>
121+
The <parameter>constructorArgs</parameter> for
122+
<constant>PDO::FETCH_CLASS</constant> now follow CUFA
123+
(<function>call_user_func_array</function>) semantics: string keys act
124+
as named arguments, and automatic wrapping of by-value arguments for
125+
by-reference parameters has been removed.
126+
</entry>
127+
</row>
128+
<row>
129+
<entry>8.5.0</entry>
130+
<entry>
131+
Calling this method during a call to
132+
<methodname>PDOStatement::fetch</methodname>,
133+
<methodname>PDOStatement::fetchObject</methodname>, or
134+
<methodname>PDOStatement::fetchAll</methodname> now throws an
135+
<exceptionname>Error</exceptionname>.
136+
</entry>
137+
</row>
106138
&return.type.true.84;
107139
</tbody>
108140
</tgroup>

0 commit comments

Comments
 (0)