Skip to content

Commit b2f605e

Browse files
Merge branch 'php:master' into readline-true
2 parents ee3ea9d + 55e8ebe commit b2f605e

28 files changed

+333
-119
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
/ext/random @TimWolla @zeriyoshi
4646
/ext/session @Girgias
4747
/ext/simplexml @nielsdos
48+
/ext/soap @nielsdos
4849
/ext/sockets @devnexen
4950
/ext/spl @Girgias
5051
/ext/standard @bukka

EXTENSIONS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ SINCE: 5.0
184184
-------------------------------------------------------------------------------
185185
EXTENSION: soap
186186
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@php.net> (2004 - 2018)
187-
MAINTENANCE: Maintained
187+
Niels Dossche <nielsdos@php.net> (2024 - 2024)
188+
MAINTENANCE: Odd fixes
188189
STATUS: Working
189190
-------------------------------------------------------------------------------
190191
EXTENSION: xml

Zend/tests/gh16508.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-16508: Missing lineno in inheritance errors of delayed early bound classes
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.enable_cli=1
7+
--FILE--
8+
<?php
9+
10+
new Test2;
11+
12+
class Test2 extends Test {}
13+
14+
abstract class Test {
15+
abstract function foo();
16+
}
17+
18+
?>
19+
--EXPECTF--
20+
Fatal error: Class Test2 contains 1 abstract method and must therefore be declared abstract or implement the remaining method (Test::foo) in %s on line 5

Zend/tests/gh16509.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
function test() {
4+
5+
6+
echo 'foo';
7+
}

Zend/tests/gh16509.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
GH-16509: Incorrect lineno reported for function redeclaration
3+
--FILE--
4+
<?php
5+
6+
include __DIR__ . '/gh16509.inc';
7+
include __DIR__ . '/gh16509.inc';
8+
9+
?>
10+
--EXPECTF--
11+
Fatal error: Cannot redeclare function test() (previously declared in %sgh16509.inc:3) in %sgh16509.inc on line 3

Zend/tests/gh16515.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
GH-16515: Incorrect propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
3+
--FILE--
4+
<?php
5+
6+
namespace Foo;
7+
8+
class Foo {
9+
public function &__call($method, $args) {}
10+
}
11+
12+
call_user_func((new Foo)->bar(...));
13+
14+
?>
15+
--EXPECTF--
16+
Notice: Only variable references should be returned by reference in %s on line %d

Zend/tests/lazy_objects/init_ast_const.phpt

Lines changed: 0 additions & 27 deletions
This file was deleted.

Zend/tests/lazy_objects/init_ast_const_failure.phpt

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
oss-fuzz #71407
3+
--FILE--
4+
<?php
5+
6+
class C {
7+
public $x=x;
8+
}
9+
10+
$reflector = new ReflectionClass(C::class);
11+
12+
try {
13+
$obj = $reflector->newLazyGhost(function() {});
14+
clone $obj;
15+
} catch (Error $e) {
16+
printf("%s: %s\n", $e::class, $e->getMessage());
17+
}
18+
19+
20+
?>
21+
--EXPECT--
22+
Error: Undefined constant "x"

Zend/zend_closures.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ void zend_closure_from_frame(zval *return_value, zend_execute_data *call) { /* {
871871

872872
memset(&trampoline, 0, sizeof(zend_internal_function));
873873
trampoline.type = ZEND_INTERNAL_FUNCTION;
874-
trampoline.fn_flags = mptr->common.fn_flags & (ZEND_ACC_STATIC | ZEND_ACC_VARIADIC);
874+
trampoline.fn_flags = mptr->common.fn_flags & (ZEND_ACC_STATIC | ZEND_ACC_VARIADIC | ZEND_ACC_RETURN_REFERENCE);
875875
trampoline.handler = zend_closure_call_magic;
876876
trampoline.function_name = mptr->common.function_name;
877877
trampoline.scope = mptr->common.scope;

Zend/zend_compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ static zend_never_inline ZEND_COLD ZEND_NORETURN void do_bind_function_error(zen
12781278
zend_error_noreturn(error_level, "Cannot redeclare function %s() (previously declared in %s:%d)",
12791279
op_array ? ZSTR_VAL(op_array->function_name) : ZSTR_VAL(old_function->common.function_name),
12801280
ZSTR_VAL(old_function->op_array.filename),
1281-
old_function->op_array.opcodes[0].lineno);
1281+
old_function->op_array.line_start);
12821282
} else {
12831283
zend_error_noreturn(error_level, "Cannot redeclare function %s()",
12841284
op_array ? ZSTR_VAL(op_array->function_name) : ZSTR_VAL(old_function->common.function_name));
@@ -8362,6 +8362,7 @@ static zend_op_array *zend_compile_func_decl_ex(
83628362
} else if (toplevel) {
83638363
/* Only register the function after a successful compile */
83648364
if (UNEXPECTED(zend_hash_add_ptr(CG(function_table), lcname, op_array) == NULL)) {
8365+
CG(zend_lineno) = decl->start_lineno;
83658366
do_bind_function_error(lcname, op_array, true);
83668367
}
83678368
}

Zend/zend_inheritance.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3849,6 +3849,8 @@ ZEND_API zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_
38493849
CG(current_linking_class) = is_cacheable ? ce : NULL;
38503850

