Skip to content

Commit b6e1030

Browse files
committed
---
yaml --- r: 79887 b: refs/heads/master c: c29a72d h: refs/heads/master i: 79885: 16a5ac0 79883: 48deaef 79879: 601a86b 79871: e84df4f v: v3
1 parent 9274655 commit b6e1030

File tree

106 files changed

+1755
-430
lines changed

Some content is hidden

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

106 files changed

+1755
-430
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
refs/heads/migration/sqlite-start: 15d2dda909da2176151dffe0af9f6516dc9397ea
3-
refs/heads/master: a6a1785e23eba03f71998cc2f58e0293edeed82e
3+
refs/heads/master: c29a72d17f8663abac4dcb1d4601778a9eeb3380

trunk/NEWS

Lines changed: 471 additions & 6 deletions
Large diffs are not rendered by default.

trunk/UPGRADING

Lines changed: 396 additions & 6 deletions
Large diffs are not rendered by default.

trunk/UPGRADING.INTERNALS

Lines changed: 208 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ UPGRADE NOTES - PHP X.Y
77
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
88
c. POST data handling
99
d. Arginfo changes
10+
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
11+
f. empty strings are interned
12+
g. Additional str_* APIs
13+
h. Addition of zend_hash_reindex
14+
i. Addition of zend_hash_splice
15+
j. An additional parameter is sent to Countable::count()
16+
k. Unserialization of manipulated object strings
17+
l. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
1018

1119
2. Build system changes
1220
a. Unix build system changes
@@ -17,11 +25,209 @@ UPGRADE NOTES - PHP X.Y
1725
1. Internal API changes
1826
========================
1927

20-
a. zend_set_memory_limit() now takes the TSRMLS_CC macro as its last argument
28+
a. Addition of do_operation and compare object handlers
29+
30+
Two new object handlers have been added:
31+
32+
do_operation:
33+
typedef int (*zend_object_do_operation_t)(
34+
zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC
35+
);
36+
37+
compare:
38+
typedef int (*zend_object_compare_zvals_t)(
39+
zval *result, zval *op1, zval *op2 TSRMLS_DC
40+
);
41+
42+
The first handler is used to overload arithmetic operations. The first
43+
argument specifies the opcode of the operator, result is the target zval,
44+
op1 the first operand and op2 the second operand. For unary operations
45+
op2 is NULL. If the handler returns FAILURE PHP falls back to the default
46+
behavior for the operation.
47+
48+
The second handler is used to perform comparison operations with
49+
non-objects. The value written into result must be an IS_LONG with value
50+
-1 (smaller), 0 (equal) or 1 (greater). The return value is a SUCCESS/FAILURE
51+
return code. The difference between this handler and compare_objects is
52+
that it will be triggered for comparisons with non-objects and objects of
53+
different types. It takes precedence over compare_objects.
54+
55+
Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp
56+
57+
b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros
58+
59+
The return_value_ptr argument to internal functions is now always set.
60+
Previously it was only available for functions returning by-reference.
61+
return_value_ptr can now be used to return zvals without copying them.
62+
For this purpose two new macros are provided:
63+
64+
RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */
65+
RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */
66+
67+
The macros behave similarly to the non-FAST variants with copy=1 and
68+
dtor=0, but will try to return the zval without making a copy by utilizing
69+
return_value_ptr.
70+
71+
c. POST data handling
72+
73+
The sapi_request_info's members post_data, post_data_len and raw_post_data as
74+
well as raw_post_data_len have been replaced with a temp PHP stream
75+
request_body.
76+
77+
The recommended way to access raw POST data is to open and use a php://input
78+
stream wrapper. It is safe to be used concurrently and more than once.
79+
80+
d. Arginfo changes
81+
82+
The pass_rest_by_reference argument of the ZEND_BEGIN_ARG_INFO and
83+
ZEND_BEGIN_ARG_INFO_EX() is no longer used. The value passed to it is ignored.
84+
85+
Instead a variadic argument is created using ZEND_ARG_VARIADIC_INFO():
86+
87+
ZEND_ARG_VARIADIC_INFO(0, name) /* pass rest by value */
88+
ZEND_ARG_VARIADIC_INFO(1, name) /* pass rest by reference */
89+
ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, name)
90+
/* pass rest by prefer-ref */
91+
92+
ZEND_ARG_VARIADIC_INFO() should only be used for the last argument.
93+
94+
The following changes were applied to the zend_arg_info struct:
95+
96+
typedef struct _zend_arg_info {
97+
const char *class_name;
98+
zend_uint class_name_len;
99+
zend_uchar type_hint;
100+
+ zend_uchar pass_by_reference;
101+
zend_bool allow_null;
102+
- zend_bool pass_by_reference;
103+
+ zend_bool is_variadic;
104+
} zend_arg_info;
105+
106+
The following changes were applied to the zend_internal_function_info struct:
107+
108+
typedef struct _zend_internal_function_info {
109+
zend_uint required_num_args;
110+
zend_uchar _type_hint;
111+
zend_bool return_reference;
112+
- zend_bool pass_rest_by_reference;
113+
+ zend_bool _allow_null;
114+
+ zend_bool _is_variadic;
115+
} zend_internal_function_info;
116+
117+
The CHECK_ARG_SEND_TYPE(), ARG_MUST_BE_SENT_BY_REF(),
118+
ARG_SHOULD_BE_SENT_BY_REF() and ARG_MAY_BE_SENT_BY_REF() macros now assume
119+
that the argument passed to them is a zend_function* and that it is non-NULL.
120+
121+
e. tsrm_virtual_cwd.h moved to zend_virtual_cwd.h
21122

