History log of /PHP-8.4/Zend/zend_compile.c (Results 1 – 25 of 2585)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 02ee521e 10-Nov-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)

Reproducer: https://github.com/php/php-src/issues/16727#issuecomment-2466256317

The root cause is a data race

Fix GH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)

Reproducer: https://github.com/php/php-src/issues/16727#issuecomment-2466256317

The root cause is a data race between two different threads:

1) We allocate a lower cased name for an anonymous class here:
https://github.com/php/php-src/blob/f97353f228e21dcc2db24d7edf08c1cb3678b0fd/Zend/zend_compile.c#L8109
2) This gets looked up as an interned string here:
https://github.com/php/php-src/blob/f97353f228e21dcc2db24d7edf08c1cb3678b0fd/Zend/zend_compile.c#L8112
Assuming that there are uppercase symbols in the string and therefore
`lcname != name` and that `lcname` is not yet in the interned string table,
the pointer value of `lcname` won't change.
3) Here we add the string into the interned string table:
https://github.com/php/php-src/blob/f97353f228e21dcc2db24d7edf08c1cb3678b0fd/Zend/zend_compile.c#L8223
However, in the meantime another thread could've added the string into the interned string table.
This means that the following code will run, indirectly called via the `LITERAL_STR` macro,
freeing `lcname`: https://github.com/php/php-src/blob/62e53e6f4965f37d379a3fd21f65a4210c5c86b5/ext/opcache/ZendAccelerator.c#L572-L575
4) In the reproducer we then access the freed `lcname` string here:
https://github.com/php/php-src/blob/f97353f228e21dcc2db24d7edf08c1cb3678b0fd/Zend/zend_compile.c#L8229

This is solved in my patch by retrieving the interned string pointer
and putting it in `lcname`.

Closes GH-16748.

show more ...


# de7ef3fa 21-Oct-2024 Ilija Tovilo

Fix lineno in function redeclaration error

We were previously using the lineno of the first instruction, rather than the
start of the function itself.

Fixes GH-16509
Closes

Fix lineno in function redeclaration error

We were previously using the lineno of the first instruction, rather than the
start of the function itself.

Fixes GH-16509
Closes GH-16531

show more ...


# a8bbc845 16-Oct-2024 Ilija Tovilo

Disallow asymmetric visibility on static properties

This check was forgotten in the original implementation. Relaxing this
restriction shouldn't be hard, but needs some work. We either n

Disallow asymmetric visibility on static properties

This check was forgotten in the original implementation. Relaxing this
restriction shouldn't be hard, but needs some work. We either need to prevent
merging of cache slots for R/RW/W, or we need to introduce an additional check
when writing to the property indirectly. This check is currently present only
for direct writes.

Closes GH-16462

show more ...


# 702fb318 23-Sep-2024 DanielEScherzer

