forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 8
/
UPGRADING
1205 lines (1026 loc) · 51.4 KB
/
UPGRADING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
PHP 8.4 UPGRADE NOTES
1. Backward Incompatible Changes
2. New Features
3. Changes in SAPI modules
4. Deprecated Functionality
5. Changed Functions
6. New Functions
7. New Classes and Interfaces
8. Removed Extensions and SAPIs
9. Other Changes to Extensions
10. New Global Constants
11. Changes to INI File Handling
12. Windows Support
13. Other Changes
14. Performance Improvements
========================================
1. Backward Incompatible Changes
========================================
- CLI:
. The builtin server looks for an index file recursively by traversing parent
directories in case the specified file cannot be located. This process was
previously skipped if the path looked like it was referring to a file, i.e.
if the last path component contained a period. In that case, a 404 error was
returned. The behavior has been changed to look for an index file in all
cases.
- Core:
. The type of PHP_DEBUG and PHP_ZTS constants changed to bool.
. The name of uploaded files and files created by the tempnam() function are
now 13 bytes longer. Total length is platform-dependent.
. Encountering recursion during comparison now results in a Error exception,
rather than a fatal error.
. Indirect modification of readonly properties within __clone() is no longer
allowed, e.g. $ref = &$this->readonly. This was already forbidden for
readonly initialization, and was an oversight in the "readonly
reinitialization during cloning" implementation.
. The exit (and die) language constructs now behave more like a function.
They can be passed liked callables, are affected by the strict_types
declare statement, and now perform the usual type coercions instead of
casting any non-integer value to a string.
As such, passing invalid types to exit/die may now result in a TypeError
being thrown.
RFC: https://wiki.php.net/rfc/exit-as-function
. The E_STRICT constant was deprecated and its corresponding error level was
removed.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant
- DBA:
. dba_open() and dba_popen() will now return a Dba\Connection
object rather than a resource. Return value checks using is_resource()
should be replaced with checks for `false`.
- DOM:
. Added DOMNode::compareDocumentPosition() and DOMNode::DOCUMENT_POSITION_*
constants.
If you have a method or constant with the same name, you might encounter errors
if the declaration is incompatible.
. Some DOM methods previously returned false or a PHP_ERR DOMException if a new
node could not be allocated. They consistently throw an INVALID_STATE_ERR
DOMException now. This situation is extremely unlikely though and probably
will not affect you. As a result DOMImplementation::createDocument() now has
a tentative return type of DOMDocument instead of DOMDocument|false.
. Previously, DOMXPath objects could be cloned, but resulted in an unusable
object. This is no longer possible, and cloning a DOMXPath object now throws
an error.
. DOMDocument::$actualEncoding, DOMDocument::config, DOMEntity::$actualEncoding,
DOMEntity::$encoding, DOMEntity::$version have been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#formally_deprecate_soft-deprecated_domdocument_and_domentity_properties
- GMP:
. The GMP class is now final and cannot be extended anymore.
RFC: https://wiki.php.net/rfc/gmp-final
. Casting a GMP object to bool changed so that 0 becomes false and everything else
becomes true.
RFC: https://wiki.php.net/rfc/fix_up_bcmath_number_class
- Intl:
. resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
ResourceBundle object now throw:
- TypeError for invalid offset types
- ValueError for an empty string
- ValueError if the integer index does not fit in a signed 32 bit integer
- MBString:
. mb_encode_numericentity() and mb_decode_numericentity() now check that
the $map is only composed of integers, if not a ValueError is thrown.
. mb_http_input() now always throws a ValueError if the $type is invalid.
. mb_http_output() now checks that the $encoding parameter does not
contain any null bytes. If it does, a ValueError is now thrown.
. On invalid strings (those with encoding errors), mb_substr() now interprets
character indices in the same manner as most other mbstring functions. This
means that character indices returned by mb_strpos() can be passed to mb_substr().
. For SJIS-Mac (MacJapanese) strings, character indices passed to mb_substr() now
refer to the indices of the Unicode codepoints which are produced when the string
is converted to Unicode. This is significant because around 40 SJIS-Mac characters
convert to a sequence of multiple Unicode codepoints.
- MySQLnd:
. The error code reported for MySQL server wait timeouts has been changed from 2006
to 4031 for MySQL server versions 8.0.24 and above.
- ODBC:
. odbc_fetch_row() returns false when a value less than or equal to 0 is
passed for parameter $row. Now, a warning is emitted in this case.
. odbc_connect() and odbc_pconnect() will now return an Odbc\Connection
object rather than a resource. Return value checks using is_resource()
should be replaced with checks for `false`.
. odbc_prepare(), odbc_exec(), and various other functions will now return
an Odbc\Result object rather than a resource. Return value checks using
is_resource() should be replaced with checks for `false`.
- Opcache:
. The JIT config defaults changed from opcache.jit=tracing and
opcache.jit_buffer_size=0 to opcache.jit=disable and
opcache.jit_buffer_size=64M, respectively. This does not affect the default
behavior, the JIT is still disabled by default. However, it is now disabled
through the opcache.jit setting, rather than opcache.jit_buffer_size. This
may affect users who previously enabled JIT through opcache.jit_buffer_size
exclusively, without also specifying a JIT mode using opcache.jit. To enable
JIT, set the opcache.jit config value accordingly.
. The maximum value of the opcache.interned_strings_buffer setting on 64bit
architectures is now 32767 (it was previously 4095).
. If JIT is enabled, PHP will now exit with a fatal error on startup in case
of JIT startup initialization issues.
- PCNTL:
. The functions pcntl_sigprocmask(), pcntl_sigwaitinfo() and
pcntl_sigtimedwait() now throw:
- A ValueError if the $signals array is empty (except for
pcntl_sigprocmask() if the $mode is SIG_SETMASK).
- A TypeError if a value of the $signals array is not an integer
- A ValueError if a value of the $signals array is not a valid signal number
Moreover, those functions now always return false on failure.
In some case previously it could return the value -1.
. The function pcntl_sigprocmask() will also now throw:
- A ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
. The function pcntl_sigtimedwait() will also now throw:
- A ValueError if $seconds is less than 0
- A ValueError if $nanoseconds is less than 0 or greater than 1e9
- A ValueError if both $seconds and $nanoseconds are 0
- PCRE:
. The bundled pcre2lib has been updated to version 10.44.
As a consequence, this means {,3} is now recognized as a quantifier instead
of as text. Furthermore, the meaning of some character classes in UCP mode
has changed. Consult https://github.com/PCRE2Project/pcre2/blob/master/NEWS
for a full changelog.
- PDO_DBLIB:
. setAttribute, DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT
have been changed to set value as a bool.
- PDO_FIREBIRD:
. Since some Firebird C++ APIs are used now, this extension requires a C++
compiler to be built. This also implies that the extension has to be built
against fbclient 3.0 or higher.
. getAttribute, ATTR_AUTOCOMMIT has been changed to get the value as a bool.
- PDO_MYSQL:
. getAttribute, ATTR_AUTOCOMMIT, ATTR_EMULATE_PREPARES, MYSQL_ATTR_DIRECT_QUERY have
been changed to get values as bool.
- PDO_PGSQL:
. The DSN's credentials, when set, are given priority over their PDO
constructor counterparts, being closer to the documentation states.
- Reflection:
. Added methods ReflectionClass::newLazyGhost(),
ReflectionClass::newLazyProxy(), ReflectionClass::resetAsLazyGhost(),
ReflectionClass::resetAsLazyProxy(),
ReflectionClass::isUninitializedLazyObject(),
ReflectionClass::initializeLazyObject(),
ReflectionClass::markLazyObjectAsInitialized(),
ReflectionClass::getLazyInitializer(),
ReflectionProperty::skipLazyInitialization(),
ReflectionProperty::setRawValueWithoutLazyInitialization() and constants
ReflectionClass::SKIP_*.
If you have a method or constant with the same name, you might encounter
errors if the declaration is incompatible.
- SimpleXML:
. Get methods called, or casting to a string on a SimpleXMLElement will no
longer implicitly reset the iterator data, unless explicitly rewound.
For example, casting an element to a string within a foreach loop would
cause an infinite loop because it destroyed the current iterator data.
This is no longer the case as a consequence of the bugfixes for GH-12192,
GH-12208, #55098.
. Calling simplexml_import_dom() with a non-XML object now throws a TypeError
instead of a ValueError.
- SOAP:
. SoapClient::$httpurl is now a Soap\Url object rather than a resource.
Checks using is_resource() (i.e. is_resource($client->httpurl)) should be
replaced with checks for null (i.e. $client->httpurl !== null).
. SoapClient::$sdl is now a Soap\Sdl object rather than a resource.
Checks using is_resource() (i.e. is_resource($client->sdl)) should be
replaced with checks for null (i.e. $client->sdl !== null).
. SoapClient::$typemap is now an array rather than a resource.
Checks using is_resource() (i.e. is_resource($client->typemap)) should be
replaced with checks for null (i.e. $client->typemap !== null).
. The SOAP extension gained an optional dependency on the session extension.
If you build PHP without the session extension and with --enable-rtld-now,
you will experience errors on startup if you also use the SOAP extension.
To solve this, either don't use rtld-now or load the session extension.
- SPL:
. Out of bounds accesses in SplFixedArray now throw an exception of type
OutOfBoundsException instead of RuntimeException. As OutOfBoundsException
is a child class of RuntimeException, code that uses RuntimeException
continues to function.
- Standard:
. round() now validates the value of the $mode parameter and throws a ValueError
for invalid modes. Previously invalid modes would have been interpreted as
PHP_ROUND_HALF_UP.
. strcspn() with empty $characters now returns the length of the string instead
of incorrectly stopping at the first NUL character. See GH-12592.
. The str_getcsv() function now throws ValueErrors when the $separator and
$enclosure arguments are not one byte long, or if the $escape is not one
byte long or the empty string. This aligns the behaviour to be identical
to that of fputcsv() and fgetcsv().
. php_uname() now throws ValueErrors on invalid inputs.
. The "allowed_classes" option for unserialize() now throws TypeErrors and
ValueErrors if it is not an array of class names.
. http_build_query() now correctly handles backed enums.
- Tidy:
. Failures in the constructor now throw exceptions rather than emitting
warnings and having a broken object.
- XML:
. The xml_set_*_handler() functions now declare and check for an effective
signature of callable|string|null for the $handler parameters.
Moreover, values of type string that correspond to method names,
of object set with xml_set_object() are now checked to see if the method
exists on the class of the previously passed object.
This means that xml_set_object() must now always be called prior to setting
method names as callables.
Passing an empty string to disable the handler is still allowed,
but deprecated.
- XMLReader:
. Passing an invalid character encoding to XMLReader::open() or
XMLReader::XML() now throws a ValueError. Passing a string containing NULL
bytes previously emitted a warning and now throws a ValueError as well.
- XMLWriter:
. Passing a string containing NULL bytes previously emitted a warning and
now throws a ValueError.
- XSL:
. XSLTProcessor::setParameter() will now throw a ValueError when its arguments
contain null bytes. This never actually worked correctly in the first place,
which is why it throws an exception nowadays.
. Failure to call a PHP function callback during evaluation now throws
instead of emitting a warning.
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
. Calling XSLTProcessor::importStyleSheet() with a non-XML object now throws
a TypeError instead of a ValueError.
========================================
2. New Features
========================================
- Core:
. Added request_parse_body() function that allows parsing RFC1867 (multipart)
requests in non-POST HTTP requests.
RFC: https://wiki.php.net/rfc/rfc1867-non-post
. Getting the debug info for WeakReference will now also output the object
it references, or null if the reference is no longer valid.
. The output of Closure::__debugInfo() now includes the name, file, and line
of the Closure.
. new expressions with constructor arguments are now dereferencable, meaning
they allow chaining method calls, property accesses, etc. without enclosing
the expression in parentheses.
RFC: https://wiki.php.net/rfc/new_without_parentheses
. Added the #[\Deprecated] attribute.
RFC: https://wiki.php.net/rfc/deprecated_attribute
. Implemented property hooks.
RFC: https://wiki.php.net/rfc/property-hooks
. Exiting a namespace now clears seen symbols. This allows using a symbol in a
namespace block, even if a previous namespace block declared a symbol with
the same name.
See Zend/tests/use_function/ns_end_resets_seen_symbols_1.phpt.
. Implemented asymmetric property visibility.
RFC: https://wiki.php.net/rfc/asymmetric-visibility-v2
. Implemented lazy objects.
RFC: https://wiki.php.net/rfc/lazy-objects
- Curl:
. curl_version() returns an additional feature_list value, which is an
associative array of all known Curl features, and whether they are
supported (true) or not (false).
. Added CURL_HTTP_VERSION_3 and CURL_HTTP_VERSION_3ONLY constants (available
since libcurl 7.66 and 7.88) as available options for CURLOPT_HTTP_VERSION.
. Added CURLOPT_PREREQFUNCTION as a Curl option that accepts a callback to
be called after the connection is made, but before the request is sent.
The callback must return either CURL_PREREQFUNC_OK or CURL_PREREQFUNC_ABORT
to allow or abort the request.
. Added CURLOPT_SERVER_RESPONSE_TIMEOUT, which was formerly known as
CURLOPT_FTP_RESPONSE_TIMEOUT. Both constants hold the same value.
- Date:
. Added static methods
DateTime[Immutable]::createFromTimestamp(int|float $timestamp): static.
. Added method DateTime[Immutable]::getMicrosecond(): int.
. Added method
DateTime[Immutable]::setMicrosecond(int $microsecond): static.
- DOM:
. Added constant DOMNode::DOCUMENT_POSITION_DISCONNECTED.
. Added constant DOMNode::DOCUMENT_POSITION_PRECEDING.
. Added constant DOMNode::DOCUMENT_POSITION_FOLLOWING.
. Added constant DOMNode::DOCUMENT_POSITION_CONTAINS.
. Added constant DOMNode::DOCUMENT_POSITION_CONTAINED_BY.
. Added constant DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC.
. It is now possible to pass any callable to registerPhpFunctions().
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
- FPM:
. Flushing headers without a body will now succeed. See GH-12785.
. Status page has a new field to display a memory peak.
- Hash:
. Added HashContext::__debugInfo().
- Intl:
. NumberFormatter::ROUND_HALFODD added to complement existing
NumberFormatter::ROUND_HALFEVEN functionality.
- OpenSSL:
. Added support for Curve25519 + Curve448 based keys. Specifically x25519,
ed25519, x448 and ed448 fields are supported in openssl_pkey_new and
openssl_pkey_get_details as well as openssl_sign and openssl_verify were
extended to support those keys.
. Implement PASSWORD_ARGON2 password hashing.
Requires OpenSSL 3.2 and NTS build.
- PCRE:
. The bundled pcre2lib has been updated to version 10.44.
As a consequence, LoongArch JIT support has been added, spaces
are now allowed between braces in Perl-compatible items, and
variable-length lookbehind assertions are now supported.
. With pcre2lib version 10.44, the maximum length of named capture groups
has changed from 32 to 128.
. Added support for the "r" (PCRE2_EXTRA_CASELESS_RESTRICT) modifier, as well
as the (?r) mode modifier. When enabled along with the case-insensitive
modifier ("i"), the expression locks out mixing of ASCII and non-ASCII
characters.
- PDO:
. Added support for driver-specific subclasses.
RFC: https://wiki.php.net/rfc/pdo_driver_specific_subclasses
This RFC adds subclasses for PDO in order to better support
database-specific functionalities. The new classes are
instantiatable either via calling the PDO::connect() method
or by invoking their constructor directly.
. Added support for driver specific SQL parsers. The default parser supports:
- single and double quoted literals, with doubling as escaping mechanism.
- two-dashes and non-nested C-style comments.
RFC: https://wiki.php.net/rfc/pdo_driver_specific_parsers
- PDO_DBLIB:
. Added class Pdo\DbLib.
- PDO_FIREBIRD:
. Added class Pdo\Firebird.
- PDO_MYSQL:
. Added class Pdo\Mysql.
. Added custom parser supporting:
- single and double-quoted literals, with doubling and backslash as escaping
mechanism
- backtick literal identifiers and with doubling as escaping mechanism
- two dashes followed by at least 1 whitespace, non-nested C-style comments,
and hash-comments
RFC: https://wiki.php.net/rfc/pdo_driver_specific_parsers
- PDO_ODBC:
. Added class Pdo\Odbc.
- PDO_PGSQL:
. Added class Pdo\Pgsql.
. Added custom parser supporting:
- single and double quoted literals, with doubling as escaping mechanism
- C-style "escape" string literals (E'string')
- dollar-quoted string literals
- two-dashes and C-style comments (non-nested)
- support for "??" as escape sequence for the "?" operator
RFC: https://wiki.php.net/rfc/pdo_driver_specific_parsers
- PDO_SQLITE:
. Added class Pdo\Sqlite.
. Added custom parser supporting:
- single, double quoted, and backtick literals, with doubling as escaping mechanism
- square brackets quoting for identifiers
- two-dashes and C-style comments (non-nested)
RFC: https://wiki.php.net/rfc/pdo_driver_specific_parsers
- PgSQL:
. Added pg_result_memory_size to get the visibility the memory used by a query result.
- Phar:
. Added support for the unix timestamp extension for zip archives.
- POSIX:
. Added constant POSIX_SC_CHILD_MAX
. Added constant POSIX_SC_CLK_TCK
- Readfile:
. Added ability to change .php_history path through PHP_HISTFILE env variable.
- Reflection:
. ReflectionAttribute now contains a $name property to improve the debugging
experience.
. ReflectionClassConstant::__toString() and ReflectionProperty::__toString()
now returns the attached doc comments.
. ReflectionConstant was introduced.
. ReflectionClassConstant::isDeprecated() was introduced.
. ReflectionGenerator::isClosed() was introduced.
. Multiple methods and constants related to lazy objects were introduced:
- ReflectionClass::newLazyGhost()
- ReflectionClass::newLazyProxy()
- ReflectionClass::resetAsLazyGhost()
- ReflectionClass::resetAsLazyProxy()
- ReflectionClass::isUninitializedLazyObject()
- ReflectionClass::initializeLazyObject()
- ReflectionClass::markLazyObjectAsInitialized()
- ReflectionClass::getLazyInitializer()
- ReflectionProperty::skipLazyInitialization()
- ReflectionProperty::setRawValueWithoutLazyInitialization()
- ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE
- ReflectionClass::SKIP_DESTRUCTOR
RFC: https://wiki.php.net/rfc/lazy-objects
. ReflectionProperty::isDynamic() was introduced.
- SOAP:
. Added support for clark notation for namespaces in class map.
It is now possible to specify entries in a class map with clark notation
to resolve a type with a specific namespace to a specific class.
For example: '{http://example.com}foo' => 'FooClass'.
. Instances of DateTimeInterface that are passed to xsd:datetime or similar
elements are now serialized as such instead of being serialized as an
empty string.
. Session persistence now works with a shared session module.
- Standard:
. stream_bucket_make_writeable() and stream_bucket_new() will now return a
StreamBucket instance instead of an instance of stdClass.
RFC: https://wiki.php.net/rfc/dedicated_stream_bucket
. Added a new RoundingMode enum with clearer naming and improved discoverability
compared to the PHP_ROUND_* constants.
RFC: https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum
- XSL:
. It is now possible to use parameters that contain both single and double
quotes.
. It is now possible to pass any callable to registerPhpFunctions().
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
. Added XSLTProcessor::$maxTemplateDepth and XSLTProcessor::$maxTemplateVars
to control the recursion depth of XSL template evaluation.
========================================
3. Changes in SAPI modules
========================================
- apache2handler
. Support for EOL Apache 2.0 and 2.2 has been removed. Minimum required Apache
version is now 2.4.
- FPM:
. /dev/poll events.mechanism setting for Solaris/Illumos had been retired.
========================================
4. Deprecated Functionality
========================================
- Core:
. Implicitly nullable parameter types are now deprecated.
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
. Passing E_USER_ERROR to trigger_error() is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
. Using "_" as a class name is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
- Curl:
. The CURLOPT_BINARYTRANSFER constant is deprecated.
- Date:
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is
deprecated. Use DatePeriod::createFromISO8601String() instead.
. Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and
SUNFUNCS_RET_DOUBLE are now deprecated, following the deprecation of
the associated date_sunset() and date_sunrise() functions in PHP 8.1.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#constants_sunfuncs_ret_string_sunfuncs_ret_double_sunfuncs_ret_timestamp
- DBA:
. Passing null or false to dba_key_split() is deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split
- DOM:
. Deprecated DOM_PHP_ERR constant.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_dom_php_err_constant
- Hash:
. Deprecated passing incorrect data types for options to ext/hash functions.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_incorrect_data_types_for_options_to_exthash_functions
- Intl:
. Calling intlcal_set() as well as calling IntlCalendar::set() with
more than 2 arguments is deprecated. Use either IntlCalendar::setDate()
or IntlCalendar::setDateTime() instead.
. Calling intlgregcal_create_instance() as well as calling
IntlGregorianCalendar::__construct() with more than 2 arguments is
deprecated. Use either IntlGregorianCalendar::createFromDate() or
IntlGregorianCalendar::createFromDateTime() instead.
- LDAP:
. Calling ldap_connect() with more than 2 arguments is deprecated. Use
ldap_connect_wallet() instead.
. Calling ldap_exop() with more than 4 arguments is deprecated. Use
ldap_exop_sync() instead.
- Mysqli:
. The mysqli_ping() function and mysqli::ping() method are now deprecated,
as the reconnect feature was removed in PHP 8.2.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#mysqli_ping_and_mysqliping
. The mysqli_kill() function and mysqli::kill() method are now deprecated.
If this functionality is needed a SQL "KILL" command can be used instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_mysqli_kill
. The mysqli_refresh() function and mysqli::refresh() method are now deprecated.
If this functionality is needed a SQL "FLUSH" command can be used instead.
All MYSQLI_REFRESH_* constants have been deprecated as well.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_mysqli_refresh
. Passing explicitly the $mode parameter to mysqli_store_result() has been
deprecated. As the MYSQLI_STORE_RESULT_COPY_DATA constant was only used in
conjunction with this function it has also been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_the_second_parameter_to_mysqli_store_result
- PDO_PGSQL:
. Using escaped question marks (??) inside dollar-quoted strings is deprecated.
Since PDO_PGSQL has its own SQL parser with dollar-quoted strings support, it
is no longer necessary to escape question marks inside them.
- PgSQL:
. Calling pg_fetch_result() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
. Calling pg_field_prtlen() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
. Calling pg_field_is_null() with 2 arguments is deprecated. Use the
3-parameter signature with a null $row parameter instead.
- Random:
. lcg_value() is deprecated, as the function is broken in multiple ways.
Use \Random\Randomizer::getFloat() instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_lcg_value
- Reflection:
. Calling ReflectionMethod::__construct() with 1 argument is deprecated.
Use ReflectionMethod::createFromMethodName() instead.
- Session:
. Calling session_set_save_handler() with more than 2 arguments is
deprecated. Use the 2-parameter signature instead.
. Changing the INI settings session.sid_length and session.sid_bits_per_character
is deprecated. Update the session storage backend to accept 32 character
hexadecimal session IDs and stop changing these two INI settings.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character
. Changing the INI settings session.use_only_cookies, session.use_trans_sid,
session.trans_sid_tags, session.trans_sid_hosts, and session.referer_check
is deprecated.
RFC: https://wiki.php.net/rfc/deprecate-get-post-sessions
- SOAP:
. Passing an int to SoapServer::addFunction() is now deprecated.
If all PHP functions need to be provided flatten the array returned by
get_defined_functions().
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
. The SOAP_FUNCTIONS_ALL constant is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
- SPL:
. The SplFixedArray::__wakeup() method has been deprecated as it implements
__serialize() and __unserialize() which need to be overwritten instead.
. Using the default value for $escape parameter of:
- SplFileObject::setCsvControl()
- SplFileObject::fputcsv()
- SplFileObject::fgetcsv()
is now deprecated. It must be passed explicitly either positionally or via named arguments.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_proprietary_csv_escaping_mechanism
- Standard:
. Calling stream_context_set_option() with 2 arguments is deprecated.
Use stream_context_set_options() instead.
. Raising zero to the power of negative number is deprecated.
RFC: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number
. Unserializing strings using the uppercase 'S' tag is deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#unserialize_s_s_tag
. Using the default value for $escape parameter of:
- fputcsv()
- fgetcsv()
- str_getcsv()
is now deprecated. It must be passed explicitly either positionally or via named arguments.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_proprietary_csv_escaping_mechanism
- XML:
. The xml_set_object() function has been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
. Passing non-callable strings to the xml_set_*_handler() functions is now
deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names
========================================
5. Changed Functions
========================================
- Core:
. trigger_error() and user_error() now have a return type of true instead of
bool.
- Curl:
. curl_multi_select throws a ValueError if the timeout argument if it's negative
or greater than PHP_INT_MAX.
- DOM:
. DOMDocument::registerNodeClass() now has a tentative return type of true.
Previously, the return type was bool but only true could be returned in practice.
- GD:
. imagejpeg/imagewebp/imagepng/imageavif throws an exception if an invalid
quality parameter value is passed. In addition, imageavif will throw an exception
if an invalid speed parameter value is passed.
. imagescale throws an exception if the width/height argument underflows/overflows or
if the mode argument is invalid.
imagefilter with IMG_FILTER_SCATTER throws an exception if the sub/plus arguments
underflows/overflows.
- Gettext:
. bind_textdomain_codeset, textdomain and d(*)gettext functions now throw an exception
if the domain argument is empty.
- Hash:
. Changed the return type of hash_update() to true. It was already the case that only
true could be returned, but the stub was not updated yet.
- Intl:
. IntlDateFormatter::__construct() throws a ValueError if the locale is invalid.
. NumberFormatter::__construct() throws a ValueError if the locale is invalid.
. NumberFormatter::ROUND_TOWARD_ZERO and NumberFormatter::ROUND_AWAY_FROM_ZERO
have been added as aliases for NumberFormatter::ROUND_DOWN and
NumberFormatter::ROUND_UP to be consistent with the new PHP_ROUND_* modes.
RFC: https://wiki.php.net/rfc/new_rounding_modes_to_round_function
. ResourceBundle::get() now has a tentative return type of:
ResourceBundle|array|string|int|null
- LibXML:
. libxml_set_streams_context() now immediately throws a TypeError when a
non-stream-context resource is passed to the function, instead of throwing
later when the stream context is used.
- MBString:
. The behavior of mb_strcut is more consistent now on invalid UTF-8 and UTF-16
strings. (For valid UTF-8 and UTF-16 strings, there is no change.)
- ODBC:
. Parameter $row of odbc_fetch_object(), odbc_fetch_array(), and
odbc_fetch_into() now has a default value of null, consistent with
odbc_fetch_row(). Previously, the default values were -1, -1, and 0,
respectively.
- OpenSSL:
. The extra_attributes parameter in openssl_csr_new sets CSR attributes
instead of subject DN which was incorrectly done previously.
. The dn parameter in openssl_csr_new allows setting array of values for
a single entry.
. New serial_hex parameter added to openssl_csr_sign to allow setting serial
number in the hexadecimal format.
. Parsing ASN.1 UTCTime by openssl_x509_parse fails if seconds are omitted
for OpenSSL version below 3.2 (-1 is returned for such fields). The
OpenSSL version 3.3+ does not load such certificates already.
- Output:
. Output handler status flags passed to the flags parameter of ob_start
are now cleared.
- PDO:
. getAttribute, enabled to get the value of ATTR_STRINGIFY_FETCHES.
- PDO_FIREBIRD:
. getAttribute, enabled to get values of FB_ATTR_DATE_FORMAT, FB_ATTR_TIME_FORMAT,
FB_ATTR_TIMESTAMP_FORMAT.
. Added new attributes to specify transaction isolation level and access mode.
Along with these, five constants (Pdo\Firebird::TRANSACTION_ISOLATION_LEVEL,
Pdo\Firebird::READ_COMMITTED, Pdo\Firebird::REPEATABLE_READ,
Pdo\Firebird::SERIALIZABLE, Pdo\Firebird::WRITABLE_TRANSACTION) have been added.
. When using persistent connections, there is now a liveness check in the
constructor.
. The content that is built changes depending on the value of FB_API_VER in
ibase.h, so added static method Pdo\Firebird::getApiVersion() to obtain that
value. This value can also be referenced from phpinfo.
. Five new data types are now available: INT128, DEC16, DEC34, TIMESTAMP_TZ, TIME_TZ.
These are available starting with Firebird 4.0.
- PDO_MYSQL:
. getAttribute, enabled to get the value of ATTR_FETCH_TABLE_NAMES.
- PDO_PGSQL:
. getAttribute() can now retrieve the memory usage of query results.
PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE was added for this feature.
. If the column is of FLOAT4OID/FLOAT8OID type, query returns it as a
float instead of a string.
- PGSQL:
. pg_select, the conditions arguments accepts an empty array and is optional.
- Phar:
. Phar::setAlias() and Phar::setDefaultStub() methods now have a tentative
return type of true instead of bool.
- POSIX:
. posix_isatty now sets the error number when the file descriptor/stream argument
is invalid.
- Reflection:
. ReflectionGenerator::getFunction() may now be called after the generator
finished executing.
- Sockets:
. Parameter $backlog of socket_create_listen() now has a default value of SOMAXCONN.
Previously, it was 128.
- SPL:
. SplPriorityQueue::insert() and SplPriorityQueue::recoverFromCorruption()
now has a tentative return type of true
. SplHeap::insert() and SplHeap::recoverFromCorruption()
now has a tentative return type of true instead of bool
- Standard:
. The internal implementation for rounding to integers has been rewritten
to be easier to verify for correctness and to be easier to maintain.
Some rounding bugs have been fixed as a result of the rewrite. For
example previously rounding 0.49999999999999994 to the nearest integer
would have resulted in 1.0 instead of the correct result 0.0. Additional
inputs might also be affected and result in different outputs compared to
earlier PHP versions.
. The $mode parameter of the round() function has been widened to RoundingMode|int,
accepting instances of a new RoundingMode enum.
RFC: https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum
. Four new modes have been added to the round() function: RoundingMode::PositiveInfinity,
RoundingMode::NegativeInfinity, RoundingMode::TowardsZero, RoundingMode::AwayFromZero.
RFC: https://wiki.php.net/rfc/new_rounding_modes_to_round_function
. Fixed a bug caused by "pre-rounding" of the round() function. Previously, using
"pre-rounding" to treat a value like 0.285 (actually 0.28499999999999998) as a
decimal number and round it to 0.29. However, "pre-rounding" incorrectly rounds
certain numbers, so this fix removes "pre-rounding" and changes the way numbers
are compared, so that the values are correctly rounded as decimal numbers.
. The maximum precision that can be handled by round() has been extended by one
digit. For example, `round(4503599627370495.5)` returned in `4503599627370495.5`,
but now returns `4503599627370496`.
. The default value of the 'cost' option for PASSWORD_BCRYPT for password_hash()
has been increased from '10' to '12'.
RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
. debug_zval_dump() now indicates whether an array is packed.
. long2ip() now returns string instead of string|false.
. output_add_rewrite_var() now uses url_rewriter.hosts instead of
session.trans_sid_hosts for selecting hosts that will be rewritten.
. highlight_string() now has a return type of string|true instead of string|bool.
. print_r() now has a return type of string|true instead of string|bool.
========================================
6. New Functions
========================================
- BCMath:
. Added bcfloor(), bcceil(), bcround().
RFC: https://wiki.php.net/rfc/adding_bcround_bcfloor_bcceil_to_bcmath
- DOM:
. Added DOMNode::compareDocumentPosition().
. Added DOMXPath::registerPhpFunctionNS().
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
. Added DOMXPath::quote() to quote a string for use in an XPath expression.
Example usage: "//span[contains(text()," . $xpath->quote($string) . ")]"
- Intl:
. Added IntlDateFormatter::getIanaID()/intltz_get_iana_id() to
the IANA identifier from a given timezone.
. Added grapheme_str_split which allow to support emoji and Variation
Selectors.
RFC: https://wiki.php.net/rfc/grapheme_str_split
. Added IntlDateFormatter::parseToCalendar which behaves like
IntlDateFormatter::parse except the time zone is updated.
. Added SpoofChecker::setAllowedChars to limit the range of unicode
chars.
- MBString:
. Added mb_trim, mb_ltrim and mb_rtrim functions.
RFC: https://wiki.php.net/rfc/mb_trim
Note: this was amended by GH-13820 to fix GH-13815.
. Added mb_ucfirst and mb_lcfirst functions.
RFC: https://wiki.php.net/rfc/mb_ucfirst
- PCNTL:
. Added pcntl_setns allowing a process to be reassociated with a namespace in order
to share resources with other processes within this context.
. Added pcntl_getcpuaffinity to get the cpu(s) bound to a process and
pcntl_setcpuaffinity to bind 1 or more cpus to a process.
. Added pcntl_getcpu to get the cpu id from where the current process runs.
. Added pcntl_getqos_class to get the QoS level (aka performance and related
energy consumption) of the current process and pcntl_setqos_class to set it.
. Added pcntl_waitid to obtain status information pertaining to termination, stop,
and/or continue events in one of the caller's child processes.
- PDO_PGSQL:
. Added Pdo\Pgsql::setNoticeCallback() to allow a callback to be triggered on
every notice sent (e.g. RAISE NOTICE).
- PGSQL:
. Added pg_change_password to alter a given user's password. It handles
transparently the password encryption from the database settings.
. Added pg_put_copy_data to send COPY commands and pg_put_copy_end to send
end-of-data to the server.
. Added pg_socket_poll to check if there is any read and/or write events
with an optional timeout.
. Added pg_jit to get informations on the server JIT support.
. Added pg_set_chunked_rows_size to allow to fetch results in chunk of
max N rows.
- Reflection:
. Multiple methods related to lazy objects were introduced:
- ReflectionClass::newLazyGhost()
- ReflectionClass::newLazyProxy()
- ReflectionClass::resetAsLazyGhost()
- ReflectionClass::resetAsLazyProxy()
- ReflectionClass::isUninitializedLazyObject()
- ReflectionClass::initializeLazyObject()
- ReflectionClass::markLazyObjectAsInitialized()
- ReflectionClass::getLazyInitializer()
- ReflectionProperty::skipLazyInitialization()
- ReflectionProperty::setRawValueWithoutLazyInitialization()
RFC: https://wiki.php.net/rfc/lazy-objects
- Sodium:
. Added the sodium_crypto_aead_aegis128l_*() and sodium_crypto_aead_aegis256l_*()
functions to support the AEGIS family of authenticated encryption algorithms,
that was introduced in libsodium 1.0.19.
. sodium_crypto_aead_aes256gcm_*() functions are now enabled on aarch64 CPUs
with the ARM cryptographic extensions.
- SPL:
. Added seek() method to SplObjectStorage, now it implements
SeekableIterator.
- SOAP:
. Added SoapServer::__getLastResponse(). This only tracks the last response
if the trace option is set to true in the SoapServer constructor's $options
argument.
- Standard:
. Added the http_get_last_response_headers() and
http_clear_last_response_headers() that allows retrieving the same content
as the magic $http_response_header variable.
RFC: https://wiki.php.net/rfc/http-last-response-headers
. Added function fpow() following rules of IEEE 754.
RFC: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number
. Added functions array_find(), array_find_key(), array_all(), and
array_any().
RFC: https://wiki.php.net/rfc/array_find
- Tidy:
. Added tidyNode::getNextSibling() and tidyNode::getPreviousSibling().
- XMLReader:
. Added XMLReader::fromStream(), XMLReader::fromUri(), XMLReader::fromString().
RFC: https://wiki.php.net/rfc/xmlreader_writer_streams
- XMLWriter:
. Added XMLWriter::toStream(), XMLWriter::toUri(), XMLWriter::toMemory().
RFC: https://wiki.php.net/rfc/xmlreader_writer_streams
- XSL:
. Added XSLTProcessor::registerPhpFunctionNS().
RFC: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
========================================
7. New Classes and Interfaces
========================================
- BCMath:
. Added BcMath\Number class. It is an immutable object, has methods that are
equivalent to existing BCMath calculation functions, and can also be calculated
using operators.
The existing BCMath function returned a string for each calculation, but this
class returns an object.
RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath,
https://wiki.php.net/rfc/fix_up_bcmath_number_class
- Core:
. New RequestParseBodyException.
RFC: https://wiki.php.net/rfc/rfc1867-non-post
- DOM:
. Implemented DOM HTML5 parsing and serialization.
RFC: https://wiki.php.net/rfc/domdocument_html5_parser.
This RFC adds the new Dom namespace along with new classes and
constant aliases.
There are two new classes to handle HTML and XML documents:
Dom\HTMLDocument and Dom\XMLDocument.
These classes provide a cleaner API to handle HTML and XML documents.
Furthermore, the Dom\HTMLDocument class implements spec-compliant HTML5
parsing and serialization.
. Implemented opt-in ext/dom spec compliance RFC.
This adds new classes in the DOM namespace that correspond to modern
equivalents to the old DOM classes in the global namespaces.
The new classes follow the DOM living spec.
RFC: https://wiki.php.net/rfc/opt_in_dom_spec_compliance
. Implemented "New ext-dom features in PHP 8.4" RFC.
RFC: https://wiki.php.net/rfc/dom_additions_84
========================================
8. Removed Extensions and SAPIs
========================================
- IMAP:
. The IMAP extension has been unbundled and moved to PECL.
RFC: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
- OCI8:
. The OCI8 extension has been unbundled and moved to PECL.
RFC: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
- PDO_OCI:
. The PDO_OCI extension has been unbundled and moved to PECL.
RFC: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
- PSpell:
. The pspell extension has been unbundled and moved to PECL.
RFC: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
========================================
9. Other Changes to Extensions
========================================
- Curl:
. The Curl extension now requires at least libcurl 7.61.0.
. The CURLOPT_DNS_USE_GLOBAL_CACHE Curl option no longer has any
effect, and is silently ignored. This underlying feature was
deprecated in libcurl 7.11.1 and removed in 7.62.0.
- Date:
. The class constants are typed now.
- DOM:
. Removed DOMImplementation::getFeature().
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_domimplementationgetfeature_feature_version
- Intl:
. The class constants are typed now.
. The behaviour of Intl class has been normalized to always throw Error
exceptions when attempting to use a non-initialized object,
or when cloning fails.
. The idn_to_ascii() and idn_to_utf8() now always throw ValueErrors if the
$domain name is empty or too long, and if $variant is not
INTL_IDNA_VARIANT_UTS46.
- LibXML:
. The libxml extension now requires at least libxml2 2.9.4.
- MBString:
. Unicode data tables have been updated to Unicode 16.0.
- Mysqli:
. The unused and undocumented constant MYSQLI_SET_CHARSET_DIR
has been removed.
. The MYSQLI_STMT_ATTR_PREFETCH_ROWS constant has been removed.
The feature is unavailable with mysqlnd.
. The MYSQLI_CURSOR_TYPE_FOR_UPDATE and MYSQLI_CURSOR_TYPE_SCROLLABLE
constants have been removed. This functionality was never implemented,
neither with mysqlnd nor with libmysql.
. The unused MYSQLI_TYPE_INTERVAL constant, which is currently a stub
and an alias for MYSQLI_TYPE_ENUM, has been removed. There are no
plans to add such data type to MySQL yet, so it's unclear what its value
would finally be.
. A new constant has been added: MYSQLI_TYPE_VECTOR.
- Mysqlnd:
. Support for the new VECTOR data type from MySQL 9.
- OpenSSL:
. The OpenSSL extension now requires at least OpenSSL 1.1.1.
- PDO:
. The class constants are typed now.
- PDO_PGSQL:
. The pdo_pgsql extension now requires at least libpq 10.0.