-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeprecated.html
2400 lines (1978 loc) · 147 KB
/
deprecated.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Deprecated Features in PHP 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4, 5.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Lito && Óscar Otero">
<meta name="title" content="Deprecated Features in PHP 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4, 5.3">
<meta property="og:type" content="website">
<meta property="og:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta property="og:title" content="Deprecated Features in PHP 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4, 5.3">
<meta property="og:image" content="./images/social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta name="twitter:site" content="@lito_ordes">
<meta name="twitter:creator" content="@lito_ordes">
<meta name="twitter:title" content="Deprecated Features in PHP 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4, 5.3">
<meta name="twitter:image" content="./images/social.png">
<link href="//fonts.googleapis.com/css?family=Fira+Sans|Droid+Sans|Source+Sans+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="./phpnet.css?1744308666" type="text/css" media="screen">
<link rel="stylesheet" href="./styles.css?1744308666" type="text/css" media="screen">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<meta name="theme-color" content="#ffffff">
</head>
<body class="docs">
<section class="info-wrapper">
<nav id="head-nav" class="navbar">
<h1><a href="index.html"> Deprecated Features in PHP 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4, 5.3</a></h1>
</nav>
<main class="info-main">
<article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration84.deprecated.php" target="_blank">PHP 8.4</a></h1>
</header>
<div id="migration84.deprecated" class="sect1">
<h2 class="title">Deprecated Features</h2>
<div class="sect2" id="migration84.deprecated.core">
<h3 class="title">PHP Core</h3>
<div class="sect3" id="migration84.deprecated.core.implicitly-nullable-parameter">
<h4 class="title">Implicitly nullable parameter</h4>
<p class="simpara">
A parameter's type is implicitly widened to accept <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.null.php" class="type null">null</a></span>
if the default value for it is <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong>.
</p>
<p class="para">
The following code:
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">T1 $a </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
should be converted to:
<div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">T1</span><span style="color: #007700">|</span><span style="color: #0000BB">null $a </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
or
<div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(?</span><span style="color: #0000BB">T1 $a </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
<p class="para">
However, if such a parameter declaration is followed by a mandatory
parameter:
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">T1 $a</span><span style="color: #007700">, </span><span style="color: #0000BB">T2 $b </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #0000BB">T3 $c</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
It must be converted to:
<div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">T1 $a</span><span style="color: #007700">, </span><span style="color: #0000BB">T2</span><span style="color: #007700">|</span><span style="color: #0000BB">null $b</span><span style="color: #007700">, </span><span style="color: #0000BB">T3 $c</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
or
<div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">T1 $a</span><span style="color: #007700">, ?</span><span style="color: #0000BB">T2 $b</span><span style="color: #007700">, </span><span style="color: #0000BB">T3 $c</span><span style="color: #007700">) {}</span></span></code></div>
</div>
</div>
as optional parameter before required ones are deprecated.
</div>
<div class="sect3">
<h4 class="title">Raising zero to the power of negative number</h4>
<p class="simpara">
Raising a number to the power of a negative number is equivalent to taking
the reciprocal of the number raised to the positive opposite of the power.
That is, <code class="literal">10<sup class="superscript">-2</sup></code> is the same as
<code class="literal">1 / 10<sup class="superscript">2</sup></code>.
Therefore raising <code class="literal">0</code> to the power of a negative number
corresponds to dividing by <code class="literal">0</code>, i.e.
<code class="literal">0<sup class="superscript">-2</sup></code> is the same as
<code class="literal">1 / 0<sup class="superscript">2</sup></code>, or
<code class="literal">1 / 0</code>. Thus, this behavior has been deprecated.
</p>
<p class="simpara">
This affects the exponentiation operator <code class="literal">**</code>
and the <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.pow.php" class="function">pow()</a></span> function.
</p>
<p class="simpara">
If the IEEE 754 semantics are desired one should use the new
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.fpow.php" class="function">fpow()</a></span> function.
</p>
</div>
<div class="sect3" id="migration84.deprecated.core.underscore-class-name">
<h4 class="title">Using underscore <code class="literal">_</code> as class name</h4>
<p class="para">
Naming a class <code class="literal">_</code> is now deprecated:
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">class </span><span style="color: #0000BB">_ </span><span style="color: #007700">{}</span></span></code></div>
</div>
</div>
<blockquote class="note"><p><strong class="note">Note</strong>:
</p><p class="para">
Classes whose names start with an underscore are <em>not</em>
deprecated:
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">class </span><span style="color: #0000BB">_MyClass </span><span style="color: #007700">{}</span></span></code></div>
</div>
</div>
</blockquote>
</div>
<div class="sect3">
<h4 class="title">
Using <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.trigger-error.php" class="function">trigger_error()</a></span> with
<strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-user-error">E_USER_ERROR</a></code></strong>
</h4>
<p class="simpara">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.trigger-error.php" class="function">trigger_error()</a></span> with
<code class="parameter">error_level</code> being equal to
<strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-user-error">E_USER_ERROR</a></code></strong> is now deprecated.
</p>
<p class="simpara">
Such usages should be replaced by either throwing an exception,
or calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.exit.php" class="function">exit()</a></span>, whichever is more appropriate.
</p>
</div>
<div class="sect3">
<h4 class="title">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-strict">E_STRICT</a></code></strong> constant
</h4>
<p class="simpara">
Because the <strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-strict">E_STRICT</a></code></strong> error level was removed,
this constant is now deprecated.
</p>
</div>
</div>
<div class="sect2" id="migration84.deprecated.core.curl">
<h3 class="title">cURL</h3>
<p class="simpara">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/curl.constants.php#constant.curlopt-binarytransfer">CURLOPT_BINARYTRANSFER</a></code></strong> constant is now deprecated.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.date">
<h3 class="title">Date</h3>
<p class="simpara">
The <code class="code"> DatePeriod::__construct(string $isostr, int $options = 0)</code>
signature has been deprecated.
Use <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/dateperiod.createfromiso8601string.php" class="methodname">DatePeriod::createFromISO8601String()</a></span> instead.
</p>
<p class="simpara">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/datetime.constants.php#constant.sunfuncs-ret-timestamp">SUNFUNCS_RET_TIMESTAMP</a></code></strong>,
<strong><code><a target="_blank" href="https://www.php.net/manual/en/datetime.constants.php#constant.sunfuncs-ret-string">SUNFUNCS_RET_STRING</a></code></strong>,
and <strong><code><a target="_blank" href="https://www.php.net/manual/en/datetime.constants.php#constant.sunfuncs-ret-double">SUNFUNCS_RET_DOUBLE</a></code></strong> constants are now deprecated.
This follows from the deprecation of the <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-sunset.php" class="function">date_sunset()</a></span> and
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-sunrise.php" class="function">date_sunrise()</a></span> functions in PHP 8.1.0.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.dba">
<h3 class="title">DBA</h3>
<p class="simpara">
Passing <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong> or <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.false">false</a></code></strong> to <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.dba-key-split.php" class="function">dba_key_split()</a></span> is now
deprecated.
It would always return <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.false">false</a></code></strong> in those cases.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.dom">
<h3 class="title">DOM</h3>
<p class="simpara">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/dom.constants.php#constant.dom-php-err">DOM_PHP_ERR</a></code></strong> constant is now deprecated.
</p>
<p class="para">
The following properties have been formally deprecated:
</p><ul class="simplelist"><li><span class="property"><a target="_blank" href="https://www.php.net/manual/en/class.domdocument.php#domdocument.props.actualencoding">DOMDocument::$actualEncoding</a></span></li>
<li><span class="property"><a target="_blank" href="https://www.php.net/manual/en/class.domdocument.php#domdocument.props.config">DOMDocument::$config</a></span></li>
<li><span class="property"><a target="_blank" href="https://www.php.net/manual/en/class.domentity.php#domentity.props.actualencoding">DOMEntity::$actualEncoding</a></span></li>
<li><span class="property"><a target="_blank" href="https://www.php.net/manual/en/class.domentity.php#domentity.props.encoding">DOMEntity::$encoding</a></span></li>
<li><span class="property"><a target="_blank" href="https://www.php.net/manual/en/class.domentity.php#domentity.props.version">DOMEntity::$version</a></span></li>
</ul></div>
<div class="sect2" id="migration84.deprecated.core.hash">
<h3 class="title">Hash</h3>
<p class="simpara">
Passing invalid options to hash functions is now deprecated.
</p>
</div>
<div class="sect2" id="migration84.deprecated.intl">
<h3 class="title">Intl</h3>
<p class="simpara">
Calling <span class="function"><strong>intlcal_set()</strong></span> or
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlcalendar.set.php" class="methodname">IntlCalendar::set()</a></span>
with more than two arguments is deprecated.
Use either <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlcalendar.setdate.php" class="methodname">IntlCalendar::setDate()</a></span> or
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlcalendar.setdatetime.php" class="methodname">IntlCalendar::setDateTime()</a></span> instead.
</p>
<p class="simpara">
Calling <span class="function"><strong>intlgregcal_create_instance()</strong></span> or
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlgregoriancalendar.construct.php" class="methodname">IntlGregorianCalendar::__construct()</a></span>
with more than two arguments is deprecated.
Use either <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlgregoriancalendar.createfromdate.php" class="methodname">IntlGregorianCalendar::createFromDate()</a></span> or
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlgregoriancalendar.createfromdatetime.php" class="methodname">IntlGregorianCalendar::createFromDateTime()</a></span> instead.
</p>
</div>
<div class="sect2" id="migration84.deprecated.ldap">
<h3 class="title">LDAP</h3>
<p class="simpara">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.ldap-connect.php" class="function">ldap_connect()</a></span>
with more than two arguments is deprecated.
Use <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.ldap-connect-wallet.php" class="function">ldap_connect_wallet()</a></span> instead.
</p>
<p class="simpara">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.ldap-exop.php" class="function">ldap_exop()</a></span>
with more than four arguments is deprecated.
Use <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.ldap-exop-sync.php" class="function">ldap_exop_sync()</a></span> instead.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.mysqli">
<h3 class="title">MySQLi</h3>
<p class="simpara">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/mysqli.ping.php" class="function">mysqli_ping()</a></span> function and
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/mysqli.ping.php" class="methodname">mysqli::ping()</a></span> method
are now deprecated as the reconnect feature was removed in PHP 8.2.0.
</p>
<p class="simpara">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/mysqli.kill.php" class="function">mysqli_kill()</a></span> function and
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/mysqli.kill.php" class="methodname">mysqli::kill()</a></span> method
are now deprecated.
If this functionality is needed a SQL <code class="literal">KILL</code> command
can be used instead.
</p>
<p class="simpara">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/mysqli.refresh.php" class="function">mysqli_refresh()</a></span> function and
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/mysqli.refresh.php" class="methodname">mysqli::refresh()</a></span> method
are now deprecated.
If this functionality is needed a SQL <code class="literal">FLUSH</code> command
can be used instead.
All <strong><code><a target="_blank" href="https://www.php.net/manual/en/mysqli.constants.php#constant.mysqli-refresh-grant">MYSQLI_REFRESH_<span class="replaceable">*</span></a></code></strong>
constants have been deprecated as well.
</p>
<p class="simpara">
Passing the <code class="parameter">mode</code> parameter to
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/mysqli.store-result.php" class="function">mysqli_store_result()</a></span> explicitly has been deprecated.
As the <strong><code><a target="_blank" href="https://www.php.net/manual/en/mysqli.constants.php#constant.mysqli-store-result-copy-data">MYSQLI_STORE_RESULT_COPY_DATA</a></code></strong> constant was
only used in conjunction with this function it has also been deprecated.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.pdo-pgsql">
<h3 class="title">PDO_PGSQL</h3>
<p class="simpara">
Using escaped question marks (<code class="literal">??</code>) inside
dollar-quoted strings is deprecated.
Because PDO_PGSQL now has its own SQL parser with dollar-quoted strings
support, it is no longer necessary to escape question marks inside them.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.pgsql">
<h3 class="title">PGSQL</h3>
<p class="simpara">
The 2 arguments signature of <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.pg-fetch-result.php" class="function">pg_fetch_result()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.pg-field-prtlen.php" class="function">pg_field_prtlen()</a></span>, and
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.pg-field-is-null.php" class="function">pg_field_is_null()</a></span> is now deprecated.
Use the 3 arguments signature with <code class="parameter">row</code> set to
<strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong> instead.
</p>
</div>
<div class="sect2" id="migration84.deprecated.random">
<h3 class="title">Random</h3>
<p class="simpara">
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.lcg-value.php" class="function">lcg_value()</a></span> is now deprecated,
as the function is broken in multiple ways.
Use <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/random-randomizer.getfloat.php" class="methodname">Random\Randomizer::getFloat()</a></span> instead.
</p>
</div>
<div class="sect2" id="migration84.deprecated.reflection">
<h3 class="title">Reflection</h3>
<p class="simpara">
Calling <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/reflectionmethod.construct.php" class="methodname">ReflectionMethod::__construct()</a></span>
with one arguments is deprecated.
Use <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/reflectionmethod.createfrommethodname.php" class="methodname">ReflectionMethod::createFromMethodName()</a></span> instead.
</p>
</div>
<div class="sect2" id="migration84.deprecated.session">
<h3 class="title">Session</h3>
<p class="simpara">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.session-set-save-handler.php" class="function">session_set_save_handler()</a></span>
with more than two arguments is deprecated.
Use the two arguments signature instead.
</p>
<p class="simpara">
Changing the value of the
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length" class="link"><code class="literal">session.sid_length</code></a> and
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character" class="link"><code class="literal">session.sid_bits_per_character</code></a>
INI settings is deprecated.
Update the session storage backend to accept 32 character hexadecimal
session IDs and stop changing these two INI settings instead.
</p>
<p class="simpara">
Changing the value of the
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.use-only-cookies" class="link"><code class="literal">session.use_only_cookies</code></a>,
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.use-trans-sid" class="link"><code class="literal">session.use_trans_sid</code></a>,
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.trans-sid-tags" class="link"><code class="literal">session.trans_sid_tags</code></a>,
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.trans-sid-hosts" class="link"><code class="literal">session.trans_sid_hosts</code></a>, and
<a target="_blank" href="https://www.php.net/manual/en/session.configuration.php#ini.session.referer-check" class="link"><code class="literal">session.referer_check</code></a>
INI settings is deprecated.
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/session.constants.php#constant.sid">SID</a></code></strong> constant is also deprecated.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.soap">
<h3 class="title">SOAP</h3>
<p class="simpara">
Passing an <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.integer.php" class="type int">int</a></span> to
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/soapserver.addfunction.php" class="methodname">SoapServer::addFunction()</a></span> is now deprecated.
If all PHP functions need to be provided flatten the array returned by
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.get-defined-functions.php" class="function">get_defined_functions()</a></span>.
</p>
<p class="simpara">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/soap.constants.php#constant.soap-functions-all">SOAP_FUNCTIONS_ALL</a></code></strong> constant is now deprecated.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.spl">
<h3 class="title">SPL</h3>
<p class="simpara">
The <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfixedarray.wakeup.php" class="methodname">SplFixedArray::__wakeup()</a></span> method is now
deprecated, as it implements
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfixedarray.serialize.php" class="methodname">SplFixedArray::__serialize()</a></span> and
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfixedarray.unserialize.php" class="methodname">SplFixedArray::__unserialize()</a></span>
which need to be overwritten instead.
</p>
<p class="simpara">
Using the default value for the <code class="parameter">escape</code> parameter for the
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.setcsvcontrol.php" class="methodname">SplFileObject::setCsvControl()</a></span>,
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.fputcsv.php" class="methodname">SplFileObject::fputcsv()</a></span>, and
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.fgetcsv.php" class="methodname">SplFileObject::fgetcsv()</a></span> is now deprecated.
It must be passed explicitly either positionally or via named arguments.
This does not apply to <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.fputcsv.php" class="methodname">SplFileObject::fputcsv()</a></span>
and <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.fgetcsv.php" class="methodname">SplFileObject::fgetcsv()</a></span> if
<span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/splfileobject.setcsvcontrol.php" class="methodname">SplFileObject::setCsvControl()</a></span> was used to set a
new default value.
</p>
</div>
<div class="sect2" id="migration84.deprecated.standard">
<h3 class="title">Standard</h3>
<p class="simpara">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.stream-context-set-option.php" class="function">stream_context_set_option()</a></span>
with two arguments is deprecated.
Use <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.stream-context-set-options.php" class="function">stream_context_set_options()</a></span> instead.
</p>
<p class="simpara">
Unserializing strings using the uppercase <code class="literal">S</code> tag
with <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.unserialize.php" class="function">unserialize()</a></span> is deprecated.
</p>
<p class="simpara">
Using the default value for the <code class="parameter">escape</code> parameter for the
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.fputcsv.php" class="function">fputcsv()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.fgetcsv.php" class="function">fgetcsv()</a></span>, and
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.str-getcsv.php" class="function">str_getcsv()</a></span> is now deprecated.
It must be passed explicitly either positionally or via named arguments.
</p>
</div>
<div class="sect2" id="migration84.deprecated.core.xml">
<h3 class="title">XML</h3>
<p class="simpara">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.xml-set-object.php" class="function">xml_set_object()</a></span> function has been deprecated.
</p>
<p class="simpara">
Passing non-<span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.callable.php" class="type callable">callable</a></span> strings to the
<span class="function"><strong>xml_set_()</strong><span class="replaceable">*</span></span>
functions is now deprecated.
</p>
</div>
</div></article><article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration83.deprecated.php" target="_blank">PHP 8.3</a></h1>
</header>
<div id="migration83.deprecated" class="sect1">
<h2 class="title">Deprecated Features</h2>
<div class="sect2" id="migration83.deprecated.core">
<h3 class="title">PHP Core</h3>
<div class="sect3" id="migration83.deprecated.core.saner-inc-dec-operators">
<h4 class="title">Saner Increment/Decrement operators</h4>
<p class="para">
Using the <a target="_blank" href="https://www.php.net/manual/en/language.operators.increment.php" class="link">increment</a>
operator (<code class="literal">++</code>) on empty, non-numeric,
or non-alphanumeric strings is now deprecated.
Moreover, incrementing non-numeric strings is soft deprecated.
That means no <strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong> diagnostic is emitted,
but this feature should not be used when producing new code.
The new <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.str-increment.php" class="function">str_increment()</a></span> function should be used instead.
</p>
<p class="para">
Using the <a target="_blank" href="https://www.php.net/manual/en/language.operators.increment.php" class="link">decrement</a>
operator (<code class="literal">--</code>) on empty or non-numeric strings is now deprecated.
</p>
</div>
<div class="sect3" id="migration83.deprecated.core.get-class">
<h4 class="title">get_class()/get_parent_class() call without arguments</h4>
<p class="para">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.get-class.php" class="function">get_class()</a></span> and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.get-parent-class.php" class="function">get_parent_class()</a></span>
without arguments is now deprecated.
</p>
</div>
</div>
<div class="sect2" id="migration83.deprecated.core.dba">
<h3 class="title">DBA</h3>
<p class="para">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.dba-fetch.php" class="function">dba_fetch()</a></span> with <code class="parameter">$dba</code> as
the 3rd argument is now deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.ffi">
<h3 class="title">FFI</h3>
<p class="para">
Calling <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/ffi.cast.php" class="methodname">FFI::cast()</a></span>, <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/ffi.new.php" class="methodname">FFI::new()</a></span>,
and <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/ffi.type.php" class="methodname">FFI::type()</a></span> statically is now deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.intl">
<h3 class="title">Intl</h3>
<p class="para">
The <strong><code>U_MULTIPLE_DECIMAL_SEP*E*RATORS</code></strong>
constant had been deprecated, using the
<strong><code>U_MULTIPLE_DECIMAL_SEP*A*RATORS</code></strong>
constant instead is recommended.
</p>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/class.numberformatter.php#numberformatter.constants.type-currency">NumberFormatter::TYPE_CURRENCY</a></code></strong> constant has been deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.ldap">
<h3 class="title">LDAP</h3>
<p class="para">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.ldap-connect.php" class="function">ldap_connect()</a></span> with separate
<code class="parameter">$hostname</code> and <code class="parameter">$port</code> is
deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.mbstring">
<h3 class="title">MBString</h3>
<p class="para">
Passing a negative <code class="parameter">$width</code> to
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mb-strimwidth.php" class="function">mb_strimwidth()</a></span> is now deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.phar">
<h3 class="title">Phar</h3>
<p class="para">
Calling <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/phar.setstub.php" class="methodname">Phar::setStub()</a></span> with a
<span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.resource.php" class="type resource">resource</a></span> and a <code class="parameter">$length</code>
is now deprecated. Such calls should be replaced by:
<code class="code">$phar->setStub(stream_get_contents($resource));</code>
</p>
</div>
<div class="sect2" id="migration83.deprecated.random">
<h3 class="title">Random</h3>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/random.constants.php#constant.mt-rand-php">MT_RAND_PHP</a></code></strong> Mt19937 variant is deprecated.
</p>
</div>
<div class="sect2" id="migration83.deprecated.reflection">
<h3 class="title">Reflection</h3>
<p class="para">
Calling <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/reflectionproperty.setvalue.php" class="methodname">ReflectionProperty::setValue()</a></span> with only one
parameter is deprecated.
To set static properties, pass <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong> as the first parameter.
</p>
</div>
<div class="sect2" id="migration83.deprecated.standard">
<h3 class="title">Standard</h3>
<p class="para">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.assert-options.php" class="function">assert_options()</a></span> function is now deprecated.
</p>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/info.constants.php#constant.assert-active">ASSERT_ACTIVE</a></code></strong>, <strong><code><a target="_blank" href="https://www.php.net/manual/en/info.constants.php#constant.assert-bail">ASSERT_BAIL</a></code></strong>,
<strong><code><a target="_blank" href="https://www.php.net/manual/en/info.constants.php#constant.assert-callback">ASSERT_CALLBACK</a></code></strong>, <strong><code><a target="_blank" href="https://www.php.net/manual/en/info.constants.php#constant.assert-exception">ASSERT_EXCEPTION</a></code></strong>,
and <strong><code><a target="_blank" href="https://www.php.net/manual/en/info.constants.php#constant.assert-warning">ASSERT_WARNING</a></code></strong> constants have been deprecated.
</p>
<p class="para">
The <code class="literal">assert.*</code> INI settings have been deprecated.
See the
<a target="_blank" href="https://www.php.net/manual/en/migration83.other-changes.php#migration83.other-changes.ini" class="link">Changes to INI File Handling</a>
page for further details.
</p>
</div>
<div class="sect2" id="migration83.deprecated.sqlite3">
<h3 class="title">SQLite3</h3>
<p class="para">
Using exceptions is now preferred, warnings will be removed in the future.
Calling <code class="code">SQLite3::enableExceptions(false)</code> will trigger a
deprecation warning in this version.
</p>
</div>
<div class="sect2" id="migration83.deprecated.zip">
<h3 class="title">Zip</h3>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/zip.constants.php#ziparchive.constants.fl-recompress">ZipArchive::FL_RECOMPRESS</a></code></strong> constant is deprecated
and will be removed in a future version of libzip.
</p>
</div>
</div></article><article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration82.deprecated.php" target="_blank">PHP 8.2</a></h1>
</header>
<div id="migration82.deprecated" class="sect1">
<h2 class="title">Deprecated Features</h2>
<div class="sect2" id="migration82.deprecated.core">
<h3 class="title">PHP Core</h3>
<div class="sect3" id="migration82.deprecated.core.dynamic-properties">
<h4 class="title">Usage of dynamic properties</h4>
<p class="para">
The creation of dynamic properties is deprecated, unless the class opts in by
using the <code class="code">#[\AllowDynamicProperties]</code> attribute.
<span class="classname"><a target="_blank" href="https://www.php.net/manual/en/class.stdclass.php" class="classname">stdClass</a></span> allows dynamic properties.
Usage of the <a target="_blank" href="https://www.php.net/manual/en/language.oop5.overloading.php#object.get" class="link">__get()</a>/<a target="_blank" href="https://www.php.net/manual/en/language.oop5.overloading.php#object.set" class="link">__set()</a> magic methods is not affected by this change.
A dynamic properties deprecation warning can be addressed by:
</p><ul class="simplelist"><li>Declaring the property (preferred).</li>
<li>
Adding the <code class="code">#[\AllowDynamicProperties]</code> attribute to the class
(which also applies to all child classes).
</li>
<li>
Using a <span class="classname"><a target="_blank" href="https://www.php.net/manual/en/class.weakmap.php" class="classname">WeakMap</a></span> if additional data needs to be
associated with an object which one does not own.
</li>
</ul></div>
<div class="sect3" id="migration82.deprecated.core.relative-callables">
<h4 class="title">Relative callables</h4>
<p class="para">
Callables that are not accepted by the <code class="code">$callable()</code> syntax
(but are accepted by <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.call-user-func.php" class="function">call_user_func()</a></span>) are deprecated.
In particular:
</p><ul class="simplelist"><li><code class="code">"self::method"</code></li>
<li><code class="code">"parent::method"</code></li>
<li><code class="code">"static::method"</code></li>
<li><code class="code">["self", "method"]</code></li>
<li><code class="code">["parent", "method"]</code></li>
<li><code class="code">["static", "method"]</code></li>
<li><code class="code">["Foo", "Bar::method"]</code></li>
<li><code class="code">[new Foo, "Bar::method"]</code></li>
</ul>
This does not affect normal method callables such as
<code class="code">"A::method"</code> or <code class="code">["A", "method"]</code>.
</div>
<div class="sect3" id="migration82.deprecated.core.dollar-brace-interpolation">
<h4 class="title"><code class="code">"${var}"</code> and <code class="code">"${expr}"</code> style interpolation</h4>
<p class="para">
The <code class="code">"${var}"</code> and <code class="code">"${expr}"</code> style of string
interpolation is deprecated.
Use <code class="code">"$var"/"{$var}"</code> and <code class="code">"{${expr}}"</code>, respectively.
</p>
</div>
</div>
<div class="sect2" id="migration82.deprecated.mbstring">
<h3 class="title">MBString</h3>
<p class="para">
Usage of the <code class="literal">QPrint</code>, <code class="literal">Base64</code>,
<code class="literal">Uuencode</code>, and <code class="literal">HTML-ENTITIES</code>
'text encodings' is deprecated for all MBString functions.
Unlike all the other text encodings supported by MBString,
these do not encode a sequence of Unicode codepoints, but rather a sequence of raw bytes.
It is not clear what the correct return values for most MBString functions
should be when one of these non-encodings is specified.
Moreover, PHP has separate, built-in implementations of all of them;
for example, UUencoded data can be handled using
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.convert-uuencode.php" class="function">convert_uuencode()</a></span>/<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.convert-uudecode.php" class="function">convert_uudecode()</a></span>.
</p>
</div>
<div class="sect2" id="migration82.deprecated.spl">
<h3 class="title">SPL</h3>
<p class="para">
The internal <span class="methodname"><strong>SplFileInfo::_bad_state_ex()</strong></span> method
has been deprecated.
</p>
</div>
<div class="sect2" id="migration82.deprecated.standard">
<h3 class="title">Standard</h3>
<p class="para">
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.utf8-encode.php" class="function">utf8_encode()</a></span> and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.utf8-decode.php" class="function">utf8_decode()</a></span>
have been deprecated.
</p>
</div>
</div></article><article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration81.deprecated.php" target="_blank">PHP 8.1</a></h1>
</header>
<div id="migration81.deprecated" class="sect1">
<h2 class="title">Deprecated Features</h2>
<div class="sect2" id="migration81.deprecated.core">
<h3 class="title">PHP Core</h3>
<div class="sect3" id="migration81.deprecated.core.serialize-interface">
<h4 class="title">
Implementing <span class="interfacename"><a target="_blank" href="https://www.php.net/manual/en/class.serializable.php" class="interfacename">Serializable</a></span> without
<span class="function"><strong>__serialize()</strong></span> and <span class="function"><strong>__unserialize()</strong></span>
</h4>
<p class="para">
Either only the new methods should be implemented, if no support for
PHP prior to version 7.4 is provided, or both should be implemented.
</p>
</div>
<div class="sect3" id="migration81.deprecated.core.null-not-nullable-internal">
<h4 class="title">Passing <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong> to non-nullable parameters of built-in functions</h4>
<p class="para">
Scalar types for built-in functions are nullable by default.
This behaviour is deprecated to align with the behaviour of user-defined
functions, where scalar types need to be marked as nullable explicitly.
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">str_contains</span><span style="color: #007700">(</span><span style="color: #DD0000">"foobar"</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">));<br></span><span style="color: #FF8000">// Deprecated: Passing null to parameter #2 ($needle) of type string<br>// is deprecated<br></span><span style="color: #0000BB">?></span></span></code></div>
</div>
</div>
</div>
<div class="sect3" id="migration81.deprecated.core.implicit-float-conversion">
<h4 class="title">Implicit incompatible <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.float.php" class="type float">float</a></span> to <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.integer.php" class="type int">int</a></span> conversions</h4>
<p class="para">
The implicit conversion of <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.float.php" class="type float">float</a></span> to <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.integer.php" class="type int">int</a></span> which
leads to a loss in precision is now deprecated.
This affects <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.array.php" class="type array">array</a></span> keys, <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.integer.php" class="type int">int</a></span> type declarations in coercive mode,
and operators working on <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.integer.php" class="type int">int</a></span>s.
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br />$a </span><span style="color: #007700">= [];<br></span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #0000BB">15.5</span><span style="color: #007700">]; </span><span style="color: #FF8000">// deprecated, as key value loses the 0.5 component<br></span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #0000BB">15.0</span><span style="color: #007700">]; </span><span style="color: #FF8000">// ok, as 15.0 == 15<br></span><span style="color: #0000BB">?></span></span></code></div>
</div>
</div>
</div>
<div class="sect3" id="migration81.deprecated.core.static-trait">
<h4 class="title">Calling a <span class="modifier">static</span> element on a trait</h4>
<p class="para">
Calling a <span class="modifier">static</span> method, or accessing a
<span class="modifier">static</span> property directly on a trait is deprecated.
Static methods and properties should only be accessed on a class using the trait.
</p>
</div>
<div class="sect3" id="migration81.deprecated.core.magic-sleep">
<h4 class="title">Returning a non-<span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.array.php" class="type array">array</a></span> from <span class="function"><strong>__sleep()</strong></span></h4>
<p class="para">
Returning a value which is not an <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.array.php" class="type array">array</a></span> from
<a target="_blank" href="https://www.php.net/manual/en/language.oop5.magic.php#object.sleep" class="link">__sleep()</a> now generates a diagnostic.
</p>
</div>
<div class="sect3" id="migration81.deprecated.core.void-by-ref">
<h4 class="title">Returning by reference from a <span class="type"><span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.void.php" class="type void">void</a></span></span> function</h4>
<p class="para">
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #007700">function &</span><span style="color: #0000BB">test</span><span style="color: #007700">(): </span><span style="color: #0000BB">void </span><span style="color: #007700">{}<br></span><span style="color: #0000BB">?></span></span></code></div>
</div>
</div>
Such a function is contradictory, and already emits the following
<strong><code><a target="_blank" href="https://www.php.net/manual/en/errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> when called:
<code class="literal">Only variable references should be returned by reference</code>.
</div>
<div class="sect3" id="migration81.deprecated.core.autovivification-false">
<h4 class="title">Autovivification from <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.false">false</a></code></strong></h4>
<p class="para">
Autovivification is the process of creating a new <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.array.php" class="type array">array</a></span> when
appending to a value.
Autovivification is prohibited from scalar values, <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.false">false</a></code></strong> however
was an exception. This is now deprecated.
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br />$arr </span><span style="color: #007700">= </span><span style="color: #0000BB">false</span><span style="color: #007700">;<br></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #0000BB">2</span><span style="color: #007700">; </span><span style="color: #FF8000">// deprecated<br></span><span style="color: #0000BB">?></span></span></code></div>
</div>
</div>
<blockquote class="note"><p><strong class="note">Note</strong>:
</p><p class="para">
Autovivification from <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.null">null</a></code></strong> and undefined values is still allowed:
</p><div class="informalexample">
<div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php <br /></span><span style="color: #FF8000">// From undefined<br></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #DD0000">'some value'</span><span style="color: #007700">;<br></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[</span><span style="color: #DD0000">'doesNotExist'</span><span style="color: #007700">][] = </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br></span><span style="color: #FF8000">// From null<br></span><span style="color: #0000BB">$arr </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br></span><span style="color: #0000BB">?></span></span></code></div>
</div>
</div>
</blockquote>
</div>
</div>
<div class="sect2" id="migration81.deprecated.ctype">
<h3 class="title">ctype</h3>
<div class="sect3" id="migration81.deprecated.ctype.nonstring-arguments">
<h4 class="title">Verifying non-string arguments</h4>
<p class="para">
Passing a non-string argument is deprecated.
In the future, the argument will be interpreted as a string instead
of an ASCII codepoint.
Depending on the intended behavior, the argument should either be
cast to <span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.string.php" class="type string">string</a></span> or an explicit call to
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.chr.php" class="function">chr()</a></span> should be made.
All <code class="literal">ctype_*()</code> functions are affected.
</p>
</div>
</div>
<div class="sect2" id="migration81.deprecated.date">
<h3 class="title">Date</h3>
<p class="para">
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-sunrise.php" class="function">date_sunrise()</a></span> and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-sunset.php" class="function">date_sunset()</a></span>
have been deprecated in favor of <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-sun-info.php" class="function">date_sun_info()</a></span>.
</p>
<p class="para">
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.strptime.php" class="function">strptime()</a></span> has been deprecated.
Use <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span> instead (for locale-independent parsing),
or <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intldateformatter.parse.php" class="methodname">IntlDateFormatter::parse()</a></span> (for locale-dependent parsing).
</p>
<p class="para">
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.strftime.php" class="function">strftime()</a></span> and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.gmstrftime.php" class="function">gmstrftime()</a></span> have been deprecated.
Use <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.date.php" class="function">date()</a></span> instead (for locale-independent formatting),
or <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intldateformatter.format.php" class="methodname">IntlDateFormatter::format()</a></span> (for locale-dependent formatting).
</p>
</div>
<div class="sect2" id="migration81.deprecated.filter">
<h3 class="title">Filter</h3>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_STRING</a></code></strong> and
<strong><code><a target="_blank" href="https://www.php.net/manual/en/filter.constants.php#constant.filter-sanitize-stripped">FILTER_SANITIZE_STRIPPED</a></code></strong> filters are deprecated.
</p>
<p class="para">
The <a target="_blank" href="https://www.php.net/manual/en/filter.configuration.php#ini.filter.default" class="link">filter.default</a>
INI directive is deprecated.
</p>
</div>
<div class="sect2" id="migration81.deprecated.gd">
<h3 class="title">GD</h3>
<p class="para">
The <code class="parameter">num_points</code> of <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.imagepolygon.php" class="function">imagepolygon()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.imageopenpolygon.php" class="function">imageopenpolygon()</a></span> and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.imagefilledpolygon.php" class="function">imagefilledpolygon()</a></span>
has been deprecated.
</p>
</div>
<div class="sect2" id="migration81.deprecated.hash">
<h3 class="title">Hash</h3>
<p class="para">
The <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mhash.php" class="function">mhash()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mhash-keygen-s2k.php" class="function">mhash_keygen_s2k()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mhash-count.php" class="function">mhash_count()</a></span>,
<span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mhash-get-block-size.php" class="function">mhash_get_block_size()</a></span>,
and <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mhash-get-hash-name.php" class="function">mhash_get_hash_name()</a></span> have been deprecated.
Use the <code class="literal">hash_*()</code> functions instead.
</p>
</div>
<div class="sect2" id="migration81.deprecated.imap">
<h3 class="title">IMAP</h3>
<p class="para">
The <strong><code><a target="_blank" href="https://www.php.net/manual/en/imap.constants.php#constant.nil">NIL</a></code></strong> constant has been deprecated.
Use <code class="literal">0</code> instead.
</p>
</div>
<div class="sect2" id="migration81.deprecated.intl">
<h3 class="title">Intl</h3>
<p class="para">
Calling <span class="methodname"><a target="_blank" href="https://www.php.net/manual/en/intlcalendar.roll.php" class="methodname">IntlCalendar::roll()</a></span> with a
<span class="type"><a target="_blank" href="https://www.php.net/manual/en/language.types.boolean.php" class="type bool">bool</a></span> argument is deprecated.
Use <code class="literal">1</code> and <code class="literal">-1</code> instead of
<strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.true">true</a></code></strong> and <strong><code><a target="_blank" href="https://www.php.net/manual/en/reserved.constants.php#constant.false">false</a></code></strong> respectively.
</p>
</div>
<div class="sect2" id="migration81.deprecated.mbstring">
<h3 class="title">Multibyte String</h3>
<p class="para">
Calling <span class="function"><a target="_blank" href="https://www.php.net/manual/en/function.mb-check-encoding.php" class="function">mb_check_encoding()</a></span> without any arguments
is deprecated.
</p>