File tree 3 files changed +38
-0
lines changed
3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? ????, PHP 8.1.5
4
4
5
+ - Core:
6
+ . Fixed bug GH-8176 (Enum values in property initializers leak). (Bob)
7
+
5
8
- Intl:
6
9
. Fixed bug GH-8115 (Can't catch arg type deprecation when instantiating Intl
7
10
classes). (ilutov)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Enum object in property initializer
3
+ --FILE--
4
+ <?php
5
+
6
+ class AClass
7
+ {
8
+ public $ prop = AnEnum::Value;
9
+ }
10
+
11
+ enum AnEnum
12
+ {
13
+ case Value;
14
+ }
15
+
16
+ var_dump (new AClass );
17
+
18
+ ?>
19
+ --EXPECT--
20
+ object(AClass)#2 (1) {
21
+ ["prop"]=>
22
+ enum(AnEnum::Value)
23
+ }
Original file line number Diff line number Diff line change @@ -329,6 +329,18 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
329
329
ZVAL_UNDEF (& c -> value );
330
330
}
331
331
} ZEND_HASH_FOREACH_END ();
332
+
333
+ /* properties may contain objects as well */
334
+ if (ce -> default_properties_table ) {
335
+ zval * p = ce -> default_properties_table ;
336
+ zval * end = p + ce -> default_properties_count ;
337
+
338
+ while (p != end ) {
339
+ i_zval_ptr_dtor (p );
340
+ ZVAL_UNDEF (p );
341
+ p ++ ;
342
+ }
343
+ }
332
344
}
333
345
334
346
if (ce -> ce_flags & ZEND_HAS_STATIC_IN_METHODS ) {
You can’t perform that action at this time.
0 commit comments