summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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
|\ \ | |/
| * Forbid use of not fully linked classesNikita Popov2019-05-231-1/+3
| |
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-081-48/+24
|\ \ | |/
| * Refactor inheritance type check implementationNikita Popov2019-05-081-48/+24
| | | | | | | | | | Extract the self/parent name resolution code and drop unnecessary string copies/releases. Store the fe/proto types in local variables.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-081-31/+15
|\ \ | |/
| * Deduplicate inheritance type check implementationNikita Popov2019-05-081-33/+16
| | | | | | | | | | | | | | | | Make the check covariant (insofar as it is allowed now, i.e. nullability and iterable) and call it with appropriate argument order for both parameter and return types. This makes it simpler to extend to full variance support.
* | Merge branch 'PHP-7.4'Nikita Popov2019-05-081-2/+2
|\ \ | |/
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-05-081-2/+2
| |\
| | * Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-05-081-2/+2
| | |\
| | | * Fix resolution of "parent" during inheritance checkNikita Popov2019-05-081-2/+2
| | | | | | | | | | | | | | | | | | | | We can't assume that the method we're checking against is part of the parent class...
| | * | Fixed bug #77498Nikita Popov2019-01-251-0/+3
| | | | | | | | | | | | | | | | | | | | I've renamed the function to the same name as the exported symbol in master.
* | | | Always generate fatal error for LSP failuresNikita Popov2019-05-071-21/+3
| | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/lsp_errors
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-03-271-4/+4
|\ \ \ \ | |/ / /
| * | | Treat abstract ctors the same, regardless of originNikita Popov2019-03-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Abstract ctor signatures should always be respected by all children, independently of whether it comes from an interface or an abstract class. Previously abstract ctor signatures (if they didn't come from an interface) were only checked to one level of inheritance.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-03-271-7/+20
|\ \ \ \ | |/ / /
| * | | Fix lineno for more inheritance errorsNikita Popov2019-03-271-7/+20
| | | | | | | | | | | | | | | | And also include explicit linenos in tests.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-03-271-1/+4
|\ \ \ \ | |/ / /
| * | | Make line numbers for inheritance errors more preciseNikita Popov2019-03-271-1/+4
| | | | | | | | | | | | | | | | | | | | Use the line of the conflicting child method, rather than either the first or last line of the class.
* | | | Merge branch 'PHP-7.4'Peter Kokot2019-02-181-1/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Fix typos in code comments in Zend/ [skip ci]
| * | | Fix typos in code comments in Zend/ [skip ci]Tyson Andre2019-02-181-1/+1
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-02-151-4/+7
|\ \ \ \ | |/ / /
| * | | Avoid uninitialized entries in properties_info_tableNikita Popov2019-02-151-4/+7
| | | | | | | | | | | | | | | | Also don't place it into xlat, there's only ever one user.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-02-151-1/+11
|\ \ \ \ | |/ / /
| * | | Assign (un)serialize_func during compilationNikita Popov2019-02-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids writing this cache at runtime, which is illegal if preloading is used. Not every serialize/unserialize function actually belongs to the Serializable interface, but I think it's not a problem to assign these anyway -- whether they are used ultimately depends on whether Serializable is implemented. Alternatively it might make sense to just drop these entirely. I don't think this is performance critical functionality.
* | | | Merge branch 'PHP-7.4'Dmitry Stogov2019-02-141-3/+3
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Fixed bug #77613 (method visibility change) (reverted ZEND_ACC_CTOR and ZEND_ACC_DTOR flags removal)
| * | | Fixed bug #77613 (method visibility change) (reverted ZEND_ACC_CTOR and ↵Dmitry Stogov2019-02-141-4/+5
| | | | | | | | | | | | | | | | ZEND_ACC_DTOR flags removal)
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-02-081-0/+3
|\ \ \ \ | |/ / /
| * | | Fix refcounting of prop types coming from traitsNikita Popov2019-02-081-0/+3
| | | |
* | | | Merge branch 'PHP-7.4'Peter Kokot2019-02-031-10/+0
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Remove local variables
| * | | Remove local variablesPeter Kokot2019-02-031-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
| * | | Adios, yearly copyright rangesZeev Suraski2019-01-301-1/+1
| | | |
* | | | Adios, yearly copyright rangesZeev Suraski2019-01-301-1/+1
| | | |
* | | | Remove support for legacy constructorsNikita Popov2019-01-291-40/+1
|/ / / | | | | | | | | | | | | This has been deprecated in PHP 7.0 by https://wiki.php.net/rfc/remove_php4_constructors.
* | | Implement typed propertiesNikita Popov2019-01-111-5/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/typed_properties_v2 This is a squash of PR #3734, which is a squash of PR #3313. Co-authored-by: Bob Weinand <bobwei9@hotmail.com> Co-authored-by: Joe Watkins <krakjoe@php.net> Co-authored-by: Dmitry Stogov <dmitry@zend.com>
* | | Replace zend_hash_apply... with ZEND_HASH_FOREACH...Dmitry Stogov2018-12-191-3/+1
| | |
* | | Merge branch 'PHP-7.3'Christoph M. Becker2018-12-161-11/+11
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fix #77291: magic methods inherited from a trait may be ignored
| * | Fix #77291: magic methods inherited from a trait may be ignoredChristoph M. Becker2018-12-161-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding methods from a trait, we must not assume that a method name with the same length as the name of the using class is either a PHP 4 style constructor, or not a magic method at all – it may well be another magic method. We mostly preserve the spirit of the optimization which caused this regression, and avoid string comparisons for all method names which can never be magic methods.
| * | Future-proof email addressesZeev Suraski2018-11-011-2/+2
| | |
* | | Fixed issues related to optimization and persitence of classes linked with ↵Dmitry Stogov2018-11-141-0/+1
| | | | | | | | | | | | interfaces, traits or internal classes.