History log of /php-src/Zend/zend_compile.c (Results 126 – 150 of 2851)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d478ae73 05-Nov-2021 Nikita Popov

Don't implement Stringable on traits

Traits do not support interfaces, so we should not implement
Stringable on them.

Also check the __toString() return type in the same way oth

Don't implement Stringable on traits

Traits do not support interfaces, so we should not implement
Stringable on them.

Also check the __toString() return type in the same way other
magic methods do, otherwise we would now miss the check in the
trait case.

show more ...

# 90b7bde6 03-Nov-2021 Dmitry Stogov

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
(ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
(packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
- sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
- zend_hash_sort_ex() may require converting packed arrays to hash.

show more ...

# a899dc9d 01-Nov-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Fix self-assign evaluation order for ASSIGN_DIM_OP


# 55aadc64 01-Nov-2021 Nikita Popov

Fix self-assign evaluation order for ASSIGN_DIM_OP

For $ary[idx] op= $ary we should evaluate the RHS operand first,
otherwise we may create a reference-free recursive array. Use the

Fix self-assign evaluation order for ASSIGN_DIM_OP

For $ary[idx] op= $ary we should evaluate the RHS operand first,
otherwise we may create a reference-free recursive array. Use the
same handling we do for the normal $ary[idx] = $ary case.

Fixes oss-fuzz #40287.

show more ...

# 16e9e666 20-Oct-2021 Nikita Popov

Encode string offset error reason in extended_value

For FETCH_DIM_W etc encode the context it is being used in
(dim, obj, ref or incdec) so we can throw an appropriate error
message

Encode string offset error reason in extended_value

For FETCH_DIM_W etc encode the context it is being used in
(dim, obj, ref or incdec) so we can throw an appropriate error
message for invalid string offset use, in a way that does not
require inspecting neighboring opcodes. The implementation is
similar to the flags used for FETCH_OBJ.

This means that we do not have to be careful about preserving
following opcodes during optimization.

Closes GH-7599.

show more ...

# ddaf64b5 14-Oct-2021 Dmitry Stogov

Avoid non-immutable map_ptr indirection

# 780db4ea 12-Oct-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Fix incorrect access of AST_UNPACK


# f555544f 12-Oct-2021 Nikita Popov

Fix incorrect access of AST_UNPACK

list_is_keyed() did not take into account that there may be
AST_UNPACK elements. These would error lateron anyway, but still
produce an invalid acc

Fix incorrect access of AST_UNPACK

list_is_keyed() did not take into account that there may be
AST_UNPACK elements. These would error lateron anyway, but still
produce an invalid access here.

show more ...

# 084c9faf 05-Oct-2021 Dmitry Stogov

Merge branch 'PHP-8.1'

* PHP-8.1:
Fixed assign coalesce. "$a[0] ??= $a" should evaluate the right $a first.


# 80aaeb96 05-Oct-2021 Dmitry Stogov

Fixed assign coalesce. "$a[0] ??= $a" should evaluate the right $a first.

# 69fb20f1 05-Oct-2021 Dmitry Stogov

Fixed assign coalesce. "$a[0] ??= $a" should evaluate the right $a first.

# 10f102d7 02-Oct-2021 Kamil Tekiela

Fix 'can not' in error messages

# 5bda4cd2 04-Sep-2021 codinghuang

Support specifying start position in compile_string

Add additional zend_compile_position argument, which can be either
AT_SHEBANG, AT_OPEN_TAG or AFTER_OPEN_TAG. The previous behavior

Support specifying start position in compile_string

Add additional zend_compile_position argument, which can be either
AT_SHEBANG, AT_OPEN_TAG or AFTER_OPEN_TAG. The previous behavior
corresponds to AFTER_OPEN_TAG.

Closes GH-7462.

show more ...

# c19977d0 27-Sep-2021 Nikita Popov

Fix delayed early binding with optimization

It's possible for delayed early binding opcodes to get optimized
away if they are "unreachable". However, we still need to attempt
early b

Fix delayed early binding with optimization

It's possible for delayed early binding opcodes to get optimized
away if they are "unreachable". However, we still need to attempt
early binding for them. (In some cases we also corrupt the early
binding list outright during optimization, which is how I got here.)

Fix this by storing information about delayed early binding
independently of DECLARE_CLASS_DELAYED opcodes, so early binding is
performed even after the opcode has been dropped.

show more ...

# a7ae4926 29-Sep-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Convert exception during delayed autoload to fatal error
The PHP-8.1 branch is now for 8.1.0RC4


# c8fa4770 29-Sep-2021 Nikita Popov

Convert exception during delayed autoload to fatal error

Same as with other exceptions during inheritance, convert those
thrown during delayed class loading into fatal errors. We can't

Convert exception during delayed autoload to fatal error

Same as with other exceptions during inheritance, convert those
thrown during delayed class loading into fatal errors. We can't
properly deal with such exceptions, as inheritance cannot be
gracefully aborted at this point.

Fixes oss-fuzz #39405.

show more ...

# 1c178569 23-Sep-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Fixed bug #81465


# a942b284 23-Sep-2021 Nikita Popov

Fixed bug #81465

Make the error message for enum cases more technically correct.

# 2157d11d 23-Sep-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Don't treat expression exit as terminator


# c9762be5 23-Sep-2021 Nikita Popov

Don't treat expression exit as terminator

Same as with throw expressions, this may remove later temporary
consuming instructions and thus eliminate live ranges, resulting
in a memory

Don't treat expression exit as terminator

Same as with throw expressions, this may remove later temporary
consuming instructions and thus eliminate live ranges, resulting
in a memory leak. We make use of the same hack and don't consider
exit a terminator if used in an expression context.

show more ...

# 19888a69 15-Sep-2021 Nikita Popov

Initialize UNUSED operands to sentinel value

This makes it more likely that unintentional uses of UNUSED
operands will result in crash rather than some hard to detect
corruption of t

Initialize UNUSED operands to sentinel value

This makes it more likely that unintentional uses of UNUSED
operands will result in crash rather than some hard to detect
corruption of the call frame.

show more ...

# 4c48fd22 03-Sep-2021 Tyson Andre

Fix inconsistency in true/false/null constant resolution when opcache is not used (#7441)

Strangely, uses of eval and 'php -a' (or loading a file without opcache after a namespaced constant

Fix inconsistency in true/false/null constant resolution when opcache is not used (#7441)

Strangely, uses of eval and 'php -a' (or loading a file without opcache after a namespaced constant was declared)
will not treat non-FQ true/false/null as magic keywords, while compiled php required from a file would do that.

This may confuse people learning the language, and result in code loaded with
eval() behaving differently from the same snippet in a file loaded by require.

```
Interactive shell

php > define('foo\true', 'test');
php > namespace foo { var_dump(true); }
string(4) "test"
```

This will make the same session instead properly emit `bool(true);` like it
already would if running those statements in files when opcache was used.

show more ...

Revision tags: php-8.1.0RC1
# fa032764 26-Aug-2021 Nikita Popov

Initialize method_lcname to suppress maybe-uninitialized warning

# 07984435 26-Aug-2021 Nikita Popov

Mark private compiler functions as static

Revision tags: php-7.4.23, php-8.0.10, php-7.3.30, php-8.1.0beta3
# 315f4094 11-Aug-2021 Nikita Popov

Always use CE_CACHE, remove TYPE_HAS_CE (#7336)

Currently, CE_CACHE on strings is only used with opcache interned strings. This
patch extends usage to non-opcache interned strings as wel

Always use CE_CACHE, remove TYPE_HAS_CE (#7336)

Currently, CE_CACHE on strings is only used with opcache interned strings. This
patch extends usage to non-opcache interned strings as well. This means that
most type strings can now make use of CE_CACHE even if opcache is not loaded,
which allows us to remove TYPE_HAS_CE kind, and fix some discrepancies
depending on whether a type stores a resolved or non-resolved name.

There are two cases where CE_CACHE will not be used:

* When opcache is not used and a permanent interned string (that is not an
internal class name) is used as a type name during the request. In this case
we can't allocate a map_ptr index for the permanent string, as it would be
not be in the permanent map_ptr index space.
* When opcache is used but the script is not cached (e.g. eval'd code or
opcache full). If opcache is used, we can't allocate additional map_ptr
indexes at runtime, because they may conflict with indexes allocated by
opcache.

In these two cases we would end up not using CE caching for property types
(argument/return types still have the separate cache slot).

show more ...

12345678910>>...115