Skip to content

[pull] master from php:master #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
71ffa95
bump zip extension version to 1.22.6
remicollet May 7, 2025
e3715cd
Merge branch 'PHP-8.4'
remicollet May 7, 2025
c6a9bee
ext/standard/md5: Minor refactorings (#18518)
jorgsowa May 8, 2025
4527baf
gen_stub: break up closing tag in DOMCdataSection
DanielEScherzer Mar 17, 2025
bfa2b92
gen_stub: add `ExposedDocComment::getInitCode()`
DanielEScherzer Mar 17, 2025
45d313b
gen_stub: simplify `generateVersionDependentFlagCode()`
DanielEScherzer Mar 17, 2025
0d79039
gen_stub: simplify `ArgInfo::getDefaultValueAsMethodSynopsisString()`
DanielEScherzer Mar 17, 2025
24b7c7a
gen_stub: add `ArgInfo::toZendInfo()`
DanielEScherzer Mar 17, 2025
b5361d7
gen_stub: add `ReturnInfo::beginArgInfo()`
DanielEScherzer Mar 17, 2025
39a6d60
gen_stub: move `funcInfoToCode()` into `FuncInfo`
DanielEScherzer Mar 17, 2025
4861391
gen_stub: inline some single-use variables
DanielEScherzer Mar 17, 2025
722eba2
gen_stub: drop unused parameters
DanielEScherzer Mar 17, 2025
ec3ecdc
gen_stub: documentation updates
DanielEScherzer Mar 18, 2025
1c9b6b8
gen_stub: move `handleStatements()` into `FileInfo`
DanielEScherzer Mar 18, 2025
ce3990c
gen_stub: move `handlePreprocessorConditions()` into `FileInfo()`
DanielEScherzer Mar 18, 2025
d42bac2
gen_stub: move `parseDocComments()` into `DocCommentTag`
DanielEScherzer Mar 18, 2025
bb55592
gen_stub: deduplicate and simplify DocCommentTag processing
DanielEScherzer Mar 18, 2025
c89d7a7
gen_stub: add and use `FileInfo::getLegacyVersion()`
DanielEScherzer May 8, 2025
05dbf07
gen_stub: further reduce the number of public properties
DanielEScherzer Mar 18, 2025
2b0cb76
gen_stub: move `parseStubFile()` into `FileInfo`
DanielEScherzer May 8, 2025
84f82d0
gen_stub: Fix `ce_flags` generation for compatibility mode (#18507)
TimWolla May 9, 2025
73c4e9f
Merge branch 'PHP-8.4'
TimWolla May 9, 2025
e11a702
ext/hash: tests for md5 and sha1 compatibility (#18525)
jorgsowa May 9, 2025
331ac35
Fix visibility of whitespace in config output (#18527)
schneems May 11, 2025
8d2682f
standard: Take `zend.assertions` into account for dynamic calls to `a…
TimWolla May 12, 2025
40edd58
Merge branch 'PHP-8.3' into PHP-8.4
TimWolla May 12, 2025
5626e65
Merge branch 'PHP-8.4'
TimWolla May 12, 2025
5e65d8e
standard: Remove `php_std_date()` C API (#18522)
TimWolla May 12, 2025
ba4567a
Fix OSS-Fuzz #416302790 (#18537)
nielsdos May 12, 2025
4122daa
ext/date: various array optimisations. (#18382)
devnexen May 12, 2025
18276a8
Snapshotted poly_func / poly_this may be spilled
arnaud-lb Apr 23, 2025
1de16c7
Merge branch 'PHP-8.4'
arnaud-lb May 14, 2025
89dc8d7
cli: Fix swapped output in `php --ini` (#18557)
schneems May 14, 2025
2760a3e
Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_…
remicollet May 13, 2025
8da9530
NEWS
remicollet May 15, 2025
8647624
Merge branch 'PHP-8.3' into PHP-8.4
remicollet May 15, 2025
73321e2
NEWS
remicollet May 15, 2025
2e70a89
Merge branch 'PHP-8.4'
remicollet May 15, 2025
8e5b312
Address compiler warnings.
gwanglst May 15, 2025
72efe6d
Merge branch 'PHP-8.3' into PHP-8.4
gwanglst May 15, 2025
3367f17
Merge branch 'PHP-8.4'
gwanglst May 15, 2025
47354a7
Added `zend_simd.h` (#18413)
SakiTakamachi May 16, 2025
dbc7c5f
Backport lexbor/lexbor@814e0bce970eb95d553ae1a4ba88b26ba8102d12 (#18574)
nielsdos May 16, 2025
05618e7
Merge branch 'PHP-8.4'
nielsdos May 16, 2025
4dcbd24
GH-18572: infinite stack recursion in fallback object comparison.
devnexen May 16, 2025
a788425
Merge branch 'PHP-8.3' into PHP-8.4
devnexen May 17, 2025
90d2f8a
Merge branch 'PHP-8.4'
devnexen May 17, 2025
88d6e7c
fix regex typo for GH-18577 new test
devnexen May 17, 2025
e4e7121
Merge branch 'PHP-8.3' into PHP-8.4
devnexen May 17, 2025
68abc19
Follow-up on GH-18577, adjust new test due to change on nested objects.
devnexen May 17, 2025
419b9a7
Merge branch 'PHP-8.4'
devnexen May 17, 2025
49a60ec
Correct typo in UPGRADING [skip ci] (#18584)
drbyte May 18, 2025
06738fc
Remove ZEND_ACC_USE_GUARDS from hooks (#18587)
nielsdos May 18, 2025
3f75452
Intl: Add IntlListFormatter class
BogdanUngureanu May 7, 2025
00f0175
[skip ci] IntlListFormatter UPGRADING fixes (#18590)
devnexen May 18, 2025
1e6909d
allow ldap_get_option to retrieve global option
remicollet May 15, 2025
e726d91
add more ldaps/tls tests with TLS_CACERTFILE
remicollet May 15, 2025
8e2acc0
NEWS + UPGRADING
remicollet May 19, 2025
2d6b869
zend_vm: Add OPcode specialization for `=== []` (#18571)
TimWolla May 19, 2025
3cd0383
Adjust default value of opcache.jit_hot_loop to a prime number
arnaud-lb May 16, 2025
16ca097
Do not exit to VM when setting undefined prop in constructor
arnaud-lb May 16, 2025
35455b1
fix: dangling opline in ZEND_INIT_ARRAY (#18578)
morrisonlevi May 19, 2025
59e6165
Merge branch 'PHP-8.3' into PHP-8.4
morrisonlevi May 19, 2025
46ac878
Fix OSS-Fuzz #417078295
nielsdos May 18, 2025
98cb17f
Fix OSS-Fuzz #418106144
nielsdos May 18, 2025
08cba2d
Merge branch 'PHP-8.3' into PHP-8.4
nielsdos May 19, 2025
0b48e2a
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
92a0cc7
Fix deprecation warning for libxml SAX header (#18594)
nielsdos May 19, 2025
9bf140a
Merge branch 'PHP-8.3' into PHP-8.4
nielsdos May 19, 2025
a3fa5ae
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
41e11a6
Fix GH-18567: Preloading with internal class alias triggers assertion…
nielsdos May 16, 2025
43915b3
Merge branch 'PHP-8.3' into PHP-8.4
nielsdos May 19, 2025
94f5037
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
6b795f6
Fix GH-18534: FPM exit code 70 with enabled opcache and hooked proper…
nielsdos May 18, 2025
383aad8
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
db3bf71
Fix leak of accel_globals->key
nielsdos May 18, 2025
146157d
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
5bbe3d7
Improve performance of instantiating exceptions/errors (#18442)
nielsdos May 19, 2025
b2d78ae
Backport accel_globals->key leak fix (8.3)
nielsdos May 19, 2025
b14250a
Merge branch 'PHP-8.3' into PHP-8.4
nielsdos May 19, 2025
63657df
Merge branch 'PHP-8.4'
nielsdos May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ PHP NEWS
. Added grapheme_levenshtein() function. (Yuya Hamada)
. Added Locale::addLikelySubtags/Locale::minimizeSubtags to handle
adding/removing likely subtags to a locale. (David Carlier)
. Added IntlListFormatter class to format a list of items with a locale
, operands types and units. (BogdanUngureanu)

- LDAP:
. Allow ldap_get_option to retrieve global option by allowing NULL for
connection instance ($ldap). (Remi)

- MySQLi:
. Fixed bugs GH-17900 and GH-8084 (calling mysqli::__construct twice).
Expand All @@ -105,9 +111,10 @@ PHP NEWS
. Added mysqlnd.collect_memory_statistics to ini quick reference.
(hauk92)

- OPcache:
- Opcache:
. Fixed ZTS OPcache build on Cygwin. (cmb)
. Added opcache.file_cache_read_only. (Samuel Melrose)
. Updated default value of opcache.jit_hot_loop. (Arnaud)

- Output:
. Fixed calculation of aligned buffer size. (cmb)
Expand Down
17 changes: 16 additions & 1 deletion UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ PHP 8.5 UPGRADE NOTES
number formats.
. Added Locale::addLikelySubtags and Locale::minimizeSubtags to
handle likely tags on a given locale.
. Added IntlListFormatter class to format, order, punctuates
a list of items with a given locale, IntlListFormatter::TYPE_AND,
IntlListFormatter::TYPE_OR, IntlListFormatter::TYPE_UNITS operands and
IntlListFormatter::WIDTH_WIDE, IntlListFormatter::WIDTH_SHORT and
IntlListFormatter::WIDTH_NARROW widths.
It is supported from icu 67.

- XSL:
. The $namespace argument of XSLTProcessor::getParameter(),
Expand Down Expand Up @@ -233,6 +239,10 @@ PHP 8.5 UPGRADE NOTES
have dropped the false from the return type union. Returning false
was actually never possible.

- LDAP:
. ldap_get_option() now accept a NULL connection, as ldap_set_option(),
to allow retrieval of global options.

- libxml:
. libxml_set_external_entity_loader() now has a formal return type of true.

Expand Down Expand Up @@ -450,6 +460,9 @@ PHP 8.5 UPGRADE NOTES
Note: A cache generated with a different build of PHP, a different file
path, or different settings (including which extensions are loaded), may be
ignored.
. The default value of opcache.jit_hot_loop is now 61 (a prime) to prevent it
from being a multiple of loop iteration counts.
It is recommended that this parameter is set to a prime number.

========================================
12. Windows Support
Expand All @@ -463,7 +476,7 @@ PHP 8.5 UPGRADE NOTES
worked for in-tree builds); some extension builds (especially when using
Makefile.frag.w32) may need adjustments.

* --enable-sanitzer is now supported for MSVC builds. This enables ASan and
* --enable-sanitizer is now supported for MSVC builds. This enables ASan and
debug assertions, and is supported as of MSVC 16.10 and Windows 10.

* The --with-uncritical-warn-choke configuration option for clang builds is
Expand Down Expand Up @@ -506,6 +519,8 @@ PHP 8.5 UPGRADE NOTES
- Core:
. Remove OPcodes for identity comparisons against booleans, particularly
for the match(true) pattern.
. Add OPcode specialization for `=== []` and `!== []` comparisons.
. Creating exception objects is now much faster.

- ReflectionProperty:
. Improved performance of the following methods: getValue(), getRawValue(),
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
- ext/standard
. Added php_url_decode_ex() and php_raw_url_decode_ex() that unlike their
non-ex counterparts do not work in-place.
. The php_std_date() function has been removed. Use php_format_date() with
the "D, d M Y H:i:s \\G\\M\\T" format instead.

========================
4. OpCode changes
Expand Down
2 changes: 1 addition & 1 deletion Zend/Optimizer/zend_optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ void zend_foreach_op_array(zend_script *script, zend_op_array_func_t func, void
if (property->ce == ce && property->hooks) {
for (uint32_t i = 0; i < ZEND_PROPERTY_HOOK_COUNT; i++) {
zend_function *hook = hooks[i];
if (hook && hook->common.scope == ce) {
if (hook && hook->common.scope == ce && !(hooks[i]->op_array.fn_flags & ZEND_ACC_TRAIT_CLONE)) {
zend_foreach_op_array_helper(&hooks[i]->op_array, func, context);
}
}
Expand Down
10 changes: 10 additions & 0 deletions Zend/tests/constants/oss_fuzz_416302790.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
OSS-Fuzz #416302790
--FILE--
<?php
function x(){
#[Attr] const X = 1;
}
?>
--EXPECTF--
Parse error: syntax error, unexpected token "const" in %s on line %d
39 changes: 39 additions & 0 deletions Zend/tests/gh18572.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--TEST--
GH-18572: Nested object comparison leading to stack overflow
--SKIPIF--
<?php
if (getenv('SKIP_ASAN')) die('skip as it fatally crash');
?>
--FILE--
<?php

#[AllowDynamicProperties]
class Node {
public $next;
// forcing dynamic property creation is key
}

$first = new Node();
$first->previous = $first;
$first->next = $first;

$cur = $first;

for ($i = 0; $i < 50000; $i++) {
$new = new Node();
$new->previous = $cur;
$cur->next = $new;
$new->next = $first;
$first->previous = $new;
$cur = $new;
}

try {
// Force comparison manually to trigger zend_hash_compare
$first == $cur;
} catch(Error $e) {
echo $e->getMessage(). PHP_EOL;
}
?>
--EXPECTREGEX--
(Maximum call stack size reached during object comparison|Nesting level too deep - recursive dependency\?)
20 changes: 20 additions & 0 deletions Zend/tests/gh418106144.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
OSS-Fuzz #418106144
--FILE--
<?php

class Foo {
function __toString(){}
}
function test($y=new Foo>''){
var_dump();
}
try {
test();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Foo::__toString(): Return value must be of type string, none returned
17 changes: 17 additions & 0 deletions Zend/tests/oss_fuzz_417078295.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
OSS-Fuzz #417078295
--FILE--
<?php

function foo() {
$a = new stdClass();
static $a = $a;
debug_zval_dump($a);
}

foo();

?>
--EXPECT--
object(stdClass)#1 (0) refcount(2){
}
3 changes: 2 additions & 1 deletion Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,10 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
/* op1 > op2 is the same as op2 < op1 */
binary_op_type op = ast->kind == ZEND_AST_GREATER
? is_smaller_function : is_smaller_or_equal_function;
ret = op(result, &op2, &op1);
op(result, &op2, &op1);
zval_ptr_dtor_nogc(&op1);
zval_ptr_dtor_nogc(&op2);
ret = EG(exception) ? FAILURE : SUCCESS;
}
break;
case ZEND_AST_UNARY_OP:
Expand Down
77 changes: 51 additions & 26 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
#include "zend_exceptions_arginfo.h"
#include "zend_observer.h"

#define ZEND_EXCEPTION_MESSAGE_OFF 0
#define ZEND_EXCEPTION_CODE_OFF 2
#define ZEND_EXCEPTION_FILE_OFF 3
#define ZEND_EXCEPTION_LINE_OFF 4
#define ZEND_EXCEPTION_TRACE_OFF 5
#define ZEND_EXCEPTION_PREVIOUS_OFF 6
#define ZEND_EXCEPTION_SEVERITY_OFF 7

ZEND_API zend_class_entry *zend_ce_throwable;
ZEND_API zend_class_entry *zend_ce_exception;
ZEND_API zend_class_entry *zend_ce_error_exception;
Expand Down Expand Up @@ -254,11 +262,33 @@ ZEND_API void zend_clear_exception(void) /* {{{ */
}
/* }}} */

/* Same as writing to OBJ_PROP_NUM() when there are no hooks,
* but checks the offset is correct when Zend is built in debug mode.
* This is faster than going through the regular property write routine when the offset is known at compile time. */
static void zend_update_property_num_checked(zend_object *object, uint32_t prop_num, zend_string *member, zval *value)
{
if (UNEXPECTED(object->ce->num_hooked_props > 0)) {
/* Property may have been overridden with a hook. */
zend_update_property_ex(object->ce, object, member, value);
zval_ptr_dtor(value);
return;
}
#if ZEND_DEBUG
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = i_get_exception_base(object);
const zend_property_info *prop_info = zend_get_property_info(object->ce, member, true);
ZEND_ASSERT(OBJ_PROP_TO_NUM(prop_info->offset) == prop_num);
EG(fake_scope) = old_scope;
#endif
zval *zv = OBJ_PROP_NUM(object, prop_num);
zval_ptr_safe_dtor(zv);
ZVAL_COPY_VALUE(zv, value);
}

static zend_object *zend_default_exception_new(zend_class_entry *class_type) /* {{{ */
{
zval tmp;
zval trace;
zend_class_entry *base_ce;
zend_string *filename;

zend_object *object = zend_objects_new(class_type);
Expand All @@ -269,26 +299,23 @@ static zend_object *zend_default_exception_new(zend_class_entry *class_type) /*
0,
EG(exception_ignore_args) ? DEBUG_BACKTRACE_IGNORE_ARGS : 0, 0);
} else {
array_init(&trace);
ZVAL_EMPTY_ARRAY(&trace);
}
Z_SET_REFCOUNT(trace, 0);

base_ce = i_get_exception_base(object);
zend_update_property_num_checked(object, ZEND_EXCEPTION_TRACE_OFF, ZSTR_KNOWN(ZEND_STR_TRACE), &trace);

if (EXPECTED((class_type != zend_ce_parse_error && class_type != zend_ce_compile_error)
|| !(filename = zend_get_compiled_filename()))) {
ZVAL_STRING(&tmp, zend_get_executed_filename());
zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
zval_ptr_dtor(&tmp);
zend_update_property_num_checked(object, ZEND_EXCEPTION_FILE_OFF, ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
ZVAL_LONG(&tmp, zend_get_executed_lineno());
zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
zend_update_property_num_checked(object, ZEND_EXCEPTION_LINE_OFF, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
} else {
ZVAL_STR(&tmp, filename);
zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
ZVAL_STR_COPY(&tmp, filename);
zend_update_property_num_checked(object, ZEND_EXCEPTION_FILE_OFF, ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
ZVAL_LONG(&tmp, zend_get_compiled_lineno());
zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
zend_update_property_num_checked(object, ZEND_EXCEPTION_LINE_OFF, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
}
zend_update_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), &trace);

return object;
}
Expand All @@ -308,27 +335,26 @@ ZEND_METHOD(Exception, __construct)
zend_string *message = NULL;
zend_long code = 0;
zval tmp, *object, *previous = NULL;
zend_class_entry *base_ce;

object = ZEND_THIS;
base_ce = i_get_exception_base(Z_OBJ_P(object));

if (zend_parse_parameters(ZEND_NUM_ARGS(), "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
RETURN_THROWS();
}

if (message) {
ZVAL_STR(&tmp, message);
zend_update_property_ex(base_ce, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_MESSAGE), &tmp);
ZVAL_STR_COPY(&tmp, message);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_MESSAGE_OFF, ZSTR_KNOWN(ZEND_STR_MESSAGE), &tmp);
}

if (code) {
ZVAL_LONG(&tmp, code);
zend_update_property_ex(base_ce, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_CODE), &tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_CODE_OFF, ZSTR_KNOWN(ZEND_STR_CODE), &tmp);
}

if (previous) {
zend_update_property_ex(base_ce, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_PREVIOUS), previous);
Z_ADDREF_P(previous);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_PREVIOUS_OFF, ZSTR_KNOWN(ZEND_STR_PREVIOUS), previous);
}
}
/* }}} */
Expand Down Expand Up @@ -368,34 +394,33 @@ ZEND_METHOD(ErrorException, __construct)

if (message) {
ZVAL_STR_COPY(&tmp, message);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_MESSAGE), &tmp);
zval_ptr_dtor(&tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_MESSAGE_OFF, ZSTR_KNOWN(ZEND_STR_MESSAGE), &tmp);
}

if (code) {
ZVAL_LONG(&tmp, code);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_CODE), &tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_CODE_OFF, ZSTR_KNOWN(ZEND_STR_CODE), &tmp);
}

if (previous) {
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_PREVIOUS), previous);
Z_ADDREF_P(previous);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_PREVIOUS_OFF, ZSTR_KNOWN(ZEND_STR_PREVIOUS), previous);
}

ZVAL_LONG(&tmp, severity);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_SEVERITY), &tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_SEVERITY_OFF, ZSTR_KNOWN(ZEND_STR_SEVERITY), &tmp);

if (filename) {
ZVAL_STR_COPY(&tmp, filename);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
zval_ptr_dtor(&tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_FILE_OFF, ZSTR_KNOWN(ZEND_STR_FILE), &tmp);
}

if (!lineno_is_null) {
ZVAL_LONG(&tmp, lineno);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_LINE_OFF, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
} else if (filename) {
ZVAL_LONG(&tmp, 0);
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
zend_update_property_num_checked(Z_OBJ_P(object), ZEND_EXCEPTION_LINE_OFF, ZSTR_KNOWN(ZEND_STR_LINE), &tmp);
}
}
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -2983,7 +2983,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
hooks[j] = new_fn;
}
}
ce->ce_flags |= ZEND_ACC_USE_GUARDS;
ce->num_hooked_props++;
}
} ZEND_HASH_FOREACH_END();
}
Expand Down
10 changes: 7 additions & 3 deletions Zend/zend_language_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%type <ast> isset_variable type return_type type_expr type_without_static
%type <ast> identifier type_expr_without_static union_type_without_static_element union_type_without_static intersection_type_without_static
%type <ast> inline_function union_type_element union_type intersection_type
%type <ast> attributed_statement attributed_class_statement attributed_parameter
%type <ast> attributed_statement attributed_top_statement attributed_class_statement attributed_parameter
%type <ast> attribute_decl attribute attributes attribute_group namespace_declaration_name
%type <ast> match match_arm_list non_empty_match_arm_list match_arm match_arm_cond_list
%type <ast> enum_declaration_statement enum_backing_type enum_case enum_case_expr
Expand Down Expand Up @@ -391,13 +391,17 @@ attributed_statement:
| trait_declaration_statement { $$ = $1; }
| interface_declaration_statement { $$ = $1; }
| enum_declaration_statement { $$ = $1; }
;

attributed_top_statement:
attributed_statement { $$ = $1; }
| T_CONST const_list ';' { $$ = $2; }
;

top_statement:
statement { $$ = $1; }
| attributed_statement { $$ = $1; }
| attributes attributed_statement { $$ = zend_ast_with_attributes($2, $1); }
| attributed_top_statement { $$ = $1; }
| attributes attributed_top_statement { $$ = zend_ast_with_attributes($2, $1); }
| T_HALT_COMPILER '(' ')' ';'
{ $$ = zend_ast_create(ZEND_AST_HALT_COMPILER,
zend_ast_create_zval_from_long(zend_get_scanned_file_offset()));
Expand Down
Loading