Skip to content

Commit 2d9bbf1

Browse files
committed
[skip ci] Group similar entries in UPGRADING
This groups together: - Class constants being typed - Resource to object conversions - New warnings and exceptions
1 parent da4eab6 commit 2d9bbf1

File tree

1 file changed

+87
-95
lines changed

1 file changed

+87
-95
lines changed

UPGRADING

Lines changed: 87 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,92 @@ PHP 8.4 UPGRADE NOTES
4040
removed.
4141
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant
4242

43-
- Date:
44-
. The class constants are typed now.
45-
46-
- DBA:
47-
. dba_open() and dba_popen() will now return a Dba\Connection
48-
object rather than a resource. Return value checks using is_resource()
49-
should be replaced with checks for `false`.
43+
- Extension Class constants are now typed:
44+
. Date
45+
. Intl
46+
. PDO
47+
. Reflection
48+
. SPL
49+
. Sqlite
50+
. XMLReader
51+
52+
- Resource to Object conversions:
53+
Return value checks using is_resource() should be replaced with checks
54+
for `false`, unless specified otherwise.
55+
. DBA:
56+
> dba_open() and dba_popen() will now return Dba\Connection
57+
. ODBC:
58+
> odbc_connect() and odbc_pconnect() will now return Odbc\Connection
59+
> odbc_prepare(), odbc_exec(), and various other functions will now return
60+
Odbc\Result
61+
. SOAP:
62+
> SoapClient::$httpurl is now a Soap\Url object rather than a resource.
63+
Checks using is_resource() (i.e. is_resource($client->httpurl)) should be
64+
replaced with checks for null (i.e. $client->httpurl !== null).
65+
> SoapClient::$sdl is now a Soap\Sdl object rather than a resource.
66+
Checks using is_resource() (i.e. is_resource($client->sdl)) should be
67+
replaced with checks for null (i.e. $client->sdl !== null).
68+
69+
- New warnings and exceptions:
70+
. Intl:
71+
> resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
72+
ResourceBundle object now throw:
73+
- TypeError for invalid offset types
74+
- ValueError for an empty string
75+
- ValueError if the integer index does not fit in a signed 32 bit integer
76+
. MBString:
77+
> mb_encode_numericentity() and mb_decode_numericentity() now check that
78+
the $map is only composed of integers, if not a ValueError is thrown.
79+
> mb_http_input() now always throws a ValueError if the $type is invalid.
80+
> mb_http_output() now checks that the $encoding parameter does not
81+
contain any null bytes. If it does, a ValueError is now thrown.
82+
. ODBC:
83+
> odbc_fetch_row() returns false when a value less than or equal to 0 is
84+
passed for parameter $row. Now, a warning is emitted in this case.
85+
. PCNTL:
86+
> The functions pcntl_sigprocmask(), pcntl_sigwaitinfo() and
87+
pcntl_sigtimedwait() now throw:
88+
- A ValueError if the $signals array is empty (except for
89+
pcntl_sigprocmask() if the $mode is SIG_SETMASK).
90+
- A TypeError if a value of the $signals array is not an integer
91+
- A ValueError if a value of the $signals array is not a valid signal number
92+
> The function pcntl_sigprocmask() now throw:
93+
- A ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
94+
> The function pcntl_sigtimedwait() now throw:
95+
- A ValueError if $seconds is less than 0
96+
- A ValueError if $nanoseconds is less than 0 or greater than 1e9
97+
- A ValueError if both $seconds and $nanoseconds are 0
98+
. SimpleXML:
99+
> Calling simplexml_import_dom() with a non-XML object now throws a
100+
TypeError instead of a ValueError.
101+
. Standard:
102+
> round() now validates the value of the $mode parameter and throws a
103+
ValueError for invalid modes. Previously invalid modes would have been
104+
interpreted as PHP_ROUND_HALF_UP.
105+
> The str_getcsv() function now throws ValueErrors when the $separator and
106+
$enclosure arguments are not one byte long, or if the $escape is not one
107+
byte long or the empty string. This aligns the behaviour to be identical
108+
to that of fputcsv() and fgetcsv().
109+
> php_uname() now throws ValueErrors if the $move parameter is invalid.
110+
> The "allowed_classes" option for unserialize() now throws TypeErrors and
111+
ValueErrors if it is not an array of class names.
112+
. XMLReader:
113+
> Passing an invalid character encoding to XMLReader::open() or
114+
XMLReader::XML() now throws a ValueError.
115+
> Passing a string containing NULL bytes previously emitted a
116+
warning and now throws a ValueError as well.
117+
. XMLWriter:
118+
> Passing a string containing NULL bytes previously emitted a
119+
warning and now throws a ValueError as well.
120+
. XSL:
121+
> XSLTProcessor::setParameter() will now throw a ValueError when its
122+
arguments contain null bytes. This never actually worked correctly in
123+
the first place, which is why it throws an exception nowadays.
124+
> Calling XSLTProcessor::importStyleSheet() with a non-XML object now
125+
throws a TypeError instead of a ValueError.
126+
> Failure to call a PHP function callback during evaluation now throws
127+
instead of emitting a warning.
128+
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
50129

