1PHP 7.3 INTERNALS UPGRADE NOTES
2
31. Internal API changes
4  a. array_init() and array_init_size()
5  b. Run-time constant operand addressing
6  c. Array/Object recursion protection
7  d. HASH_FLAG_PERSISTENT
8  e. AST and IS_CONSTANT
9  f. GC_REFCOUNT()
10  g. zend_get_parameters()
11  h. zend_register_persistent_resource()
12  i. RAND_RANGE()
13  j. cast_object() with _IS_NUMBER
14  k. zend_fcall_info_cache.initialized
15  l. php_hrtime_current()
16  m. zend_cpu_supports()
17  n. IS_TYPE_COPYABLE
18  o. IS_UNUSED
19  p. VM instruction operands (FETCH_CLASS, FETCH_CONSTANT, CATCH)
20  q. sapi_cli_single_write()
21  r. php_url
22  s. zend_function.reserved[]
23  t. zif_handler
24  u. GC_G
25  v. php_add[c]slashes
26  w. zend_class_entry.iterator_funcs
27  x. Class declaration opcodes (DECLARE_INHERITED_CLASS ...)
28  y. zend_constant
29  z. HAVE_ST_BLKSIZE and HAVE_ST_RDEV
30  aa. RETSIGTYPE
31  bb. php_setcookie
32
332. Build system changes
34  a. Unix build system changes
35  b. Windows build system changes
36
37
383. Module changes
39
40========================
411. Internal API changes
42========================
43
44  a. array_init() and array_init_size() are not functions anymore.
45     They don't return any values.
46
47  b. In 64-bit builds PHP-7.2 and below used relative run-time constant operand
48     addressing. E.g. opline->op1.constant kept an offset from start of literals
49     table - op_array->literals. To speedup access op_array->literals was cached
50     in execute_data->literals. So the resulting address calculated as
51     EX(literals) + opline->op1.constant.
52
53     Now at run-time literals allocated close to opcodes, and addressed
54     relatively from current opline. This eliminates load of EX(literals) on
55     each constant access as well as EX(literals) initialization on each call.
56
57     As result some related macros were removed (ZEND_EX_USE_LITERALS,
58     EX_LOAD_LITERALS, EX_LITERALS, RT_CONSTANT_EX, EX_CONSTANT) or changed
59     (RT_CONSTANT, ZEND_PASS_TWO_UPDATE_CONSTANT, ZEND_PASS_TWO_UNDO_CONSTANT).
60     This change may affect only some "system" extensions. EX_LITERALS,
61     RT_CONSTANT_EX, EX_CONSTANT should be substituted by RT_CONSTANT, and now
62     use "opline" (instead of "op_array") as first argument.
63
64  c. Protection from recursion during processing circular data structures was
65     refactored. HashTable.nApplyCount and IS_OBJ_APPLY_COUNT are replaced by
66     single flag GC_PROTECTED. Corresponding macros Z_OBJ_APPLY_COUNT,
67     Z_OBJ_INC_APPLY_COUNT, Z_OBJ_DEC_APPLY_COUNT, ZEND_HASH_GET_APPLY_COUNT,
68     ZEND_HASH_INC_APPLY_COUNT, ZEND_HASH_DEC_APPLY_COUNT are replaced with
69     GC_IS_RECURSIVE, GC_PROTECT_RECURSION, GC_UNPROTECT_RECURSION,
70     Z_IS_RECURSIVE, Z_PROTECT_RECURSION, Z_UNPROTECT_RECURSION.
71
72     HASH_FLAG_APPLY_PROTECTION flag and ZEND_HASH_APPLY_PROTECTION() macro
73     are removed. All mutable arrays should use recursion protection.
74     Corresponding checks should be replaced by Z_REFCOUNTED() or
75     !(GC_FLAGS(p) & GC_IMMUTABLE).
76
77  d. HASH_FLAG_PERSISTENT renamed into IS_ARRAY_PERSISTENT and moved into
78     GC_FLAGS (to be consistent with IS_STR_PERSISTENT).
79
80  e. zend_ast_ref structure is changed to use only one allocation.
81     zend_ast_copy() now returns zend_ast_ref (instead of zend_asr).
82     zend_ast_destroy_and_free() is removed. ZVAL_NEW_AST() is replaced
83     by ZVAL_AST().
84
85     IS_CONSTANT type and Z_CONST_FLAGS() are removed. Now constants are always
86     represented using IS_CONSTANT_AST (ZEND_AST_CONSTANT kind). AST node
87     attributes are used instead of constant flags. IS_TYPE_CONSTANT flag is
88     removed, but Z_CONSTANT() macro is kept for compatibility.
89
90  f. GC_REFCOUNT() is turned into inline function and can't be modified direcly.
91     All reference-counting operations should be done through corresponding
92     macros GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF().
93
94     GC_REFCOUNT(p)++ should be changed into GC_ADDREF(p),
95     GC_REFCOUNT(p)-- into GC_DELREF(p),
96     GC_REFCOUNT(p) = 1 into GC_SET_REFCOUNT(p, 1).
97
98  g. The zend_get_parameters() and zend_get_parameters_ex() functions were
99     removed. Instead zend_parse_parameters() should be used.
100
101  h. New functions zend_register_persistent_resource() or
102     zend_register_persistent_resource_ex() should beused to register
103     persistent resources, instead of manual insertion into EG(persistent_list).
104
105  i. The RAND_RANGE() macro has been removed. php_mt_rand_range() should be
106     used instead.
107
108  j. The cast_object() object handler now also accepts the _IS_NUMBER type. The
109     handler should return either an integer or float value in this case,
110     whichever is more appropriate.
111
112  k. zend_fcall_info_cache.initialized is removed. zend_fcall_info_cache is
113     initialized if zend_fcall_info_cache.function_handler is set.
114
115  l. php_hrtime_current() delivers the number of nanoseconds since an uncertain
116     point in the past.
117
118  m. zend_cpu_supports() determines if a feature is supported by current cpu.
119     Also serial inline zend_cpu_supports_xxx() are added, which is designed for
120     ifunc resolver function, as resolver function should not depend on any
121     external function.
122
123  n. IS_TYPE_COPYABLE flag is removed. IS_STRING zvals didn't need to be
124     duplication by zval_copy_ctor(), ZVAL_DUP() and SEPARATE_ZVAL*() macros.
125     Interned strings didn't set IS_TYPE_COPYABLE, so they aren't affected at
126     all. Now instead of checking for IS_TYPE_COPYABLE, engine checks for
127     IS_ARRAY type (it may be IS_TYPE_REFCOUNTED or not). All the related
128     macros: Z_COPYABLE..., Z_IMMUTABLE... are kept for compatibility.
129
130  o. IS_UNUSED became zero and can't be used as a bitmask (there were no such
131     usages in PHP sources).
132
133  p. Operands of few VM instructions were changed
134    - FETCH_CLASS     op1<fetch-flags>, op2<name>, result<var>
135    - FETCH_CONSTANT  op1<fetch-flags>, op2<name>, result<tmp>
136    - CATCH           ext<last-flag>, op1<name>, op2<jump_addr>, result<cv>
137
138 q.  sapi_cli_single_write() now returns ssize_t instead of size_t.
139
140 r.  fields of php_url struct change from char * to zend_string *
141
142 s. Special purpose zend_functions marked by ZEND_ACC_CALL_VIA_TRAMPOLINE or
143    ZEND_ACC_FAKE_CLOSURE flags use reserved[0] for internal purpose.
144    Third party extensions must not modify reserved[] fields of these functions.
145
146 t. For internal functions the typedef zif_handler has been introduced.  It is
147    recommended to use this from now on, instead of defining own handler types.
148
149 u. The GC globals (GC_G) are now private. Use the new zend_gc_get_status() to
150    retrieve status information of the GC.
151
152 v. The should_free argument of the php_add[c]slashes functions has been
153    removed.  It is now always the caller's responsibility to free the passed
154    string.
155
156 w. zend_class_entry.iterator_funcs have been replaced by iterator_funcs_ptr.
157    You don't have to set its value, setting parent.funcs in the get_iterator
158    function is enough.
159
160 x. Class declaration opcode formats were changed
161  - DECLARE_INHERITED_CLASS and DECLARE_ANON_INHERITED_CLASS now encode parent
162    class name in second operand directly (as IS_CONST operand). Previously,
163    parent class was fetched by the prior FETCH_CLASS opcode.
164  - ADD_INTERFACE and ADD_TRAIT don't use run-time cache to keep interface or
165    trait. These instructions are executed once, and caching is useless.
166
167 y. zend_constant.flags and zend_constant.module_number are packed into
168    reserved space inside zend_constant.value. They should be accessed using
169    ZEND_CONSTANT_FLAGS(), ZEND_CONSTANT_MODULE_NUMBER() and
170    ZEND_CONSTANT_SET_FLAGS() macros.
171
172 z. HAVE_ST_BLKSIZE must be replaced with HAVE_STRUCT_STAT_ST_BLKSIZE and
173    HAVE_ST_RDEV must be replaced with HAVE_STRUCT_STAT_ST_RDEV.
174
175 aa. RETSIGTYPE has been removed from the generated php_config.h and should be
176    replaced with void.
177
178 bb. php_setcookie() now expects an additional samesite argument, and the
179    url_encode parameter has been moved to the end. The signature is now:
180    int php_setcookie(zend_string *name, zend_string *value, time_t expires,
181                      zend_string *path, zend_string *domain, int secure,
182                      int httponly, zend_string *samesite, int url_encode);
183
184========================
1852. Build system changes
186========================
187
188  a. Unix build system changes
189    - PHP_PROG_LEX, TSRM_CHECK_GCC_ARG, and LIBZEND_CPLUSPLUS_CHECKS Autoconf
190      macros have been removed.
191    - Minimum Autoconf version is 2.68+ for generating the configure script.
192
193  b. Windows build system changes
194    - ZEND_WIN32_FORCE_INLINE doesn't affect C++ anymore. zend_always_inline is
195      still usable in C++, but anything else inlining related is up to
196      compiler.
197    - ZEND_WIN32_KEEP_INLINE was removed, it was only needed for C++
198      convenience and is now default behavior with C++.
199    - New configure option --enable-native-intrinsics accepts a list of the
200      intrinsic optimizations to enable. It affects both the code generation
201      and the explicit optimizations guarded by preprocessor macros.
202    - The configure option --with-codegen-arch accepts only ia32 as a value.
203      Use it, to produce builds suitable for older processors without SSE2 or
204      even SSE support.
205
206========================
2073. Module changes
208========================
209