123+
Memory allocation is now managed by emalloc/efree instead of malloc/free.
124+
125+
f. empty strings are interned
126+
127+
String created using STR_EMPTY_ALLOC() are now interned.
128+
convert_to_string use STR_EMPTY_ALLOC() for zval when IS_NULL.
129+
str_efree() shoud be preferred as efree() on such strings can cause memory
130+
corruption.
131+
132+
g. Additional str_* APIs
133+
134+
In addition to the previously existing str_free() and str_efree() macros, the
135+
following macros have been introduced to simplify dealing with potentially
136+
interned strings:
137+
138+
str_efree_rel(str) - efree_rel() if not interned
139+
str_erealloc(str, new_len) - erealloc() or emalloc+memcpy if interned
140+
str_estrndup(str, len) - estrndup() if not interned
141+
str_strndup(str, len) - zend_strndup() if not interned
142+
str_hash(str, len) - INTERNED_HASH(str) if interned,
143+
zend_hash_func(str, len+1) otherwise
144+
145+
h. Addition of zend_hash_reindex
146+
147+
A zend_hash_reindex() function with the following prototype has been added:
148+
149+
void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys);
150+
151+
If only_integer_keys==0, this function will change all keys to be continuous,
152+
zero-based integers in hash order. If only_integer_keys==1 the same will be
153+
done only for keys that were already integers previously, while leaving
154+
string keys alone.
155+
156+
i. Addition of zend_hash_splice
157+
158+
A zend_hash_splice() macro with the following prototype has been added:
159+
160+
void zend_hash_splice(
161+
HashTable *ht, uint nDataSize, copy_ctor_func_t pCopyConstructor,
162+
uint offset, uint length,
163+
void **list, uint list_count, HashTable *removed
164+
);
165+
166+
This function performs an in-place splice operation on a hashtable:
167+
168+
The elements between offset and offset+length are removed and the elements in
169+
list[list_count] are inserted in their place. The removed elements can be
170+
optionally collected into a hashtable.
171+
172+
This operation reindexes the hashtable, i.e. integer keys will be zero-based
173+
and sequential, while string keys stay intact. The same applies to the
174+
elements inserted into the removed HT.
175+
176+
As a side-effect of this addition the signature of the php_splice() function
177+
changed:
178+
179+
void php_splice(
180+
HashTable *ht, zend_uint offset, zend_uint length,
181+
zval ***list, zend_uint list_count, HashTable *removed TSRMLS_DC
182+
)
183+
184+
This function now directly forwards to zend_hash_splice(), resets the
185+
IAP of ht (for compatibility with the previous implementation) and resets
186+
CVs if the passed hashtable is the global symbol table.
187+
188+
j. An additional parameter is sent to Countable::count()
189+
190+
That parameter denotes the $mode passed to count; it shouldn't affect any
191+
userland code, but any zend_parse_parameters() used with no arguments should
192+
fail. Extensions which implement Countable internally, need to accept one
193+
optional long as parameter.
194+
195+
k. Unserialization of manipulated object strings
196+
197+
Strings requiring unserialization of objects are now explicitly checked
198+
whether the object they contain implements the Serializable interface.
199+
This solves the situation where manipulated strings could be passed for
200+
objects using Serializable to disallow serialization. An object
201+
implementing Serializable will always start with "C:" in the serialized
202+
string, all other objects are represented with starting "O:". Objects
203+
implementing Serializable to disable serialization using
204+
zend_class_unserialize_deny and zend_class_serialize_deny, when
205+
instantiated from the serializer with a manipulated "O:" string at the
206+
start, will most likely be defectively initialized. This is now
207+
fixed at the appropriate place by checking for the presence of the
208+
serialize callback in the class entry.
209+
210+
l. Removal of IS_CONSTANT_ARRAY and IS_CONSTANT_INDEX hack
211+
212+
These two #defines disappeared. Instead we have now IS_CONSTANT_AST which
213+
covers also the functionality IS_CONSTANT_ARRAY bid and furthermore the
214+
hack for marking zvals as constant index with IS_CONSTANT_INDEX is now
215+
superfluous and so removed.
216+
Please note that IS_CONSTANT_AST now has the same value than
217+
IS_CONSTANT_ARRAY had.
22218

