@@ -40,13 +40,108 @@ PHP 8.4 UPGRADE NOTES
40
40
removed.
41
41
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant
42
42
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
+ . Curl:
71
+ . curl_multi_select throws a ValueError if the timeout argument if it's negative
72
+ or greater than PHP_INT_MAX.
73
+ . GD:
74
+ . imagejpeg/imagewebp/imagepng/imageavif throws an exception if an invalid
75
+ quality parameter value is passed. In addition, imageavif will throw an exception
76
+ if an invalid speed parameter value is passed.
77
+ . imagescale throws an exception if the width/height argument underflows/overflows or
78
+ if the mode argument is invalid.
79
+ imagefilter with IMG_FILTER_SCATTER throws an exception if the sub/plus arguments
80
+ underflows/overflows.
81
+ . Gettext:
82
+ . bind_textdomain_codeset, textdomain and d(*)gettext functions now throw an exception
83
+ if the domain argument is empty.
84
+ . Intl:
85
+ . resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
86
+ ResourceBundle object now throw:
87
+ - TypeError for invalid offset types
88
+ - ValueError for an empty string
89
+ - ValueError if the integer index does not fit in a signed 32 bit integer
90
+ . IntlDateFormatter::__construct() throws a ValueError if the locale is invalid.
91
+ . NumberFormatter::__construct() throws a ValueError if the locale is invalid.
92
+ . MBString:
93
+ . mb_encode_numericentity() and mb_decode_numericentity() now check that
94
+ the $map is only composed of integers, if not a ValueError is thrown.
95
+ . mb_http_input() now always throws a ValueError if the $type is invalid.
96
+ . mb_http_output() now checks that the $encoding parameter does not
97
+ contain any null bytes. If it does, a ValueError is now thrown.
98
+ . ODBC:
99
+ . odbc_fetch_row() now emits a warning when a value less than or equal to 0 is
100
+ passed for parameter $row.
101
+ . PCNTL:
102
+ . The functions pcntl_sigprocmask(), pcntl_sigwaitinfo() and
103
+ pcntl_sigtimedwait() now throw:
104
+ - A ValueError if the $signals array is empty (except for
105
+ pcntl_sigprocmask() if the $mode is SIG_SETMASK).
106
+ - A TypeError if a value of the $signals array is not an integer
107
+ - A ValueError if a value of the $signals array is not a valid signal number
108
+ . The function pcntl_sigprocmask() now throw:
109
+ - A ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
110
+ . The function pcntl_sigtimedwait() now throw:
111
+ - A ValueError if $seconds is less than 0
112
+ - A ValueError if $nanoseconds is less than 0 or greater than 1e9
113
+ - A ValueError if both $seconds and $nanoseconds are 0
114
+ . SimpleXML:
115
+ . Calling simplexml_import_dom() with a non-XML object now throws a
116
+ TypeError instead of a ValueError.
117
+ . Standard:
118
+ . round() now validates the value of the $mode parameter and throws a
119
+ ValueError for invalid modes. Previously invalid modes would have been
120
+ interpreted as PHP_ROUND_HALF_UP.
121
+ . The str_getcsv() function now throws ValueErrors when the $separator and
122
+ $enclosure arguments are not one byte long, or if the $escape is not one
123
+ byte long or the empty string. This aligns the behaviour to be identical
124
+ to that of fputcsv() and fgetcsv().
125
+ . php_uname() now throws ValueErrors if the $move parameter is invalid.
126
+ . The "allowed_classes" option for unserialize() now throws TypeErrors and
127
+ ValueErrors if it is not an array of class names.
128
+ . XMLReader:
129
+ . Passing an invalid character encoding to XMLReader::open() or
130
+ XMLReader::XML() now throws a ValueError.
131
+ . Passing a string containing null bytes previously emitted a
132
+ warning and now throws a ValueError as well.
133
+ . XMLWriter:
134
+ . Passing a string containing null bytes previously emitted a
135
+ warning and now throws a ValueError as well.
136
+ . XSL:
137
+ . XSLTProcessor::setParameter() will now throw a ValueError when its
138
+ arguments contain null bytes. This never actually worked correctly in
139
+ the first place, which is why it throws an exception nowadays.
140
+ . Calling XSLTProcessor::importStyleSheet() with a non-XML object now
141
+ throws a TypeError instead of a ValueError.
142
+ . Failure to call a PHP function callback during evaluation now throws
143
+ instead of emitting a warning.
144
+ RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
50
145
51
146
- DOM:
52
147
. Some DOM methods previously returned false or a PHP_ERR DOMException if a new
@@ -64,20 +159,7 @@ PHP 8.4 UPGRADE NOTES
64
159
. The GMP class is now final and cannot be extended anymore.
65
160
RFC: https://wiki.php.net/rfc/gmp-final
66
161
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
-
75
162
- 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.
81
163
. On invalid strings (those with encoding errors), mb_substr() now interprets
82
164
character indices in the same manner as most other mbstring functions. This
83
165
means that character indices returned by mb_strpos() can be passed to mb_substr().
@@ -103,16 +185,6 @@ PHP 8.4 UPGRADE NOTES
103
185
. The error code reported for MySQL server wait timeouts has been changed from 2006
104
186
to 4031 for MySQL server versions 8.0.24 and above.
105
187
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
-
116
188
- Opcache:
117
189
. The JIT config defaults changed from opcache.jit=tracing and
118
190
opcache.jit_buffer_size=0 to opcache.jit=disable and
@@ -129,19 +201,8 @@ PHP 8.4 UPGRADE NOTES
129
201
130
202
- PCNTL:
131
203
. 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.
204
+ pcntl_sigtimedwait() now always return false on failure.
138
205
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
145
206
146
207
- PCRE:
147
208
. The bundled pcre2lib has been updated to version 10.44.
@@ -150,9 +211,6 @@ PHP 8.4 UPGRADE NOTES
150
211
has changed. Consult https://github.com/PCRE2Project/pcre2/blob/master/NEWS
151
212
for a full changelog.
152
213
153
- - PDO:
154
- . The class constants are typed now.
155
-
156
214
- PDO_DBLIB:
157
215
. setAttribute, DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT
158
216
have been changed to set value as a bool.
@@ -166,34 +224,20 @@ PHP 8.4 UPGRADE NOTES
166
224
- PDO_MYSQL:
167
225
. getAttribute, ATTR_AUTOCOMMIT, ATTR_EMULATE_PREPARES, MYSQL_ATTR_DIRECT_QUERY have
168
226
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.
172
227
173
228
- PDO_PGSQL:
174
229
. The DSN's credentials, when set, are given priority over their PDO
175
230
constructor counterparts, being closer to the documentation states.
176
231
177
- - Reflection:
178
- . The class constants are typed now.
179
-
180
232
- SimpleXML:
181
233
. Get methods called, or casting to a string on a SimpleXMLElement will no
182
234
longer implicitly reset the iterator data, unless explicitly rewound.
183
235
For example, casting an element to a string within a foreach loop would
184
236
cause an infinite loop because it destroyed the current iterator data.
185
237
This is no longer the case as a consequence of the bugfixes for GH-12192,
186
238
GH-12208, #55098.
187
- . Calling simplexml_import_dom() with a non-XML object now throws a TypeError
188
- instead of a ValueError.
189
239
190
240
- 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).
197
241
. SoapClient::$typemap is now an array rather than a resource.
198
242
Checks using is_resource() (i.e. is_resource($client->typemap)) should be
199
243
replaced with checks for null (i.e. $client->typemap !== null).
@@ -202,25 +246,9 @@ PHP 8.4 UPGRADE NOTES
202
246
you will experience errors on startup if you also use the SOAP extension.
203
247
To solve this, either don't use rtld-now or load the session extension.
204
248
205
- - SPL:
206
- . The class constants are typed now.
207
-
208
- - Sqlite:
209
- . The class constants are typed now.
210
-
211
249
- 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.
215
250
. strcspn() with empty $characters now returns the length of the string instead
216
251
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.
224
252
. http_build_query() now correctly handles backed enums.
225
253
. stream_bucket_make_writeable() and stream_bucket_new() will now return a
226
254
StreamBucket instance instead of an instance of stdClass.
@@ -241,26 +269,6 @@ PHP 8.4 UPGRADE NOTES
241
269
Passing an empty string to disable the handler is still allowed,
242
270
but deprecated.
243
271
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
-
264
272
========================================
265
273
2. New Features
266
274
========================================
@@ -615,34 +623,15 @@ PHP 8.4 UPGRADE NOTES
615
623
. trigger_error() and user_error() now have a return type of true instead of
616
624
bool.
617
625
618
- - Curl:
619
- . curl_multi_select throws a ValueError if the timeout argument if it's negative
620
- or greater than PHP_INT_MAX.
621
-
622
626
- DOM:
623
627
. DOMDocument::registerNodeClass() now has a tentative return type of true.
624
628
Previously, the return type was bool but only true could be returned in practice.
625
629
626
- - GD:
627
- . imagejpeg/imagewebp/imagepng/imageavif throws an exception if an invalid
628
- quality parameter value is passed. In addition, imageavif will throw an exception
629
- if an invalid speed parameter value is passed.
630
- . imagescale throws an exception if the width/height argument underflows/overflows or
631
- if the mode argument is invalid.
632
- imagefilter with IMG_FILTER_SCATTER throws an exception if the sub/plus arguments
633
- underflows/overflows.
634
-
635
- - Gettext:
636
- . bind_textdomain_codeset, textdomain and d(*)gettext functions now throw an exception
637
- if the domain argument is empty.
638
-
639
630
- Hash:
640
631
. Changed the return type of hash_update() to true. It was already the case that only
641
632
true could be returned, but the stub was not updated yet.
642
633
643
634
- Intl:
644
- . IntlDateFormatter::__construct() throws a ValueError if the locale is invalid.
645
- . NumberFormatter::__construct() throws a ValueError if the locale is invalid.
646
635
. NumberFormatter::ROUND_TOWARD_ZERO and NumberFormatter::ROUND_AWAY_FROM_ZERO
647
636
have been added as aliases for NumberFormatter::ROUND_DOWN and
648
637
NumberFormatter::ROUND_UP to be consistent with the new PHP_ROUND_* modes.
0 commit comments