Skip to content

Commit 5a67934

Browse files
committed
Add UPGRADING notes
[ci skip]
1 parent a5fa51a commit 5a67934

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
77
(Pierrick)
88

9+
- Date:
10+
. Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita)
11+
912
- Hash:
1013
. The hash extension is now an integral part of PHP and cannot be disabled
1114
as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle)

UPGRADING

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ PHP 7.4 UPGRADE NOTES
1919
1. Backward Incompatible Changes
2020
========================================
2121

22+
- Date:
23+
. Calling var_dump() or similar on a DateTime(Immutable) instance will no
24+
longer leave behind accessible properties on the object.
25+
2226
- Intl:
2327
. The default parameter value of idn_to_ascii() and idn_to_utf8() is now
2428
INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003.
@@ -29,6 +33,21 @@ PHP 7.4 UPGRADE NOTES
2933
supported and resulted in corrupted reflection objects. It has been
3034
explicitly prohibited now.
3135

36+
- SPL:
37+
. Calling get_object_vars() on an ArrayObject instance will now always return
38+
the properties of the ArrayObject itself (or a subclass). Previously it
39+
returned the values of the wrapped array/object unless the STD_PROP_LIST
40+
flag was specified. Other affected operations are:
41+
42+
* ReflectionObject::getProperties()
43+
* array_key_exists(). Use isset() or offsetExists() instead.
44+
* reset(), current(), etc. Use Iterator methods instead.
45+
* Potentially others working on object properties as a list.
46+
47+
(array) casts are *not* affected. They will continue to return either the
48+
wrapped array, or the ArrayObject properties, depending on whether the
49+
STD_PROP_LIST flag is used.
50+
3251
========================================
3352
2. New Features
3453
========================================

UPGRADING.INTERNALS

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP 7.4 INTERNALS UPGRADE NOTES
55
b. zend_lookup_class_ex() and zend_fetch_class_by_name()
66
c. Function/property/class flags
77
d. Removed zend_check_private()
8+
e. php_win32_error_to_msg() memory management
9+
f. get_properties_for() handler / Z_OBJDEBUG_P
810

911
2. Build system changes
1012
a. Abstract
@@ -50,6 +52,52 @@ PHP 7.4 INTERNALS UPGRADE NOTES
5052
php_win32_error_msg_free(). Same regarding php_win_err() vs.
5153
php_win_err_free().
5254

55+
f. A new, optional object handler with the signature
56+
57+
HashTable *get_properties_for(zval *obj, zend_prop_purpose purpose)
58+
59+
has been introduced, where zend_prop_purpose (currently) takes one of:
60+
61+
ZEND_PROP_PURPOSE_DEBUG // var_dump etc.
62+
ZEND_PROP_PURPOSE_ARRAY_CAST // (array) $obj
63+
ZEND_PROP_PURPOSE_SERIALIZE // "O"-format serialization (__wakeup)
64+
ZEND_PROP_PURPOSE_VAR_EXPORT // var_export (__set_state)
65+
ZEND_PROP_PURPOSE_JSON // json_encode
66+
67+
The handler returns a non-null HashTable with increased refcounted, and
68+
the return value must be released using zend_release_properties().
69+
70+
This handler serves the same general function as get_properties(), but
71+
provides more control over different property uses, while also making
72+
it possible to return a temporary property table.
73+
74+
get_properties() is still used in cases where none of the above purposes
75+
apply, but overloading get_properties() is generally discouraged. If you
76+
want to provide purposes for general usage rather than just debugging or
77+
serialization, please prefer using properly declared properties.
78+
79+
get_debug_info() is superseded by get_properties_for() with the
80+
ZEND_PROP_PURPOSE_DEBUG purpose, but remains available for backwards-
81+
compatibility reasons. However, while it is fine to define this handler,
82+
it should never be directly called by consuming code.
83+
84+
The Z_OBJDEBUG_P macro has been removed. It should be replaced by calls to
85+
zend_get_properties_for() with the ZEND_PROP_PURPOSE_DEBUG purpose:
86+
87+
// OLD
88+
int is_temp;
89+
HashTable *ht = Z_OBJDEBUG_P(obj, is_temp);
90+
// ...
91+
if (is_temp) {
92+
zend_hash_destroy(ht);
93+
FREE_HASHTABLE(ht);
94+
}
95+
96+
// NEW
97+
HashTable *ht = zend_get_properties_for(obj, ZEND_PROP_PURPOSE_DEBUG);
98+
// ...
99+
zend_release_properties(ht);
100+
53101
========================
54102
2. Build system changes
55103
========================

0 commit comments

Comments
 (0)