23219
========================
24220
2. Build system changes
25221
========================
26222

27-
223+
a. Unix build system changes
224+
- The bison version check is now a blacklist instead of a whitelist.
225+
- The bison binary can be specified through the YACC environment/configure
226+
variable. Previously `bison` was assumed to be in $PATH.
227+
228+
b. Windows build system changes
229+
- The configure option --enable-static-analyze isn't available anymore.
230+
The new option was introduced --with-analyzer.
231+
- It is possible to disable PGO for single extensions, to do that
232+
define a global variable PHP_MYMODULE_PGO evaluating to false
233+
inside config.w32

trunk/Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC)
5252
ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
5353
ZEND_API void (*zend_block_interruptions)(void);
5454
ZEND_API void (*zend_unblock_interruptions)(void);
55-
ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
55+
ZEND_API void (*zend_ticks_function)(int ticks);
5656
ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
5757
int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
5858
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);

trunk/Zend/zend.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#ifndef ZEND_H
2323
#define ZEND_H
2424

25-
#define ZEND_VERSION "2.7.0-dev"
25+
#define ZEND_VERSION "2.6.0-dev"
2626

2727
#define ZEND_ENGINE_2
2828

@@ -551,7 +551,7 @@ typedef struct _zend_utility_functions {
551551
void (*block_interruptions)(void);
552552
void (*unblock_interruptions)(void);
553553
int (*get_configuration_directive)(const char *name, uint name_length, zval *contents);
554-
void (*ticks_function)(int ticks TSRMLS_DC);
554+
void (*ticks_function)(int ticks);
555555
void (*on_timeout)(int seconds TSRMLS_DC);
556556
int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
557557
int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap);
@@ -700,7 +700,7 @@ extern ZEND_API zend_write_func_t zend_write;
700700
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
701701
extern ZEND_API void (*zend_block_interruptions)(void);
702702
extern ZEND_API void (*zend_unblock_interruptions)(void);
703-
extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
703+
extern ZEND_API void (*zend_ticks_function)(int ticks);
704704
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
705705
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
706706
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);

trunk/Zend/zend_API.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2324,8 +2324,10 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
23242324
}
23252325
/* }}} */
23262326

