Skip to content

Commit cfc8b57

Browse files
committed
Merge branch 'master' of https://git.php.net/repository/php-src
2 parents 3753e6d + 8b0deb8 commit cfc8b57

File tree

143 files changed

+1373
-998
lines changed

Some content is hidden

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

143 files changed

+1373
-998
lines changed

NEWS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PHP NEWS
1+
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 20??, PHP 7.0.0
44

@@ -26,6 +26,9 @@ PHP NEWS
2626
constructor). (dunglas at gmail dot com)
2727
. Removed ZEND_ACC_FINAL_CLASS, promoting ZEND_ACC_FINAL as final class
2828
modifier. (Guilherme Blanco)
29+
. is_long() & is_integer() is now an alias of is_int(). (Kalle)
30+
. Implemented FR #55467 (phpinfo: PHP Variables with $ and single quotes). (Kalle)
31+
. Fixed bug #55415 (php_info produces invalid anchor names). (Kalle, Johannes)
2932

3033
- Date:
3134
. Fixed day_of_week function as it could sometimes return negative values
@@ -48,6 +51,7 @@ PHP NEWS
4851

4952
- FPM:
5053
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
54+
. Implement request #67106 (Split main fpm config). (Elan Ruusamäe, Remi)
5155

5256
- LiteSpeed:
5357
. Updated LiteSpeed SAPI code from V5.5 to V6.6. (George Wang)

UPGRADING

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ PHP X.Y UPGRADE NOTES
2222
========================================
2323