`zend_resolve_const_class_name_reference()`: use double quotes around names (#15998)

This is a follow-up to #15990, as it turns out there was a second place that emits this kind of error mes

`zend_resolve_const_class_name_reference()`: use double quotes around names (#15998)

This is a follow-up to #15990, as it turns out there was a second place that emits this kind of error message.

show more ...


# 34325c5e 22-Sep-2024 DanielEScherzer

`zend_assert_valid_class_name()`: use double quotes around names (#15990)


# 79d708cf 21-Sep-2024 Daniel Scherzer

GH-15976: clarify error messages for enum/trait/interface/alias names

Instead of always saying that a name is reserved or deprecated and
cannot/should not be used as a class name, take t

GH-15976: clarify error messages for enum/trait/interface/alias names

Instead of always saying that a name is reserved or deprecated and
cannot/should not be used as a class name, take the usage into account and say
the name cannot be used as an enum name, trait name, etc. In the process, for
class names add a missing "a".

show more ...


# 2a30f2ff 01-Sep-2024 Jorg Adam Sowa

Add type indicator to array/arg unpack error messages (GH-15448)


# 8df557ac 27-Aug-2024 Ilija Tovilo

[RFC] Asymmetric visibility v2 (GH-15063)

Co-authored-by: Larry Garfield <larry@garfieldtech.com>


# 5853cdb7 20-Aug-2024 Gina Peter Bnayard

Use "must not" instead of "cannot" wording


# 36b19774 19-Aug-2024 Ilija Tovilo

Fix missing compile error when declaring hooked props on readonly classes (GH-15439)

Fixes GH-15419


# 770616b8 19-Aug-2024 Ilija Tovilo

Fix param with hooks but no visibility not treated as cpp (GH-15442)

Fixes GH-15438


# a79c70f5 14-Aug-2024 Gina Peter Banyard

[RFC] Convert exit (and die) from language constructs to functions (#13483)

RFC: https://wiki.php.net/rfc/exit-as-function


# be6dee3c 05-Aug-2024 Ilija Tovilo

Reset seen symbols when ending namespace (GH-15244)

Previously, seen symbols were never cleaned during the compilation of a single
file. This makes it impossible to use a class or functi

Reset seen symbols when ending namespace (GH-15244)

Previously, seen symbols were never cleaned during the compilation of a single
file. This makes it impossible to use a class or function from a different
namespace if such a symbol is also declared within the same file. This is
inconsistent with how it would work when split into different files.

show more ...


# a4772a0c 12-Aug-2024 Ilija Tovilo

[skip ci] Remove unclosed vim code folding


# 0a23b067 12-Aug-2024 Gina Peter Banyard

Deprecate using "_" as a class name (#15360)

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name


# 50217b35 05-Aug-2024 Ilija Tovilo

Remove IS_STATIC_VAR_UNINITIALIZED (#15227)

This flag was never necessary. We know a static variable is uninitialized (i.e.
the initializer has never been called) iff the zval in the sta

Remove IS_STATIC_VAR_UNINITIALIZED (#15227)

This flag was never necessary. We know a static variable is uninitialized (i.e.
the initializer has never been called) iff the zval in the static variable array
does not contain a reference.

Prompted by a related issue in ext-uopz reported by Christoph.

show more ...


# 551038bb 16-Jul-2024 Tim Düsterhus

zend_compile: Fully remove `ZEND_DIM_ALTERNATIVE_SYNTAX` (#14974)

This flag is longer set since the merge of property hooks in
780a8280d23453ebab5df0dbc35ac897c07c1f0d. This patch remove

zend_compile: Fully remove `ZEND_DIM_ALTERNATIVE_SYNTAX` (#14974)

This flag is longer set since the merge of property hooks in
780a8280d23453ebab5df0dbc35ac897c07c1f0d. This patch removes it completely,
because the corresponding error messages are unreachable.

show more ...


# 780a8280 14-Jul-2024 Ilija Tovilo

[RFC] Property hooks (#13455)

RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>


# 0bd26021 03-Jul-2024 Arnaud Le Blanc

Fix stack limit on ASAN/MSAN (#14771)

Increase the reserved stack size in ASAN builds, as instrumentation use more stack.
Increase the max allowed stack size in some tests, and enable th

Fix stack limit on ASAN/MSAN (#14771)

Increase the reserved stack size in ASAN builds, as instrumentation use more stack.
Increase the max allowed stack size in some tests, and enable these tests under ASAN.
Use __builtin_frame_address(0), instead of some stack variable, when we need a stack address, as ASAN may store local variables outside of the real stack.

show more ...


# 72c87469 02-Jul-2024 Benjamin Eberlei

RFC: Add `#[\Deprecated]` Attribute (#11293)

see https://wiki.php.net/rfc/deprecated_attribute

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
Co-authored-by: Ilija Tovilo

RFC: Add `#[\Deprecated]` Attribute (#11293)

see https://wiki.php.net/rfc/deprecated_attribute

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>

show more ...


# 8fd09566 29-Jun-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Factor out common check for short-circuited ast


# d5683376 29-Jun-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix OSS-Fuzz #69765: Yield reference to nullsafe chain

You cannot return or yield a reference to a nullsafe chain. This was
checked already in zend_compile_return but not yet in
zend

Fix OSS-Fuzz #69765: Yield reference to nullsafe chain

You cannot return or yield a reference to a nullsafe chain. This was
checked already in zend_compile_return but not yet in
zend_compile_yield.

Closes GH-14716.

show more ...


# 9b5c15ba 26-Jun-2024 Derick Rethans

Remove superfluous whitespace


# df7d304b 26-Jun-2024 Derick Rethans

Emit opcode for frameless functions at line number where the function call starts


# 2c5ed50d 17-Jun-2024 Tim Düsterhus

zend_compile: Add support for `%d` to `sprintf()` optimization (#14561)

* zend_compile: Rename `string_placeholder_count` to `placeholder_count` in `zend_compile_func_sprintf()`

Thi

zend_compile: Add support for `%d` to `sprintf()` optimization (#14561)

* zend_compile: Rename `string_placeholder_count` to `placeholder_count` in `zend_compile_func_sprintf()`

This is intended to make the diff of a follow-up commit smaller.

* zend_compile: Add support for `%d` to `sprintf()` optimization

This extends the existing `sprintf()` optimization by support for the `%d`
placeholder, which effectively equivalent to an `(int)` cast followed by a
`(string)` cast.

For a synthetic test using:

<?php

$a = 'foo';
$b = 42;

for ($i = 0; $i < 100_000_000; $i++) {
sprintf("%s-%d", $a, $b);
}

This optimization yields a 1.3× performance improvement:

$ hyperfine 'sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php' \
'/tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php'
Benchmark 1: sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
Time (mean ± σ): 3.296 s ± 0.094 s [User: 3.287 s, System: 0.005 s]
Range (min … max): 3.213 s … 3.527 s 10 runs

Benchmark 2: /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
Time (mean ± σ): 4.300 s ± 0.025 s [User: 4.290 s, System: 0.007 s]
Range (min … max): 4.266 s … 4.334 s 10 runs

Summary
sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php ran
1.30 ± 0.04 times faster than /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php

* Fix sprintf_rope_optimization_003.phpt test expecation for 32-bit integers

* zend_compile: Indent switch-case labels in zend_compile_func_sprintf()

* Add GMP test to sprintf() rope optimization

* Add `%s` test case to sprintf() GMP test

show more ...


12345678910>>...104