2327-
ZEND_API int zend_startup_module(zend_module_entry *module TSRMLS_DC) /* {{{ */
2327+
ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */
23282328
{
2329+
TSRMLS_FETCH();
2330+
23292331
if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) {
23302332
return SUCCESS;
23312333
}

trunk/Zend/zend_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg,
267267

268268
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
269269
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
270-
ZEND_API int zend_startup_module(zend_module_entry *module_entry TSRMLS_DC);
270+
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
271271
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
272272
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
273273
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);

trunk/Zend/zend_alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2682,8 +2682,10 @@ ZEND_API char *zend_strndup(const char *s, uint length)
26822682
}
26832683

26842684

2685-
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC)
2685+
ZEND_API int zend_set_memory_limit(size_t memory_limit)
26862686
{
2687+
TSRMLS_FETCH();
2688+
26872689
AG(mm_heap)->limit = (memory_limit >= AG(mm_heap)->block_size) ? memory_limit : AG(mm_heap)->block_size;
26882690

26892691
return SUCCESS;

trunk/Zend/zend_alloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ inline static void * __zend_realloc(void *p, size_t len)
139139
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
140140
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
141141

142-
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
142+
ZEND_API int zend_set_memory_limit(size_t memory_limit);
143143

144144
ZEND_API void start_memory_manager(TSRMLS_D);
145145
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC);

trunk/Zend/zend_ast.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
259259
break;
260260
case ZEND_BOOL_AND:
261261
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
262-
if (zend_is_true(&op1 TSRMLS_CC)) {
262+
if (zend_is_true(&op1)) {
263263
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
264-
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
264+
ZVAL_BOOL(result, zend_is_true(&op2));
265265
zval_dtor(&op2);
266266
} else {
267267
ZVAL_BOOL(result, 0);
@@ -270,18 +270,18 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
270270
break;
271271
case ZEND_BOOL_OR:
272272
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
273-
if (zend_is_true(&op1 TSRMLS_CC)) {
273+
if (zend_is_true(&op1)) {
274274
ZVAL_BOOL(result, 1);
275275
} else {
276276
zend_ast_evaluate(&op2, (&ast->u.child)[1], scope TSRMLS_CC);
277-
ZVAL_BOOL(result, zend_is_true(&op2 TSRMLS_CC));
277+
ZVAL_BOOL(result, zend_is_true(&op2));
278278
zval_dtor(&op2);
279279
}
280280
zval_dtor(&op1);
281281
break;
282282
case ZEND_SELECT:
283283
zend_ast_evaluate(&op1, (&ast->u.child)[0], scope TSRMLS_CC);
284-
if (zend_is_true(&op1 TSRMLS_CC)) {
284+
if (zend_is_true(&op1)) {
285285
if (!(&ast->u.child)[1]) {
286286
*result = op1;
287287
} else {

trunk/Zend/zend_execute.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array
6060
ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC);
6161
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
6262
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
63-
ZEND_API int zend_is_true(zval *op TSRMLS_DC);
63+
ZEND_API int zend_is_true(zval *op);
6464
ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
6565
ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
6666
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
@@ -101,7 +101,7 @@ static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LIN
101101
}
102102
}
103103

104-
static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
104+
static zend_always_inline int i_zend_is_true(zval *op)
105105
{
106106
int result;
107107

@@ -130,6 +130,8 @@ static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
130130
break;
131131
case IS_OBJECT:
132132
if(IS_ZEND_STD_OBJECT(*op)) {
133+
TSRMLS_FETCH();
134+
133135
if (Z_OBJ_HT_P(op)->cast_object) {
134136
zval tmp;
135137
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {

trunk/Zend/zend_execute_API.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{
443443
}
444444
/* }}} */
445445

446-
ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
446+
ZEND_API int zend_is_true(zval *op) /* {{{ */
447447
{
448-
return i_zend_is_true(op TSRMLS_CC);
448+
return i_zend_is_true(op);
449449
}
450450
/* }}} */
451451

0 commit comments

Comments
 (0)