Skip to content

Commit 40e722c

Browse files
authored
Merge branch 'master' into partials
2 parents fa3ae37 + 9a1da9f commit 40e722c

File tree

71 files changed

+536
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+536
-250
lines changed

UPGRADING

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,26 @@ PHP 8.1 UPGRADE NOTES
3737
// is deprecated
3838

3939
RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
40-
. When a method using static variables is inherited, the inherited method
41-
will now initialize the static variables to their original values, rather
42-
than the values at the time of inheritance:
40+
. When a method using static variables is inherited (but not overridden), the
41+
inherited method will now share static variables with the parent method.
4342

4443
class A {
45-
public function counter() {
44+
public static function counter() {
4645
static $counter = 0;
4746
$counter++;
4847
return $counter;
4948
}
5049
}
50+
class B extends A {}
5151

52-
var_dump((new A)->counter()); // int(1)
52+
var_dump(A::counter()); // int(1)
53+
var_dump(A::counter()); // int(2)
54+
var_dump(B::counter()); // int(3), previously int(1)
55+
var_dump(B::counter()); // int(4), previously int(2)
5356

54-
eval('class B extends A {}'); // eval() to prevent early binding.
55-
56-
var_dump((new B)->counter()); // int(1), previously int(2)
57-
var_dump((new A)->counter()); // int(2)
58-
var_dump((new B)->counter()); // int(2), previously int(3)
59-
60-
Previously the behavior would be different depending on whether A::counter()
61-
was called before class B was declared, or after it was declared.
57+
This means that static variables in methods now behave the same way as
58+
static properties.
59+
RFC: https://wiki.php.net/rfc/static_variable_inheritance
6260

6361
- Fileinfo:
6462
. The fileinfo functions now accept and return, respectively, finfo objects
@@ -254,6 +252,13 @@ PHP 8.1 UPGRADE NOTES
254252
4. Deprecated Functionality
255253
========================================
256254

255+
- Core:
256+
. Implementing the Serializable interface without also implementing
257+
__serialize() and __unserialize() has been deprecated. You should either
258+
implement the new methods (if you only support PHP 7.4 and higher) or
259+
implement both (if you support older PHP versions as well).
260+
RFC: https://wiki.php.net/rfc/phase_out_serializable
261+
257262
- MySQLi:
258263
. The mysqli_driver::$driver_version property has been deprecated. The driver
259264
version is meaningless as it hasn't been updated in more than a decade. Use
@@ -263,6 +268,10 @@ PHP 8.1 UPGRADE NOTES
263268
mysqli_get_client_info() without any arguments to obtain the client
264269
library version information.
265270

271+
- PDO:
272+
. The PDO::FETCH_SERIALIZE mode has been deprecated.
273+
RFC: https://wiki.php.net/rfc/phase_out_serializable
274+
266275
========================================
267276
5. Changed Functions
268277
========================================

Zend/Optimizer/pass1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
268268

269269
if ((cc = zend_hash_find_ptr(&ce->constants_table,
270270
Z_STR(ZEND_OP2_LITERAL(opline)))) != NULL &&
271-
(Z_ACCESS_FLAGS(cc->value) & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
271+
(ZEND_CLASS_CONST_FLAGS(cc) & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
272272
c = &cc->value;
273273
if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
274274
zend_ast *ast = Z_ASTVAL_P(c);

Zend/Optimizer/zend_func_info.c

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ typedef struct _func_info_t {
4444
{name, sizeof(name)-1, (MAY_BE_RC1 | (info)), NULL}
4545
#define FN(name, info) \
4646
{name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
47-
#define FR(name, info) \
48-
{name, sizeof(name)-1, (MAY_BE_REF | (info)), NULL}
49-
#define FX(name, info) \
50-
{name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | (info)), NULL}
5147
#define FC(name, callback) \
5248
{name, sizeof(name)-1, 0, callback}
5349

@@ -89,12 +85,9 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
8985
}
9086
}
9187

92-
#define UNKNOWN_INFO (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF)
93-
9488
static const func_info_t func_infos[] = {
9589
/* zend */
9690
F1("zend_version", MAY_BE_STRING),
97-
FN("func_get_arg", UNKNOWN_INFO),
9891
FN("func_get_args", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
9992
F1("get_class_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
10093
F1("get_class_methods", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
@@ -211,7 +204,7 @@ static const func_info_t func_infos[] = {
211204
F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
212205
F1("base64_encode", MAY_BE_STRING),
213206
F1("password_hash", MAY_BE_STRING),
214-
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
207+
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
215208
F1("convert_uuencode", MAY_BE_STRING),
216209
F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING),
217210
F1("pow", MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT),
@@ -249,14 +242,7 @@ static const func_info_t func_infos[] = {
249242
F1("get_current_user", MAY_BE_STRING),
250243
F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
251244
F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
252-
FN("call_user_func", UNKNOWN_INFO),
253-
FN("call_user_func_array", UNKNOWN_INFO),
254-
FN("call_user_method", UNKNOWN_INFO),
255-
FN("call_user_method_array", UNKNOWN_INFO),
256-
FN("forward_static_call", UNKNOWN_INFO),
257-
FN("forward_static_call_array", UNKNOWN_INFO),
258245
F1("serialize", MAY_BE_STRING),
259-
FN("unserialize", UNKNOWN_INFO),
260246
F1("var_export", MAY_BE_NULL | MAY_BE_STRING),
261247
F1("print_r", MAY_BE_TRUE | MAY_BE_STRING),
262248
F0("register_shutdown_function", MAY_BE_NULL | MAY_BE_FALSE),
@@ -359,19 +345,10 @@ static const func_info_t func_infos[] = {
359345
F0("usort", MAY_BE_TRUE),
360346
F0("uasort", MAY_BE_TRUE),
361347
F0("uksort", MAY_BE_TRUE),
362-
FN("end", UNKNOWN_INFO),
363-
FN("prev", UNKNOWN_INFO),
364-
FN("next", UNKNOWN_INFO),
365-
FN("reset", UNKNOWN_INFO),
366-
FN("current", UNKNOWN_INFO),
367-
FN("min", UNKNOWN_INFO),
368-
FN("max", UNKNOWN_INFO),
369348
F1("compact", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
370349
F1("array_fill", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
371350
F1("array_fill_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
372351
FC("range", zend_range_info),
373-
FN("array_pop", UNKNOWN_INFO),
374-
FN("array_shift", UNKNOWN_INFO),
375352
F1("array_splice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
376353
F1("array_slice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
377354
F1("array_replace", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
@@ -381,7 +358,6 @@ static const func_info_t func_infos[] = {
381358
F1("array_count_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
382359
F1("array_column", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
383360
F1("array_reverse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
384-
F1("array_reduce", UNKNOWN_INFO),
385361
F1("array_flip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
386362
F1("array_change_key_case", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
387363
FN("array_rand", MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
@@ -403,8 +379,6 @@ static const func_info_t func_infos[] = {
403379
F1("array_filter", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
404380
F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
405381
F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
406-
F1("pos", UNKNOWN_INFO),
407-
F1("assert_options", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
408382
F1("str_rot13", MAY_BE_STRING),
409383
F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
410384
F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
@@ -417,7 +391,7 @@ static const func_info_t func_infos[] = {
417391
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
418392
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
419393
F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
420-
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
394+
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
421395
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
422396
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
423397
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
@@ -460,7 +434,7 @@ static const func_info_t func_infos[] = {
460434
F1("mysqli_query", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT),
461435
F1("mysqli_get_charset", MAY_BE_NULL | MAY_BE_OBJECT),
462436
F1("mysqli_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
463-
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
437+
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
464438
F1("mysqli_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
465439
F1("mysqli_fetch_object", MAY_BE_NULL | MAY_BE_OBJECT),
466440
F1("mysqli_affected_rows", MAY_BE_LONG | MAY_BE_STRING),
@@ -684,10 +658,9 @@ static const func_info_t func_infos[] = {
684658
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
685659

686660
/* ext/pgsql */
687-
F1("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
661+
FN("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
688662
FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE),
689663
F1("pg_dbname", MAY_BE_STRING),
690-
F1("pg_last_error", MAY_BE_STRING),
691664
F1("pg_options", MAY_BE_STRING),
692665
F1("pg_port", MAY_BE_STRING),
693666
F1("pg_tty", MAY_BE_STRING),
@@ -699,13 +672,11 @@ static const func_info_t func_infos[] = {
699672
F1("pg_prepare", MAY_BE_FALSE | MAY_BE_RESOURCE),
700673
F1("pg_execute", MAY_BE_FALSE | MAY_BE_RESOURCE),
701674
FN("pg_last_notice", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY ),
702-
F1("pg_field_table", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
703675
F1("pg_field_name", MAY_BE_STRING),
704-
F1("pg_field_type", MAY_BE_STRING),
705676
F1("pg_field_type_oid", MAY_BE_LONG | MAY_BE_STRING),
706677
F1("pg_fetch_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
707678
F1("pg_fetch_row", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
708-
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
679+
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
709680
F1("pg_fetch_array", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
710681
F1("pg_fetch_object", MAY_BE_FALSE | MAY_BE_OBJECT),
711682
F1("pg_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
@@ -750,10 +721,8 @@ static const func_info_t func_infos[] = {
750721
F1("exif_thumbnail", MAY_BE_FALSE | MAY_BE_STRING),
751722

752723
/* ext/filter */
753-
FN("filter_input", UNKNOWN_INFO),
754-
FN("filter_var", UNKNOWN_INFO),
755724
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
756-
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
725+
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
757726
F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
758727

759728
/* ext/gettext */
@@ -839,13 +808,14 @@ static HashTable func_info;
839808
ZEND_API int zend_func_info_rid = -1;
840809

841810
static uint32_t get_internal_func_info(
842-
const zend_call_info *call_info, const zend_ssa *ssa, zend_string *lcname) {
843-
if (call_info->callee_func->common.scope) {
811+
const zend_call_info *call_info, const zend_ssa *ssa) {
812+
zend_function *callee_func = call_info->callee_func;
813+
if (callee_func->common.scope) {
844814
/* This is a method, not a function. */
845815
return 0;
846816
}
847817

848-
zval *zv = zend_hash_find_ex(&func_info, lcname, 1);
818+
zval *zv = zend_hash_find_ex(&func_info, callee_func->common.function_name, 1);
849819
if (!zv) {
850820
return 0;
851821
}
@@ -868,9 +838,7 @@ ZEND_API uint32_t zend_get_func_info(
868838
*ce_is_instanceof = 0;
869839

870840
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
871-
zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2));
872-
873-
uint32_t internal_ret = get_internal_func_info(call_info, ssa, lcname);
841+
uint32_t internal_ret = get_internal_func_info(call_info, ssa);
874842
#if !ZEND_DEBUG
875843
if (internal_ret) {
876844
return internal_ret;
@@ -882,15 +850,15 @@ ZEND_API uint32_t zend_get_func_info(
882850

883851
#if ZEND_DEBUG
884852
if (internal_ret) {
853+
zend_string *name = callee_func->common.function_name;
885854
/* Check whether the func_info information is a subset of the information we can
886855
* compute from the specified return type, otherwise it contains redundant types. */
887856
if (internal_ret & ~ret) {
888-
fprintf(stderr, "Inaccurate func info for %s()\n", ZSTR_VAL(lcname));
857+
fprintf(stderr, "Inaccurate func info for %s()\n", ZSTR_VAL(name));
889858
}
890-
/* Check whether the func info is completely redundant with arginfo.
891-
* Ignore UNKNOWN_INFO for now. */
892-
if (internal_ret == ret && (internal_ret & MAY_BE_ANY) != MAY_BE_ANY) {
893-
fprintf(stderr, "Useless func info for %s()\n", ZSTR_VAL(lcname));
859+
/* Check whether the func info is completely redundant with arginfo. */
860+
if (internal_ret == ret) {
861+
fprintf(stderr, "Useless func info for %s()\n", ZSTR_VAL(name));
894862
}
895863
/* If the return type is not mixed, check that the types match exactly if we exclude
896864
* RC and array information. */
@@ -900,7 +868,7 @@ ZEND_API uint32_t zend_get_func_info(
900868
/* Func info may contain "true" types as well as isolated "null" and "false". */
901869
if (diff && !(diff == MAY_BE_FALSE && (ret & MAY_BE_FALSE))
902870
&& (internal_ret_any & ~(MAY_BE_NULL|MAY_BE_FALSE))) {
903-
fprintf(stderr, "Incorrect func info for %s()\n", ZSTR_VAL(lcname));
871+
fprintf(stderr, "Incorrect func info for %s()\n", ZSTR_VAL(name));
904872
}
905873
}
906874
return internal_ret;

Zend/tests/anon/015.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ var_dump($d->foo(24));
1919
var_dump($c->foo());
2020
?>
2121
--EXPECT--
22-
NULL
22+
array(1) {
23+
[0]=>
24+
int(42)
25+
}
2326
array(1) {
2427
[0]=>
2528
int(24)
2629
}
2730
array(1) {
2831
[0]=>
29-
int(42)
32+
int(24)
3033
}

Zend/tests/anon/016.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ var_dump($d->foo(24));
1919
var_dump($c->foo());
2020
?>
2121
--EXPECT--
22-
NULL
22+
array(1) {
23+
[0]=>
24+
object(stdClass)#2 (0) {
25+
}
26+
}
2327
array(1) {
2428
[0]=>
2529
int(24)
2630
}
2731
array(1) {
2832
[0]=>
29-
object(stdClass)#2 (0) {
30-
}
33+
int(24)
3134
}

Zend/tests/bug64354.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ try {
2020
var_dump($e->getMessage());
2121
}
2222
?>
23-
--EXPECT--
23+
--EXPECTF--
24+
Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
2425
string(9) "serialize"

Zend/tests/enum/no-implement-serializable-indirect.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ var_dump(unserialize(serialize(Foo::Bar)));
2121

2222
?>
2323
--EXPECTF--
24+
Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
25+
2426
Fatal error: Enums may not implement the Serializable interface in %s on line %d

Zend/tests/enum/no-implement-serializable.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ var_dump(unserialize(serialize(Foo::Bar)));
1919

2020
?>
2121
--EXPECTF--
22+
Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
23+
2224
Fatal error: Enums may not implement the Serializable interface in %s on line %d

Zend/tests/method_static_var.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ Bar::test();
2020
--EXPECT--
2121
int(1)
2222
int(2)
23-
int(1)
24-
int(2)
23+
int(3)
24+
int(4)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Serializable deprecation
3+
--FILE--
4+
<?php
5+
6+
interface I extends Serializable {}
7+
abstract class A implements Serializable {}
8+
9+
class C extends A implements I {
10+
public function serialize(): string {}
11+
public function unserialize(string $data) {}
12+
}
13+
14+
class D extends A implements I {
15+
public function serialize(): string {}
16+
public function unserialize(string $data) {}
17+
public function __serialize(): array {}
18+
public function __unserialize(array $data) {}
19+
}
20+
21+
?>
22+
--EXPECTF--
23+
Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d

0 commit comments

Comments
 (0)