Skip to content

Commit ec320ec

Browse files
authored
Merge branch 'php:master' into bz2-param-1
2 parents 5864baf + 27d28ee commit ec320ec

18 files changed

Lines changed: 154 additions & 25 deletions

File tree

.github/actions/brew/action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@ runs:
1313
1414
# Some packages exist on x86 but not arm, or vice versa.
1515
# Install them with reinstall to avoid warnings.
16-
brew reinstall autoconf webp tidy-html5 libzip libsodium icu4c curl
17-
brew install \
16+
brew reinstall -v \
17+
autoconf \
18+
webp \
19+
tidy-html5 \
20+
libzip \
21+
libsodium \
22+
icu4c \
23+
curl
24+
brew install -v \
1825
bison \
1926
re2c
20-
brew install \
27+
brew install -v \
2128
bzip2 \
2229
enchant \
2330
libffi \

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ jobs:
363363
- name: Update clang
364364
uses: ./.github/actions/macos-update-clang
365365
- name: brew
366+
timeout-minutes: 10
366367
uses: ./.github/actions/brew
367368
- name: ./configure
368369
uses: ./.github/actions/configure-macos

.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ jobs:
242242
- name: Update clang
243243
uses: ./.github/actions/macos-update-clang
244244
- name: brew
245+
timeout-minutes: 10
245246
uses: ./.github/actions/brew
246247
- name: ccache
247248
uses: hendrikmuhs/ccache-action@v1.2

Zend/tests/oss-fuzz-480111866.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
OSS-Fuzz #480111866: Assignment to assignment through list operator
3+
--FILE--
4+
<?php
5+
6+
[[&$y] = y] = y;
7+
8+
?>
9+
--EXPECTF--
10+
Fatal error: Assignments can only happen to writable values in %s on line %d

Zend/zend_ast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,6 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
11531153
if (args->children != 1 || args->child[0]->attr != ZEND_PLACEHOLDER_VARIADIC) {
11541154
/* TODO: PFAs */
11551155
zend_error_noreturn(E_COMPILE_ERROR, "Constant expression contains invalid operations");
1156-
return FAILURE;
11571156
}
11581157

11591158
switch (ast->kind) {

Zend/zend_compile.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,16 +2734,21 @@ void zend_emit_final_return(bool return_one) /* {{{ */
27342734
}
27352735
/* }}} */
27362736