2424
- Core
25-
. Added null coalesce operator (??).
26-
(RFC: https://wiki.php.net/rfc/isset_ternary)
2725
. list() now always supports ArrayAccess and never supports strings.
2826
Previously both were accepted in some situations and not in others.
2927
(RFC: https://wiki.php.net/rfc/fix_list_behavior_inconsistency)
@@ -36,6 +34,19 @@ PHP X.Y UPGRADE NOTES
3634
around.
3735
. Removed ASP (<%) and script (<script language=php>) tags.
3836
(RFC: https://wiki.php.net/rfc/remove_alternative_php_tags)
37+
. call_user_method() and call_user_method_array() no longer exists.
38+
. PHP 7 doesn't keep original values of arguments passed to user functions,
39+
so func_get_arg() and func_get_args() will return current value of argument
40+
instead of the actually passed. The following code is going to be affected:
41+
function foo($x) { $x = 2; return func_get_arg(0);} var_dump(foo(1));
42+
It will now produce 2, not 1.
43+
. Function parameters with duplicate name are not allowed anymore. Definitions
44+
like “function foo($x,$x) {}” will lead to compile time error.
45+
. Indirect variable, property and method references are now interpreted with
46+
left-to-right semantics. See details in:
47+
https://wiki.php.net/rfc/uniform_variable_syntax#semantic_differences_in_existing_syntax
48+
. The global keyword now only accepts simple variables. See details in:
49+
https://wiki.php.net/rfc/uniform_variable_syntax#global_keyword_takes_only_simple_variables
3950

4051
- DBA
4152
. dba_delete() now returns false if the key was not found for the inifile
@@ -51,6 +62,8 @@ PHP X.Y UPGRADE NOTES
5162
========================================
5263

5364
- Core
65+
. Added null coalesce operator (??).
66+
(RFC: https://wiki.php.net/rfc/isset_ternary)
5467
. Support for strings with length >= 2^31 bytes in 64 bit builds
5568
. Closure::call() method added
5669

@@ -137,6 +150,3 @@ PHP X.Y UPGRADE NOTES
137150
always be zero when casted to integer.
138151
. Calling a method on a non-object no longer raises a fatal error; see
139152
also: https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
140-
141-
- Standard
142-
. call_user_method() and call_user_method_array() no longer exists.

Zend/tests/self_and.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
ANDing strings
3+
--FILE--
4+
<?php
5+
6+
$s = "123";
7+
$s1 = "test";
8+
$s2 = "45345some";
9+
10+
$s &= 22;
11+
var_dump($s);
12+
13+
$s1 &= 11;
14+
var_dump($s1);
15+
16+
$s2 &= 33;
17+
var_dump($s2);
18+
19+
echo "Done\n";
20+
?>
21+
--EXPECTF--
22+
int(18)
23+
int(0)
24+
int(33)
25+
Done

Zend/tests/self_mod.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Moduloing strings
3+
--FILE--
4+
<?php
5+
6+
$s = "123";
7+
$s1 = "test";
8+
$s2 = "45345some";
9+
10+
$s %= 22;
11+
var_dump($s);
12+
13+
$s1 %= 11;
14+
var_dump($s1);
15+
16+
$s2 %= 33;
17+
var_dump($s2);
18+
19+
echo "Done\n";
20+
?>
21+
--EXPECTF--
22+
int(13)
23+
int(0)
24+
int(3)
25+
Done

Zend/tests/self_or.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
ORing strings
3+
--FILE--
4+
<?php
5+
6+
$s = "123";
7+
$s1 = "test";
8+
$s2 = "45345some";
9+
10+
$s |= 22;
11+
var_dump($s);
12+
13+
$s1 |= 11;
14+
var_dump($s1);
15+
16+
$s2 |= 33;
17+
var_dump($s2);
18+
19+
echo "Done\n";
20+
?>
21+
--EXPECTF--
22+
int(127)
23+
int(11)
24+
int(45345)
25+
Done

Zend/tests/self_xor.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
XORing strings
3+
--FILE--
4+
<?php
5+
6+
$s = "123";
7+
$s1 = "test";
8+
$s2 = "45345some";
9+
10+
$s ^= 22;
11+
var_dump($s);
12+
13+
$s1 ^= 11;
14+
var_dump($s1);
15+
16+
$s2 ^= 33;
17+
var_dump($s2);
18+
19+
echo "Done\n";
20+
?>
21+
--EXPECTF--
22+
int(109)
23+
int(11)
24+
int(45312)
25+
Done

Zend/zend_API.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
404404
if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) {
405405
return "long";
406406
} else if (type == IS_DOUBLE) {
407-
if (c == 'L') {
408-
if (d > ZEND_LONG_MAX) {
409-
*p = ZEND_LONG_MAX;
410-
break;
411-
} else if (d < ZEND_LONG_MIN) {
412-
*p = ZEND_LONG_MIN;
413-
break;
407+
if (zend_isnan(d)) {
408+
return "long";
409+
}
410+
if (!ZEND_DOUBLE_FITS_LONG(d)) {
411+
if (c == 'L') {
412+
*p = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
413+
} else {
414+
return "long";
414415
}
416+
break;
415417
}
416418

417419
*p = zend_dval_to_lval(d);
@@ -420,14 +422,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
420422
break;
421423

422424
case IS_DOUBLE:
423-
if (c == 'L') {
424-
if (Z_DVAL_P(arg) > ZEND_LONG_MAX) {
425-
*p = ZEND_LONG_MAX;
426-
break;
427-
} else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) {
428-
*p = ZEND_LONG_MIN;
429-
break;
425+
if (zend_isnan(Z_DVAL_P(arg))) {
426+
return "long";
427+
}
428+
if (!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg))) {
429+
if (c == 'L') {
430+
*p = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
431+
} else {
432+
return "long";
430433
}
434+
break;
431435
}
432436
case IS_NULL:
433437
case IS_FALSE:
@@ -1880,7 +1884,6 @@ static int zend_startup_module_zval(zval *zv TSRMLS_DC) /* {{{ */
18801884
}
18811885
/* }}} */
18821886

1883-
18841887
static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare TSRMLS_DC) /* {{{ */
18851888
{
18861889
Bucket *b1 = base;

Zend/zend_API.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,10 +1064,16 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo
10641064
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
10651065
*dest = Z_LVAL_P(arg);
10661066
} else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
1067-
if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) {
1068-
*dest = ZEND_LONG_MAX;
1069-
} else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) {
1070-
*dest = ZEND_LONG_MIN;
1067+
if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
1068+
return 0;
1069+
}
1070+
if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) {
1071+
/* Ironically, the strict parameter makes zpp *non*-strict here */
1072+
if (strict) {
1073+
*dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
1074+
} else {
1075+
return 0;
1076+
}
10711077
} else {
10721078
*dest = zend_dval_to_lval(Z_DVAL_P(arg));
10731079
}
@@ -1077,10 +1083,15 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo
10771083

10781084
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
10791085
if (EXPECTED(type != 0)) {
1080-
if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) {
1081-
*dest = ZEND_LONG_MAX;
1082-
} else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) {
1083-
*dest = ZEND_LONG_MIN;
1086+
if (UNEXPECTED(zend_isnan(d))) {
1087+
return 0;
1088+
}
1089+
if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) {
1090+
if (strict) {
1091+
*dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
1092+
} else {
1093+
return 0;
1094+
}
10841095
} else {
10851096
*dest = zend_dval_to_lval(d);
10861097
}