51130
- DOM:
52131
. Some DOM methods previously returned false or a PHP_ERR DOMException if a new
@@ -64,20 +143,7 @@ PHP 8.4 UPGRADE NOTES
64143
. The GMP class is now final and cannot be extended anymore.
65144
RFC: https://wiki.php.net/rfc/gmp-final
66145

67-
- Intl:
68-
. resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
69-
ResourceBundle object now throw:
70-
- TypeError for invalid offset types
71-
- ValueError for an empty string
72-
- ValueError if the integer index does not fit in a signed 32 bit integer
73-
. The class constants are typed now.
74-
75146
- MBString:
76-
. mb_encode_numericentity() and mb_decode_numericentity() now check that
77-
the $map is only composed of integers, if not a ValueError is thrown.
78-
. mb_http_input() now always throws a ValueError if the $type is invalid.
79-
. mb_http_output() now checks that the $encoding parameter does not
80-
contain any null bytes. If it does, a ValueError is now thrown.
81147
. On invalid strings (those with encoding errors), mb_substr() now interprets
82148
character indices in the same manner as most other mbstring functions. This
83149
means that character indices returned by mb_strpos() can be passed to mb_substr().
@@ -103,16 +169,6 @@ PHP 8.4 UPGRADE NOTES
103169
. The error code reported for MySQL server wait timeouts has been changed from 2006
104170
to 4031 for MySQL server versions 8.0.24 and above.
105171

106-
- ODBC:
107-
. odbc_fetch_row() returns false when a value less than or equal to 0 is
108-
passed for parameter $row. Now, a warning is emitted in this case.
109-
. odbc_connect() and odbc_pconnect() will now return an Odbc\Connection
110-
object rather than a resource. Return value checks using is_resource()
111-
should be replaced with checks for `false`.
112-
. odbc_prepare(), odbc_exec(), and various other functions will now return
113-
an Odbc\Result object rather than a resource. Return value checks using
114-
is_resource() should be replaced with checks for `false`.
115-
116172
- Opcache:
117173
. The JIT config defaults changed from opcache.jit=tracing and
118174
opcache.jit_buffer_size=0 to opcache.jit=disable and
@@ -129,19 +185,8 @@ PHP 8.4 UPGRADE NOTES
129185

130186
- PCNTL:
131187
. The functions pcntl_sigprocmask(), pcntl_sigwaitinfo() and
132-
pcntl_sigtimedwait() now throw:
133-
- A ValueError if the $signals array is empty (except for
134-
pcntl_sigprocmask() if the $mode is SIG_SETMASK).
135-
- A TypeError if a value of the $signals array is not an integer
136-
- A ValueError if a value of the $signals array is not a valid signal number
137-
Moreover, those functions now always return false on failure.
188+
pcntl_sigtimedwait() now always return false on failure.
138189
In some case previously it could return the value -1.
139-
. The function pcntl_sigprocmask() will also now throw:
140-
- A ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
141-
. The function pcntl_sigtimedwait() will also now throw:
142-
- A ValueError if $seconds is less than 0
143-
- A ValueError if $nanoseconds is less than 0 or greater than 1e9
144-
- A ValueError if both $seconds and $nanoseconds are 0
145190

146191
- PCRE:
147192
. The bundled pcre2lib has been updated to version 10.44.
@@ -150,9 +195,6 @@ PHP 8.4 UPGRADE NOTES
150195
has changed. Consult https://github.com/PCRE2Project/pcre2/blob/master/NEWS
151196
for a full changelog.
152197