2737-
static bool zend_propagate_list_refs(zend_ast *ast);
2738-
27392737
static inline bool zend_is_variable(const zend_ast *ast) /* {{{ */
27402738
{
2741-
if (ast->kind == ZEND_AST_VAR
2739+
return ast->kind == ZEND_AST_VAR
27422740
|| ast->kind == ZEND_AST_DIM
27432741
|| ast->kind == ZEND_AST_PROP
27442742
|| ast->kind == ZEND_AST_NULLSAFE_PROP
2745-
|| ast->kind == ZEND_AST_STATIC_PROP
2746-
|| ast->kind == ZEND_AST_ASSIGN_REF) {
2743+
|| ast->kind == ZEND_AST_STATIC_PROP;
2744+
}
2745+
/* }}} */
2746+
2747+
static bool zend_propagate_list_refs(zend_ast *ast);
2748+
2749+
static inline bool zend_is_passable_by_ref(const zend_ast *ast)
2750+
{
2751+
if (zend_is_variable(ast) || ast->kind == ZEND_AST_ASSIGN_REF) {
27472752
return true;
27482753
}
27492754
if (ast->kind == ZEND_AST_ASSIGN
@@ -2753,7 +2758,6 @@ static inline bool zend_is_variable(const zend_ast *ast) /* {{{ */
27532758
}
27542759
return false;
27552760
}
2756-
/* }}} */
27572761

27582762
static inline bool zend_is_call(const zend_ast *ast) /* {{{ */
27592763
{
@@ -3875,7 +3879,7 @@ static uint32_t zend_compile_args(
38753879
opcode = ZEND_SEND_VAR_NO_REF_EX;
38763880
}
38773881
}
3878-
} else if (zend_is_variable(arg) && !zend_ast_is_short_circuited(arg)) {
3882+
} else if (zend_is_passable_by_ref(arg) && !zend_ast_is_short_circuited(arg)) {
38793883
if (fbc && arg_num != (uint32_t) -1) {
38803884
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
38813885
zend_compile_var(&arg_node, arg, BP_VAR_W, true);

Zend/zend_inheritance.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,6 @@ static void zend_do_implement_interfaces(zend_class_entry *ce, zend_class_entry
22632263
if (UNEXPECTED(!(iface->ce_flags & ZEND_ACC_INTERFACE))) {
22642264
efree(interfaces);
22652265
zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name));
2266-
return;
22672266
}
22682267
for (uint32_t j = 0; j < num_interfaces; j++) {
22692268
if (interfaces[j] == iface) {

ext/dom/documenttype.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ zend_result dom_documenttype_entities_read(dom_object *obj, zval *retval)
5353
{
5454
DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
5555

56-
object_init_ex(retval, dom_get_dtd_namednodemap_ce(php_dom_follow_spec_intern(obj)));
56+
object_init_ex(retval, dom_get_dtd_namednodemap_ce(instanceof_function(obj->std.ce, dom_modern_documenttype_class_entry)));
5757

5858
xmlHashTable *entityht = (xmlHashTable *) dtdptr->entities;
5959

@@ -74,7 +74,7 @@ zend_result dom_documenttype_notations_read(dom_object *obj, zval *retval)
7474
{
7575
DOM_PROP_NODE(xmlDtdPtr, dtdptr, obj);
7676

77-
object_init_ex(retval, dom_get_dtd_namednodemap_ce(php_dom_follow_spec_intern(obj)));
77+
object_init_ex(retval, dom_get_dtd_namednodemap_ce(instanceof_function(obj->std.ce, dom_modern_documenttype_class_entry)));
7878

7979
xmlHashTable *notationht = (xmlHashTable *) dtdptr->notations;
8080

ext/dom/dom_properties.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ zend_result dom_entity_version_read(dom_object *obj, zval *retval);
104104
zend_result dom_entity_reference_child_read(dom_object *obj, zval *retval);
105105
zend_result dom_entity_reference_text_content_read(dom_object *obj, zval *retval);
106106
zend_result dom_entity_reference_child_nodes_read(dom_object *obj, zval *retval);
107+
zend_result dom_modern_entity_reference_child_nodes_read(dom_object *obj, zval *retval);
107108

108109
/* namednodemap properties */
109110
zend_result dom_namednodemap_length_read(dom_object *obj, zval *retval);
@@ -122,6 +123,7 @@ zend_result dom_node_node_type_read(dom_object *obj, zval *retval);
122123
zend_result dom_node_parent_node_read(dom_object *obj, zval *retval);
123124
zend_result dom_node_parent_element_read(dom_object *obj, zval *retval);
124125
zend_result dom_node_child_nodes_read(dom_object *obj, zval *retval);
126+
zend_result dom_modern_node_child_nodes_read(dom_object *obj, zval *retval);
125127
zend_result dom_node_first_child_read(dom_object *obj, zval *retval);
126128
zend_result dom_node_last_child_read(dom_object *obj, zval *retval);
127129
zend_result dom_node_previous_sibling_read(dom_object *obj, zval *retval);

ext/dom/entityreference.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,12 @@ zend_result dom_entity_reference_child_nodes_read(dom_object *obj, zval *retval)
106106
return dom_node_child_nodes_read(obj, retval);
107107
}
108108

109+
zend_result dom_modern_entity_reference_child_nodes_read(dom_object *obj, zval *retval)
110+
{
111+
DOM_PROP_NODE(xmlNodePtr, nodep, obj);
112+
113+
dom_entity_reference_fetch_and_sync_declaration(nodep);
114+
return dom_modern_node_child_nodes_read(obj, retval);
115+
}
116+
109117
#endif

0 commit comments

Comments
 (0)