38513851
zend_try{
3852+
CG(zend_lineno) = ce->info.user.line_start;
3853+
38523854
if (is_cacheable) {
38533855
zend_begin_record_errors();
38543856
}

Zend/zend_lazy_objects.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ ZEND_API zend_object *zend_object_make_lazy(zend_object *obj,
259259
return NULL;
260260
}
261261

262+
if (UNEXPECTED(!(reflection_ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
263+
if (UNEXPECTED(zend_update_class_constants(reflection_ce) != SUCCESS)) {
264+
ZEND_ASSERT(EG(exception));
265+
return NULL;
266+
}
267+
}
268+
262269
obj = zend_objects_new(reflection_ce);
263270

264271
for (int i = 0; i < obj->ce->default_properties_count; i++) {
@@ -373,12 +380,7 @@ ZEND_API zend_object *zend_lazy_object_mark_as_initialized(zend_object *obj)
373380

374381
zend_class_entry *ce = obj->ce;
375382

376-
if (UNEXPECTED(!(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
377-
if (UNEXPECTED(zend_update_class_constants(ce) != SUCCESS)) {
378-
ZEND_ASSERT(EG(exception));
379-
return NULL;
380-
}
381-
}
383+
ZEND_ASSERT(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED);
382384

383385
zval *default_properties_table = CE_DEFAULT_PROPERTIES_TABLE(ce);
384386
zval *properties_table = obj->properties_table;
@@ -568,12 +570,7 @@ ZEND_API zend_object *zend_lazy_object_init(zend_object *obj)
568570

569571
zend_class_entry *ce = obj->ce;
570572

571-
if (UNEXPECTED(!(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
572-
if (UNEXPECTED(zend_update_class_constants(ce) != SUCCESS)) {
573-
ZEND_ASSERT(EG(exception));
574-
return NULL;
575-
}
576-
}
573+
ZEND_ASSERT(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED);
577574

578575
if (zend_object_is_lazy_proxy(obj)) {
579576
return zend_lazy_object_init_proxy(obj);

Zend/zend_object_handlers.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,10 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce
16141614
func->arg_flags[0] = 0;
16151615
func->arg_flags[1] = 0;
16161616
func->arg_flags[2] = 0;
1617-
func->fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE | ZEND_ACC_PUBLIC | ZEND_ACC_VARIADIC;
1617+
func->fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE
1618+
| ZEND_ACC_PUBLIC
1619+
| ZEND_ACC_VARIADIC
1620+
| (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE);
16181621
if (is_static) {
16191622
func->fn_flags |= ZEND_ACC_STATIC;
16201623
}

build/gen_stub.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
16861686
$undocumentedEntity = $doc->createEntityReference('warn.undocumented.func');
16871687
$descriptionRefSec->appendChild($undocumentedEntity);
16881688
$descriptionRefSec->appendChild(new DOMText("\n "));
1689-
$returnDescriptionPara = $doc->createElement('para');
1689+
$returnDescriptionPara = $doc->createElement('simpara');
16901690
$returnDescriptionPara->appendChild(new DOMText("\n Description.\n "));
16911691
$descriptionRefSec->appendChild($returnDescriptionPara);
16921692

@@ -1709,7 +1709,7 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
17091709
$errorsDescriptionParaConstantTag->append('E_*');
17101710
$errorsDescriptionParaExceptionTag = $doc->createElement('exceptionname');
17111711
$errorsDescriptionParaExceptionTag->append('Exception');
1712-
$errorsDescriptionPara = $doc->createElement('para');
1712+
$errorsDescriptionPara = $doc->createElement('simpara');
17131713
$errorsDescriptionPara->append(
17141714
"\n When does this function issue ",
17151715
$errorsDescriptionParaConstantTag,
@@ -1813,7 +1813,7 @@ private function getParameterSection(DOMDocument $doc): DOMElement {
18131813
$parametersRefSec->appendChild($noParamEntity);
18141814
return $parametersRefSec;
18151815
} else {
1816-
$parametersPara = $doc->createElement('para');
1816+
$parametersPara = $doc->createElement('simpara');
18171817
$parametersRefSec->appendChild($parametersPara);
18181818

18191819
$parametersPara->appendChild(new DOMText("\n "));
@@ -1824,9 +1824,9 @@ private function getParameterSection(DOMDocument $doc): DOMElement {
18241824
<varlistentry>
18251825
<term><parameter>name</parameter></term>
18261826
<listitem>
1827-
<para>
1827+
<simpara>
18281828
Description.
1829-
</para>
1829+
</simpara>
18301830
</listitem>
18311831
</varlistentry>
18321832
*/
@@ -1835,7 +1835,7 @@ private function getParameterSection(DOMDocument $doc): DOMElement {
18351835
$parameterTerm = $doc->createElement('term');
18361836
$parameterTerm->appendChild($parameter);
18371837

1838-
$listItemPara = $doc->createElement('para');
1838+
$listItemPara = $doc->createElement('simpara');
18391839
$listItemPara->append(
18401840
"\n ",
18411841
"Description.",
@@ -1871,7 +1871,7 @@ private function getParameterSection(DOMDocument $doc): DOMElement {
18711871
private function getReturnValueSection(DOMDocument $doc): DOMElement {
18721872
$returnRefSec = $this->generateRefSect1($doc, 'returnvalues');
18731873

1874-
$returnDescriptionPara = $doc->createElement('para');
1874+
$returnDescriptionPara = $doc->createElement('simpara');
18751875
$returnDescriptionPara->appendChild(new DOMText("\n "));
18761876

18771877
$returnType = $this->return->getMethodSynopsisType();
@@ -2010,7 +2010,7 @@ private function getExampleSection(DOMDocument $doc, string $id): DOMElement {
20102010

20112011
$example->append("\n ", $title);
20122012

2013-
$para = $doc->createElement('para');
2013+
$para = $doc->createElement('simpara');
20142014
$para->append("\n ", "Description.", "\n ");
20152015
$example->append("\n ", $para);
20162016

0 commit comments

Comments
 (0)