Zend/zend_compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,6 +2407,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) /* {{{ *
24072407
zend_compile_expr(&arg_node, arg->child[0] TSRMLS_CC);
24082408
opline = zend_emit_op(NULL, ZEND_SEND_UNPACK, &arg_node, NULL TSRMLS_CC);
24092409
opline->op2.num = arg_count;
2410+
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, arg_count);
24102411
continue;
24112412
}
24122413

@@ -2469,6 +2470,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) /* {{{ *
24692470
SET_NODE(opline->op1, &arg_node);
24702471
SET_UNUSED(opline->op2);
24712472
opline->op2.opline_num = arg_num;
2473+
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, arg_num);
24722474

24732475
if (opcode == ZEND_SEND_VAR_NO_REF) {
24742476
if (fbc) {
@@ -2696,7 +2698,7 @@ int zend_compile_func_cufa(znode *result, zend_ast_list *args, zend_string *lcna
26962698
return FAILURE;
26972699
}
26982700

2699-
zend_compile_init_user_func(args->child[0], 1, lcname TSRMLS_CC);
2701+
zend_compile_init_user_func(args->child[0], 0, lcname TSRMLS_CC);
27002702
zend_compile_expr(&arg_node, args->child[1] TSRMLS_CC);
27012703
zend_emit_op(NULL, ZEND_SEND_ARRAY, &arg_node, NULL TSRMLS_CC);
27022704
zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
@@ -2737,7 +2739,8 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
27372739
opline = zend_emit_op(NULL, ZEND_SEND_VAL, &arg_node, NULL TSRMLS_CC);
27382740
}
27392741

2740-
opline->op2.opline_num = i;
2742+
opline->op2.num = i;
2743+
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_ARG(NULL, i);
27412744
}
27422745
zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
27432746

Zend/zend_execute.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ static zend_always_inline zval* zend_vm_stack_alloc(size_t size TSRMLS_DC)
143143
return (zval*)top;
144144
}
145145

146-
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t call_info, zend_function *func, uint32_t used_stack, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
146+
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame_ex(uint32_t used_stack, uint32_t call_info, zend_function *func, uint32_t num_args, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
147147
{
148148
zend_execute_data *call = (zend_execute_data*)zend_vm_stack_alloc(used_stack TSRMLS_CC);
149149

150150
call->func = func;
151151
Z_OBJ(call->This) = object;
152152
ZEND_SET_CALL_INFO(call, call_info);
153-
ZEND_CALL_NUM_ARGS(call) = 0;
153+
ZEND_CALL_NUM_ARGS(call) = num_args;
154154
call->called_scope = called_scope;
155155
call->prev_execute_data = prev;
156156
return call;
@@ -170,8 +170,8 @@ static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(uint3
170170
{
171171
uint32_t used_stack = zend_vm_calc_used_stack(num_args, func);
172172

173-
return zend_vm_stack_push_call_frame_ex(call_info,
174-
func, used_stack, called_scope, object, prev TSRMLS_CC);
173+
return zend_vm_stack_push_call_frame_ex(used_stack, call_info,
174+
func, num_args, called_scope, object, prev TSRMLS_CC);
175175
}
176176

177177
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call TSRMLS_DC)

Zend/zend_execute_API.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
818818
ZVAL_COPY(param, &fci->params[i]);
819819
}
820820
}
821-
ZEND_CALL_NUM_ARGS(call) = fci->param_count;
822821

823822
EG(scope) = calling_scope;
824823
if (func->common.fn_flags & ZEND_ACC_STATIC) {
@@ -1471,17 +1470,14 @@ ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ *
14711470
if (zv) {
14721471
if (Z_TYPE_P(zv) == IS_INDIRECT) {
14731472
zval *val = Z_INDIRECT_P(zv);
1474-
if (Z_TYPE_P(val) == IS_UNDEF) {
1475-
ZVAL_UNDEF(EX_VAR_NUM(i));
1476-
} else {
1477-
ZVAL_COPY_VALUE(EX_VAR_NUM(i), val);
1478-
}
1473+
1474+
ZVAL_COPY_VALUE(EX_VAR_NUM(i), val);
14791475
} else {
14801476
ZVAL_COPY_VALUE(EX_VAR_NUM(i), zv);
14811477
}
14821478
} else {
14831479
ZVAL_UNDEF(EX_VAR_NUM(i));
1484-
zv = zend_hash_update(ht, op_array->vars[i], EX_VAR_NUM(i));
1480+
zv = zend_hash_add_new(ht, op_array->vars[i], EX_VAR_NUM(i));
14851481
}
14861482
ZVAL_INDIRECT(zv, EX_VAR_NUM(i));
14871483
}

Zend/zend_multiply.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,30 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
224224
return res;
225225
}
226226

227+
#elif defined(__GNUC__) && defined(__powerpc64__)
228+
229+
static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)
230+
{
231+
size_t res;
232+
unsigned long m_overflow;
233+
234+
__asm__ ("mulld %0,%2,%3\n\t"
235+
"mulhdu %1,%2,%3\n\t"
236+
"addc %0,%0,%4\n\t"
237+
"addze %1,%1\n"
238+
: "=&r"(res), "=&r"(m_overflow)
239+
: "r"(nmemb),
240+
"r"(size),
241+
"r"(offset));
242+
243+
if (UNEXPECTED(m_overflow)) {
244+
*overflow = 1;
245+
return 0;
246+
}
247+
*overflow = 0;
248+
return res;
249+
}
250+
227251
#elif SIZEOF_SIZE_T == 4
228252

229253
static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, int *overflow)

0 commit comments

Comments
 (0)