153-
- PDO:
154-
. The class constants are typed now.
155-
156198
- PDO_DBLIB:
157199
. setAttribute, DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT
158200
have been changed to set value as a bool.
@@ -166,34 +208,20 @@ PHP 8.4 UPGRADE NOTES
166208
- PDO_MYSQL:
167209
. getAttribute, ATTR_AUTOCOMMIT, ATTR_EMULATE_PREPARES, MYSQL_ATTR_DIRECT_QUERY have
168210
been changed to get values as bool.
169-
. Quoting a string with PARAM_LOB as type now outputs the string explicitly quoted
170-
as binary. This also affects parameters bound as PARAM_LOB when
171-
ATTR_EMULATE_PREPARES is enabled.
172211

173212
- PDO_PGSQL:
174213
. The DSN's credentials, when set, are given priority over their PDO
175214
constructor counterparts, being closer to the documentation states.
176215

177-
- Reflection:
178-
. The class constants are typed now.
179-
180216
- SimpleXML:
181217
. Get methods called, or casting to a string on a SimpleXMLElement will no
182218
longer implicitly reset the iterator data, unless explicitly rewound.
183219
For example, casting an element to a string within a foreach loop would
184220
cause an infinite loop because it destroyed the current iterator data.
185221
This is no longer the case as a consequence of the bugfixes for GH-12192,
186222
GH-12208, #55098.
187-
. Calling simplexml_import_dom() with a non-XML object now throws a TypeError
188-
instead of a ValueError.
189223

190224
- SOAP:
191-
. SoapClient::$httpurl is now a Soap\Url object rather than a resource.
192-
Checks using is_resource() (i.e. is_resource($client->httpurl)) should be
193-
replaced with checks for null (i.e. $client->httpurl !== null).
194-
. SoapClient::$sdl is now a Soap\Sdl object rather than a resource.
195-
Checks using is_resource() (i.e. is_resource($client->sdl)) should be
196-
replaced with checks for null (i.e. $client->sdl !== null).
197225
. SoapClient::$typemap is now an array rather than a resource.
198226
Checks using is_resource() (i.e. is_resource($client->typemap)) should be
199227
replaced with checks for null (i.e. $client->typemap !== null).
@@ -202,25 +230,9 @@ PHP 8.4 UPGRADE NOTES
202230
you will experience errors on startup if you also use the SOAP extension.
203231
To solve this, either don't use rtld-now or load the session extension.
204232

205-
- SPL:
206-
. The class constants are typed now.
207-
208-
- Sqlite:
209-
. The class constants are typed now.
210-
211233
- Standard:
212-
. round() now validates the value of the $mode parameter and throws a ValueError
213-
for invalid modes. Previously invalid modes would have been interpreted as
214-
PHP_ROUND_HALF_UP.
215234
. strcspn() with empty $characters now returns the length of the string instead
216235
of incorrectly stopping at the first NUL character. See GH-12592.
217-
. The str_getcsv() function now throws ValueErrors when the $separator and
218-
$enclosure arguments are not one byte long, or if the $escape is not one
219-
byte long or the empty string. This aligns the behaviour to be identical
220-
to that of fputcsv() and fgetcsv().
221-
. php_uname() now throws ValueErrors on invalid inputs.
222-
. The "allowed_classes" option for unserialize() now throws TypeErrors and
223-
ValueErrors if it is not an array of class names.
224236
. http_build_query() now correctly handles backed enums.
225237
. stream_bucket_make_writeable() and stream_bucket_new() will now return a
226238
StreamBucket instance instead of an instance of stdClass.
@@ -241,26 +253,6 @@ PHP 8.4 UPGRADE NOTES
241253
Passing an empty string to disable the handler is still allowed,
242254
but deprecated.
243255

244-
- XMLReader:
245-
. Passing an invalid character encoding to XMLReader::open() or
246-
XMLReader::XML() now throws a ValueError. Passing a string containing NULL
247-
bytes previously emitted a warning and now throws a ValueError as well.
248-
. The class constants are typed now.
249-
250-
- XMLWriter:
251-
. Passing a string containing NULL bytes previously emitted a warning and
252-
now throws a ValueError.
253-
254-
- XSL:
255-
. XSLTProcessor::setParameter() will now throw a ValueError when its arguments
256-
contain null bytes. This never actually worked correctly in the first place,
257-
which is why it throws an exception nowadays.
258-
. Failure to call a PHP function callback during evaluation now throws
259-
instead of emitting a warning.
260-
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
261-
. Calling XSLTProcessor::importStyleSheet() with a non-XML object now throws
262-
a TypeError instead of a ValueError.
263-
264256
========================================
265257
2. New Features
266258
========================================

0 commit comments

Comments
 (0)