Skip to content

Commit 1e49e96

Browse files
committed
Merge branch 'master' into jsond
2 parents 1119c4d + dbd02ad commit 1e49e96

File tree

90 files changed

+871
-291
lines changed

Some content is hidden

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

90 files changed

+871
-291
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
. Fixed possible read after end of buffer and use after free. (Dmitry)
6666

6767
- Opcache:
68+
. Fixed bug (try block removed while combined with xdebug). (Laruence)
6869
. Fixed bug #68644 (strlen incorrect : mbstring + func_overload=2 +UTF-8
6970
+ Opcache). (Laruence)
7071

@@ -93,6 +94,10 @@
9394
breaks the RecursiveIterator). (Paul Garvin)
9495
. Fixed bug #68479 (Added escape parameter to SplFileObject::fputcsv). (Salathe)
9596

97+
- Sqlite3:
98+
. Fix bug #68260 (SQLite3Result::fetchArray declares wrong
99+
required_num_args). (Julien)
100+
96101
- Standard:
97102
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
98103
. Fix user session handlers (See rfc:session.user.return-value). (Sara)

README.GIT-RULES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ If you fix some bugs, you should note the bug ID numbers in your
114114
commit message. Bug ID should be prefixed by "#" for easier access to
115115
bug report when developers are browsing CVS via LXR or Bonsai.
116116

117-
Example::
117+
Example:
118118

119-
Fixed bug #14016 (pgsql notice handler double free crash bug.)
119+
Fixed bug #14016 (pgsql notice handler double free crash bug.)
120120

121121
When you change the NEWS file for a bug fix, then please keep the bugs
122122
sorted in decreasing order under the fixed version.

README.PARAMETER_PARSING_API

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Note on 64bit compatibility
9090
---------------------------
9191
Please note that since version 7 PHP uses zend_long as integer type and
9292
zend_string with size_t as length, so make sure you pass zend_longs to "l"
93-
and size_t to strings length (i.e. for "s" you need to pass char * and int),
93+
and size_t to strings length (i.e. for "s" you need to pass char * and size_t),
9494
not the other way round!
9595

9696
Both mistakes might cause memory corruptions and segfaults:

Zend/tests/access_modifiers_003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ final final class test {
1010
echo "Done\n";
1111
?>
1212
--EXPECTF--
13-
Parse error: %s error,%sexpecting %s in %s on line %d
13+
Fatal error: Multiple final modifiers are not allowed in %s on line %d

Zend/tests/access_modifiers_013.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Prevent abstract and final in the same class declaration
3+
--FILE--
4+
<?php
5+
6+
final abstract class C {
7+
private function priv() { }
8+
}
9+
10+
?>
11+
--EXPECTF--
12+
Fatal error: Cannot use the final modifier on an abstract class in %s on line %d

Zend/tests/bug68775.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #68775: yield in a function argument crashes or loops indefinitely
3+
--FILE--
4+
<?php
5+
6+
function a($x) {
7+
var_dump($x);
8+
}
9+
10+
function gen() {
11+
a(yield);
12+
}
13+
14+
$g = gen();
15+
$g->send(1);
16+
17+
?>
18+
--EXPECT--
19+
int(1)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--TEST--
2+
Error cases of compound shift assignment on strings
3+
--FILE--
4+
<?php
5+
6+
$n = "65";
7+
$n <<= $n;
8+
var_dump($n);
9+
10+
$n = "-1";
11+
$n <<= $n;
12+
var_dump($n);
13+
14+
$n = "65";
15+
$n >>= $n;
16+
var_dump($n);
17+
18+
$n = "-1";
19+
$n >>= $n;
20+
var_dump($n);
21+
22+
$n = "0";
23+
$n %= $n;
24+
var_dump($n);
25+
26+
$n = "-1";
27+
$n %= $n;
28+
var_dump($n);
29+
--EXPECTF--
30+
int(0)
31+
32+
Warning: Bit shift by negative number in %s on line %d
33+
bool(false)
34+
int(0)
35+
36+
Warning: Bit shift by negative number in %s on line %d
37+
bool(false)
38+
39+
Warning: Division by zero in %s on line %d
40+
bool(false)
41+
int(0)

Zend/tests/foreach_reference.phpt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--TEST--
2+
foreach with reference
3+
--FILE--
4+
<?php
5+
6+
$array = ['a', 'b', 'c', 'd'];
7+
8+
foreach ($array as &$a) {
9+
}
10+
11+
var_dump($array);
12+
13+
var_dump(array_values($array));
14+
var_dump($a);
15+
16+
var_dump(array_reverse($array));
17+
18+
?>
19+
--EXPECTF--
20+
array(4) {
21+
[0]=>
22+
string(1) "a"
23+
[1]=>
24+
string(1) "b"
25+
[2]=>
26+
string(1) "c"
27+
[3]=>
28+
&string(1) "d"
29+
}
30+
array(4) {
31+
[0]=>
32+
string(1) "a"
33+
[1]=>
34+
string(1) "b"
35+
[2]=>
36+
string(1) "c"
37+
[3]=>
38+
&string(1) "d"
39+
}
40+
string(1) "d"
41+
array(4) {
42+
[0]=>
43+
&string(1) "d"
44+
[1]=>
45+
string(1) "c"
46+
[2]=>
47+
string(1) "b"
48+
[3]=>
49+
string(1) "a"
50+
}

Zend/tests/list_empty_error.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Empty list() assignments are not allowed
3+
--FILE--
4+
<?php
5+
6+
list(,,,,,,,,,,) = [];
7+
8+
?>
9+
--EXPECTF--
10+
Fatal error: Cannot use empty list in %s on line %d

Zend/tests/traits/bug55524.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ trait Foo extends Base {
1212
echo 'DONE';
1313
?>
1414
--EXPECTF--
15-
Fatal error: A trait (Foo) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error in %s on line %d
15+
Parse error: syntax error, unexpected 'extends' (T_EXTENDS), expecting '{' in %s on line %d

Zend/tests/traits/bugs/interfaces.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ trait THello implements MyInterface {
1616

1717
?>
1818
--EXPECTF--
19-
Fatal error: Cannot use 'MyInterface' as interface on 'THello' since it is a Trait in %s on line %d
19+
Parse error: syntax error, unexpected 'implements' (T_IMPLEMENTS), expecting '{' in %s on line %d

Zend/zend_compile.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,22 @@ void zend_do_free(znode *op1) /* {{{ */
540540
}
541541
/* }}} */
542542

543+
uint32_t zend_add_class_modifier(uint32_t flags, uint32_t new_flag) /* {{{ */
544+
{
545+
uint32_t new_flags = flags | new_flag;
546+
if ((flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) && (new_flag & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
547+
zend_error_noreturn(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed");
548+
}
549+
if ((flags & ZEND_ACC_FINAL) && (new_flag & ZEND_ACC_FINAL)) {
550+
zend_error_noreturn(E_COMPILE_ERROR, "Multiple final modifiers are not allowed");
551+
}
552+
if ((new_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) && (new_flags & ZEND_ACC_FINAL)) {
553+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class");
554+
}
555+
return new_flags;
556+
}
557+
/* }}} */
558+
543559
uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag) /* {{{ */
544560
{
545561
uint32_t new_flags = flags | new_flag;
@@ -2175,10 +2191,7 @@ static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_n
21752191
{
21762192
zend_ast_list *list = zend_ast_get_list(ast);
21772193
uint32_t i;
2178-
2179-
if (list->children == 1 && !list->child[0]) {
2180-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list");
2181-
}
2194+
zend_bool has_elems = 0;
21822195

21832196
for (i = 0; i < list->children; ++i) {
21842197
zend_ast *var_ast = list->child[i];
@@ -2187,6 +2200,7 @@ static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_n
21872200
if (var_ast == NULL) {
21882201
continue;
21892202
}
2203+
has_elems = 1;
21902204

21912205
dim_node.op_type = IS_CONST;
21922206
ZVAL_LONG(&dim_node.u.constant, i);
@@ -2198,6 +2212,11 @@ static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_n
21982212
zend_emit_op(&fetch_result, ZEND_FETCH_LIST, expr_node, &dim_node);
21992213
zend_emit_assign_znode(var_ast, &fetch_result);
22002214
}
2215+
2216+
if (!has_elems) {
2217+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list");
2218+
}
2219+
22012220
*result = *expr_node;
22022221
}
22032222
/* }}} */
@@ -4441,12 +4460,6 @@ void zend_compile_implements(znode *class_node, zend_ast *ast) /* {{{ */
44414460

44424461
zend_op *opline;
44434462

4444-
/* Traits can not implement interfaces */
4445-
if (ZEND_CE_IS_TRAIT(CG(active_class_entry))) {
4446-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as interface on '%s' "
4447-
"since it is a Trait", name->val, CG(active_class_entry)->name->val);
4448-
}
4449-
44504463
if (!zend_is_const_default_class_ref(class_ast)) {
44514464
zend_error_noreturn(E_COMPILE_ERROR,
44524465
"Cannot use '%s' as interface name as it is reserved", name->val);
@@ -4520,12 +4533,6 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
45204533
}
45214534

45224535
if (extends_ast) {
4523-
if (ZEND_CE_IS_TRAIT(ce)) {
4524-
zend_error_noreturn(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. "
4525-
"Traits can only be composed from other traits with the 'use' keyword. Error",
4526-
name->val);
4527-
}
4528-
45294536
if (!zend_is_const_default_class_ref(extends_ast)) {
45304537
zend_string *extends_name = zend_ast_get_str(extends_ast);
45314538
zend_error_noreturn(E_COMPILE_ERROR,

Zend/zend_compile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ ZEND_API binary_op_type get_binary_op(int opcode);
632632
void zend_stop_lexing(void);
633633
void zend_emit_final_return(zval *zv);
634634
zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right);
635+
uint32_t zend_add_class_modifier(uint32_t flags, uint32_t new_flag);
635636
uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag);
636637
zend_ast *zend_ast_append_doc_comment(zend_ast *list);
637638
void zend_handle_encoding_declaration(zend_ast *ast);

Zend/zend_generators.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ ZEND_API void zend_generator_resume(zend_generator *generator) /* {{{ */
303303
zend_execute_data *original_execute_data = EG(current_execute_data);
304304
zend_class_entry *original_scope = EG(scope);
305305
zend_vm_stack original_stack = EG(vm_stack);
306-
307306
original_stack->top = EG(vm_stack_top);
307+
308308
/* Set executor globals */
309309
EG(current_execute_data) = generator->execute_data;
310310
EG(scope) = generator->execute_data->func->common.scope;
@@ -314,8 +314,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator) /* {{{ */
314314

315315
/* We want the backtrace to look as if the generator function was
316316
* called from whatever method we are current running (e.g. next()).
317-
* So we have to link generator call frame with caller call frames */
318-
317+
* So we have to link generator call frame with caller call frame. */
319318
generator->execute_data->prev_execute_data = original_execute_data;
320319

321320
/* Resume execution */
@@ -329,6 +328,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator) /* {{{ */
329328
}
330329

331330
/* Restore executor globals */
331+
generator->stack->top = EG(vm_stack_top);
332332
EG(current_execute_data) = original_execute_data;
333333
EG(scope) = original_scope;
334334
EG(vm_stack_top) = original_stack->top;

0 commit comments

Comments
 (0)