summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'PHP-7.4'Nikita Popov2019-10-251-3/+3
|\ \ | |/ | | | | | | * PHP-7.4: Fix bug #78226: Don't call __set() on uninitialized typed properties
| * Fix bug #78226: Don't call __set() on uninitialized typed propertiesNikita Popov2019-10-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'PHP-7.4'Nikita Popov2019-10-251-8/+17
|\ \ | |/ | | | | | | * PHP-7.4: Remove recursive check from instanceof_interface
| * Remove recursive check from instanceof_interfaceNikita Popov2019-10-251-8/+17
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'PHP-7.4'Nikita Popov2019-10-171-66/+117
|\ \ | |/ | | | | | | * PHP-7.4: Integrate property types with variance system
| * Integrate property types with variance systemNikita Popov2019-10-171-68/+124
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'PHP-7.4'Nikita Popov2019-10-011-9/+0
|\ \ | |/
| * Remove func copy optimization for private method with static varsNikita Popov2019-10-011-9/+0
| | | | | | | | | | | | | | | | | | | | Not NULLing the static_variables pointer for shadow methods during static var shutdown would be a way to avoid this leak, but unless there's evidence that inherited private methods with static vars are actually a common use-case, I don't think we should keep this kind of fragile edge-case optimization. Fixes OSS-Fuzz #17875.
* | Change representation of zend_type from type code to MAY_BE_* maskNikita Popov2019-09-231-37/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | This switches zend_type from storing a single IS_* type code to storing a MAY_BE_* type mask. Right now most code still assumes that there is only a single type in the mask (or two together with MAY_BE_NULL). But this will make it a lot simpler to introduce union types. An additional advantage (and why I'm doing this separately), is that a number of special cases no longer need to be handled separately: We can do a single mask & (1 << type) check to handle all simple types, booleans (true|false) and null.
* | Merge branch 'PHP-7.4'Nikita Popov2019-09-121-21/+70
|\ \ | |/
| * Allow throwing exception while loading parent classNikita Popov2019-09-121-21/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for symfony/symfony#32995. The behavior is: * Throwing exception when loading parent/interface is allowed (and we will also throw one if the class is simply not found). * If this happens, the bucket key for the class is reset, so it's possibly to try registering the same class again. * However, if the class has already been used due to a variance obligation, the exception is upgraded to a fatal error, as we cannot safely unregister the class stub anymore.
* | Merge branch 'PHP-7.4'Nikita Popov2019-09-111-1/+1
|\ \ | |/
| * Fix typo in unlinked_instanceof assertionNikita Popov2019-09-111-1/+1
| |
* | Merge branch 'PHP-7.4'Nikita Popov2019-09-111-5/+5
|\ \ | |/
| * Only allow "nearly linked" classes for parent/interfaceNikita Popov2019-09-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | The requirements for parent/interface are difference than for the variance checks in type declarations. The latter can work on fully unlinked classes, but the former need inheritance to be essentially finished, only variance checks may still be outstanding. Adding a new flag for this because we have lots of space, but we could also represent these "inheritance states" more compactly in the future.
* | Merge branch 'PHP-7.4'Nikita Popov2019-08-291-2/+10
|\ \ | |/
| * Addref static vars when not copying private methodNikita Popov2019-08-291-2/+10
| | | | | | | | | | | | While we don't need to give this method separate static vars, we do still need to perform an addref, as there will be a corresponding delref in the dtor.
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-271-76/+48
|\ \ | |/ | | | | | | * PHP-7.4: Separate common code abd eliminate useless checks
| * Separate common code abd eliminate useless checksDmitry Stogov2019-06-271-76/+48
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-271-23/+38
|\ \ | |/ | | | | | | * PHP-7.4: Inline hot path
| * Inline hot pathDmitry Stogov2019-06-271-23/+38
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-271-41/+108
|\ \ | |/ | | | | | | * PHP-7.4: Avoid double checks on early binding
| * Avoid double checks on early bindingDmitry Stogov2019-06-271-42/+114
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-261-1/+2
|\ \ | |/ | | | | | | * PHP-7.4: Private methods don't have to be duplicated
| * Private methods don't have to be duplicatedDmitry Stogov2019-06-261-1/+2
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-261-16/+29
|\ \ | |/ | | | | | | * PHP-7.4: Reorder conditions to minimize number of checks on fast path
| * Reorder conditions to minimize number of checks on fast pathDmitry Stogov2019-06-261-16/+30
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-261-46/+41
|\ \ | |/ | | | | | | * PHP-7.4: Remove always true/false conditions, remove dead conde and simplify code.
| * Remove always true/false conditions, remove dead conde and simplify code.Dmitry Stogov2019-06-261-47/+42
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-251-7/+3
|\ \ | |/ | | | | | | * PHP-7.4: Replace previosly checked conditions by ZEND_ASSERT()
| * Replace previosly checked conditions by ZEND_ASSERT()Dmitry Stogov2019-06-251-7/+3
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-251-2/+12
|\ \ | |/ | | | | | | * PHP-7.4: Fixed variance check for abstract constructor during erlay binding
| * Fixed variance check for abstract constructor during erlay bindingDmitry Stogov2019-06-251-2/+12
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-251-38/+23
|\ \ | |/ | | | | | | * PHP-7.4: Cleanup
| * CleanupDmitry Stogov2019-06-251-45/+33
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-251-5/+8
|\ \ | |/ | | | | | | | | | | * PHP-7.4: Prevent useless hash lookups Update NEWS for 7.4.0alpha3 Update NEWS for PHP 7.4.0alpha2
| * Prevent useless hash lookupsDmitry Stogov2019-06-251-5/+8
| |
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-251-2/+2
|\ \ | |/ | | | | | | * PHP-7.4: Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time
| * Keep lowercased parent class name as second argument of DECLARE_CLASS to ↵Dmitry Stogov2019-06-251-2/+2
| | | | | | | | avoid extra work at run-time
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-06-241-1/+1
|\ \ | |/ | | | | | | * PHP-7.4: Fixed bug 78175 (Preloading must store default values of static variables and properties)
| * Fixed bug 78175 (Preloading must store default values of static variables ↵Dmitry Stogov2019-06-241-1/+1
| | | | | | | | and properties)
* | Merge branch 'PHP-7.4'Nikita Popov2019-06-111-35/+265
|\ \ | |/
| * Support full variance if autoloading is usedNikita Popov2019-06-111-52/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep track of delayed variance obligations and check them after linking a class is otherwise finished. Obligations may either be unresolved method compatibility (because the necessecary classes aren't available yet) or open parent/interface dependencies. The latter occur because we allow the use of not fully linked classes as parents/interfaces now. An important aspect of the implementation is we do not require classes involved in variance checks to be fully linked in order for the class to be fully linked. Because the involved types do have to exist in the class table (as partially linked classes) and we do check these for correct variance, we have the guarantee that either those classes will successfully link lateron or generate an error, but there is no way to actually use them until that point and as such no possibility of violating the variance contract. This is important because it ensures that a class declaration always either errors or will produce an immediately usable class afterwards -- there are no cases where the finalization of the class declaration has to be delayed until a later time, as earlier variants of this patch did. Because variance checks deal with classes in various stages of linking, we need to use a special instanceof implementation that supports this, and also introduce finer-grained flags that tell us which parts have been linked already and which haven't. Class autoloading for variance checks is delayed into a separate stage after the class is otherwise linked and before delayed variance obligations are processed. This separation is needed to handle cases like A extends B extends C, where B is the autoload root, but C is required to check variance. This could end up loading C while the class structure of B is in an inconsistent state.
| * Register class before fetching parentNikita Popov2019-06-111-2/+3
| | | | | | | | | | We want the class declaration to be available while compiling the parent class.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-271-1/+1
|\ \ | |/
| * Accept flags argument in zend_lookup_class_ex()Nikita Popov2019-05-271-1/+1
| | | | | | | | Instead of a single boolean, so we have space for extension here.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-241-78/+210
|\ \ | |/
| * Implement basic variance supportNikita Popov2019-05-241-74/+131
| | | | | | | | | | | | | | This is a minimal variance implementation: It does not support any cyclic type dependencies. Additionally the preloading requirements are much more restrictive than necessary. Hopefully we can relax these in the future.
| * Avoid early-binding on unresolved typesNikita Popov2019-05-241-42/+119
| | | | | | | | | | | | Fixes bug #76451, and more importantly lays necessary groundwork for covariant/contravariant types. Bug #76451 is just an edge case, but once covariance is introduced this will become a common problem instead.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-231-1/+3
|\ \ | |/