History log of /PHP-8.2/Zend/zend_inheritance.c (Results 126 – 150 of 349)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# fff5771c 03-Mar-2020 Nikita Popov

Require non-absolute trait method refs to be unambiguous

Currently, when writing something like

class X {
use T1, T2 {
func as otherFunc;
}
functi

Require non-absolute trait method refs to be unambiguous

Currently, when writing something like

class X {
use T1, T2 {
func as otherFunc;
}
function func() {}
}

where both T1::func() and T2::func() exist, we will simply assume
that func refers to T1::func(). This is surprising, and it doesn't
really make sense that this particular method gets picked.

This commit validates that non-absolute method references are
unambiguous, i.e. refer to exactly one method. If there is
ambiguity, it is required to write T1::func as otherFunc or
similar.

Closes GH-5232.

show more ...


# c05a9c3d 04-Mar-2020 Nikita Popov

Implement interfaces after all methods available

The place where interface implementation handlers is called is
currently ill-defined: If the class implements interfaces itself,
the

Implement interfaces after all methods available

The place where interface implementation handlers is called is
currently ill-defined: If the class implements interfaces itself,
the handlers for both the parent interfaces and the new interfaces
will be called after all methods are registered (post trait use).
If the class does not implement interfaces, then the parent
interface handlers are called early during inheritance (before
methods are inherited).

This commit moves the calls to always occur after all methods are
available. For userland classes this will be post trait import,
at the time where interfaces get implemented (whether the class
itself defines additional interfaces or not). For internal classes
it will be at the end of inheritance, as internal class declarations
do not have proper finalization.

This allows us to simplify the logic for implementing the magic
Iterator / IteratorAggregate interfaces. In particularly we can
now also automatically detect whether an extension of
IteratorAggregate can safely reuse a custom get_iterator handler,
or whether it needs to switch to the userland mechanism. The
Iterator case continues to rely on ZEND_ACC_REUSE_GET_ITERATOR
for this purpose, as a wholesale replacement is not possible there.

show more ...


# 262f52d5 03-Mar-2020 Nikita Popov

Small code cleanup

I found what the modifier code does with XOR pretty confusing.
It's just removing the PPP bits...

Also remove an outdated reference to OVERLOADED_FUNCTION.


# 2c5fcd57 03-Mar-2020 Nikita Popov

Resolve trait alias refers to earlier

Make sure all trait method references are converted to absolute
method references in advance. This regresses one error message
that I don't thin

Resolve trait alias refers to earlier

Make sure all trait method references are converted to absolute
method references in advance. This regresses one error message
that I don't think is particularly valuable.

show more ...


# 53efa1b0 02-Mar-2020 Nikita Popov

Store aliased name of trait method

Currently, trait methods are aliased will continue to use the
original function name. In a few places in the codebase, we will
try to look up the a

Store aliased name of trait method

Currently, trait methods are aliased will continue to use the
original function name. In a few places in the codebase, we will
try to look up the actual method name instead. However, this does
not work if an aliased method is used indirectly
(https://bugs.php.net/bug.php?id=69180).

I think it would be better to instead actually change the method
name to the alias. This is in principle easy: We have to allow
function_name to be changed even if op array is otherwise shared
(similar to static_variables). This means we need to addref/release
the function_name separately, but I don't think there is a
performance concern here (especially as everything is usually
interned).

There is a bit of complication in opcache, where we need to make
sure that the function name is released the correct number of times
(interning may overwrite the name in the original op_array, but we
need to release it as many times as the op_array is shared).

Fixes bug #69180.
Fixes bug #74939.
Closes GH-5226.

show more ...


# 06ac14f7 28-Feb-2020 Nikita Popov

Avoid duplicate calls to interface implementation handler


# b35b0142 13-Feb-2020 Nikita Popov

Require all internal functions to have arginfo


# 43443857 07-Jan-2020 Nikita Popov

Add static return type

RFC: https://wiki.php.net/rfc/static_return_type

The "static" type is represented as MAY_BE_STATIC, rather than
a class type like "self" and "parent", as

Add static return type

RFC: https://wiki.php.net/rfc/static_return_type

The "static" type is represented as MAY_BE_STATIC, rather than
a class type like "self" and "parent", as it has special
resolution semantics, and cannot be cached in the runtime cache.

Closes GH-5062.

show more ...


# 53e527ad 06-Feb-2020 Nikita Popov

Remove ZEND_ACC_IMPLEMENT_INTERFACES flag

This is equivalent to checking ce->num_interfaces. The only subtle
moment is during inheritance, where num_interface may change when
parent

Remove ZEND_ACC_IMPLEMENT_INTERFACES flag

This is equivalent to checking ce->num_interfaces. The only subtle
moment is during inheritance, where num_interface may change when
parent interfaces are inherited. The check in zend_do_link_class
thus uses "interfaces", not "ce->num_interfaces".

show more ...


# f57f0920 06-Feb-2020 Nikita Popov

Remove ZEND_ACC_IMPLEMENTS_TRAITS flag

This is equivalent to checking ce->num_traits.


# 68596ed7 30-Jan-2020 Nikita Popov

Fix copying of functions in variance obligations

Only copy sizeof(zend_internal_function) for internal functions.


# 1146bdb9 28-Jan-2020 Nikita Popov

Fixed bug #78989

Always operate on copies of the functions, so we don't reference
temporary trait methods that have gone out of scope.

This could be more efficient, but doing an

Fixed bug #78989

Always operate on copies of the functions, so we don't reference
temporary trait methods that have gone out of scope.

This could be more efficient, but doing an allocated copy only when
strictly necessary turned out to be somewhat tricky.

show more ...


# e72bf636 06-Jan-2020 Nikita Popov

Allow variadic arguments to replace non-variadic ones

Any number of arguments can be replaced by a variadic one, so
long as the variadic argument is compatible (in the sense of
contr

Allow variadic arguments to replace non-variadic ones

Any number of arguments can be replaced by a variadic one, so
long as the variadic argument is compatible (in the sense of
contravariance) with the subsumed arguments.

In particular this means that function(...$args) becomes a
near-universal signature: It is compatible with any function
signature that does not accept parameters by-reference.

This also fixes bug #70839, which describes a special case.

Closes GH-5059.

show more ...


# a3e29ba3 21-Jan-2020 Nikita Popov

Prefer using declaring class rather than direct parent in error

Point to the class that actually declares the property, which is
not necessarily the same as the direct parent class.


# 99db00b1 19-Jan-2020 Máté Kocsis

Fix #78880 Another round


# bd197728 16-Jan-2020 Nikita Popov

Use zend_type inside type lists

Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about

Use zend_type inside type lists

Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about that, as type unions that contain multiple classes
should be uncommon. On the other hand, this allows us to treat
top-level types and types inside lists mostly the same.

A new ZEND_TYPE_FOREACH macros allows to transparently treat list
and non-list types the same way. I'm not using it everywhere it could be
used for now, just the places that seemed most obvious.

Of course, this will make any future type system changes much simpler,
as it will not be necessary to duplicate all logic two times.

show more ...


# 4a61d842 18-Dec-2019 Nikita Popov

Fixed bug #78776

By using the normal inheritance check if the parent is abstract
as well.


# 5fcc12f5 09-Dec-2019 Nikita Popov

Use unmangled named in property type inheritance error


# a6832caa 04-Dec-2019 Nikita Popov

Fix incorrect assertion in property type variance check

Only one of the status has to be UNRESOLVED, the other could also
be SUCCESS.

Fixes oss-fuzz #19108 and oss-fuzz #19111.


Revision tags: php-7.3.13RC1, php-7.2.26RC1, php-7.4.0, php-7.2.25, php-7.3.12, php-7.4.0RC6, php-7.3.12RC1, php-7.2.25RC1, php-7.4.0RC5, php-7.1.33, php-7.2.24, php-7.3.11, php-7.4.0RC4, php-7.3.11RC1, php-7.2.24RC1, php-7.4.0RC3
# 999e32b6 25-Sep-2019 Nikita Popov

Implement union types

According to RFC: https://wiki.php.net/rfc/union_types_v2

The type representation now makes use of both the pointer payload
and the type mask at the same t

Implement union types

According to RFC: https://wiki.php.net/rfc/union_types_v2

The type representation now makes use of both the pointer payload
and the type mask at the same time. Additionall, zend_type_list is
introduced as a new kind of pointer payload, which is used to store
multiple class types. Each of the class types is a tagged pointer,
which may be either a class name or class entry. The latter is only
used for typed properties, while arguments/returns will instead use
cache slots. A type list can contain a mix of both names and CEs at
the same time, as not all classes may be resolvable.

One thing this is missing is support for union types in arginfo
and stubs, which I want to handle separately.

I've also dropped the special object code from the JIT implementation
for now -- I plan to add this back in a different form at a later time.
For now I did not want to include non-trivial JIT changes together
with large functional changes.

Another possible piece of follow-up work is to implement "iterable"
as an internal alias for "array|Traversable". I believe this will
eliminate quite a few special-cases that had to be implemented.

Closes GH-4838.

show more ...


Revision tags: php-7.2.23, php-7.3.10
# ac4e0f08 20-Sep-2019 Nikita Popov

Make zend_type a 2-field struct

We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

Make zend_type a 2-field struct

We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).

Different types of pointer payloads are distinguished based on bits
in the type_mask.

show more ...


# 6d4965fe 06-Nov-2019 Nikita Popov

Fixed bug #78787

Not the first time inheritance of shadow properties causes an issue,
thankfully this whole concept is gone in PHP 7.4.


# f1848a4b 24-Oct-2019 Nikita Popov

Fix bug #78226: Don't call __set() on uninitialized typed properties

Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are

Fix bug #78226: Don't call __set() on uninitialized typed properties

Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are still triggered if
the property is explicitly unset().

This gives us both the behavior people generally expect, and still
allows ORMs to do lazy initialization by unsetting properties.

For PHP 8, we should fine a way to forbid unsetting of declared
properties entirely, and provide a different way to achieve lazy
initialization.

show more ...


# 184ba0c9 24-Oct-2019 Nikita Popov

Remove recursive check from instanceof_interface

Parent interfaces are copied into the interface list during
inheritance, so there's no need to perform a recursive check.

Only e

Remove recursive check from instanceof_interface

Parent interfaces are copied into the interface list during
inheritance, so there's no need to perform a recursive check.

Only exception are instanceof checks performed during inheritance
itself. However, we already have unlinked_instanceof for this
purpose, it just needs to be taught to handle this case.

Closes GH-4857.

show more ...


# cf85eb24 17-Oct-2019 Nikita Popov

Integrate property types with variance system

Property types are invariant, but may still have to load classes in
order to check for class aliases. This class loading should follow
t

Integrate property types with variance system

Property types are invariant, but may still have to load classes in
order to check for class aliases. This class loading should follow
the same rules as all other variance checks, rather than just
loading unconditionally.

This change integrates property type invariance checks into the
variance system as a new obligation type, and prevent early binding
if the type check cannot be performed.

show more ...


12345678910>>...14