summaryrefslogtreecommitdiff
path: root/Zend/zend_types.h
Commit message (Collapse)AuthorAgeFilesLines
* Add static return typeNikita Popov2020-02-171-0/+1
| | | | | | | | | | 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.
* Reuse SEPARATE_ARRAY() macroDmitry Stogov2020-02-111-6/+1
|
* Use zend_type inside type listsNikita Popov2020-01-171-33/+27
| | | | | | | | | | | | | | | 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.
* Fix #78880: Another bunch of spelling errorsMáté Kocsis2020-01-161-1/+1
|
* Renumber zval types, clarify allowed overlapNikita Popov2020-01-071-8/+10
| | | | | | | | Make it clear that types used for type declarations can overlap with the rest, and can also overlap in MAY_BE space. This makes things more robust against the addition of new primitive types.
* Merge branch 'PHP-7.4'Dmitry Stogov2019-12-111-0/+6
|\ | | | | | | | | * PHP-7.4: Addirional fix for bug #78918
| * Addirional fix for bug #78918Dmitry Stogov2019-12-111-0/+6
| |
* | Support single class unions in gen stubsNikita Popov2019-11-151-0/+6
| |
* | Implement union typesNikita Popov2019-11-081-19/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Make zend_type a 2-field structNikita Popov2019-11-081-46/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'PHP-7.4'Nikita Popov2019-11-011-4/+2
|\ \ | |/ | | | | | | * PHP-7.4: Fixed bug #78768
| * Fixed bug #78768Nikita Popov2019-11-011-4/+2
| | | | | | | | | | Remove the typedef from zend_types.h, use explicit struct prefix instead.
* | Fix miscellaneous typos in docs and error messagesTyson Andre2019-10-281-1/+1
| | | | | | | | Closes GH-4863.
* | Merge branch 'PHP-7.4'Nikita Popov2019-10-251-0/+14
|\ \ | |/ | | | | | | * 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-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Check that type is set in ZEND_TYPE_IS_MASK()Nikita Popov2019-09-231-1/+1
| | | | | | | | | | Allow this macro to be used without an explicit ZEND_TYPE_IS_SET() check.
* | Don't set nullability flag for parameters without typeNikita Popov2019-09-231-2/+5
| | | | | | | | | | | | | | | | | | | | Use value 0 instead. To compensate we check in ReflectionParameter allowsNull() whether the type is set at all: If it isn't, it always allows null. This removes a discrepancy between internal&userland functions: For userland functions allowsNull() on untyped parameters returned true, but for internal functions it returned false.
* | Change representation of zend_type from type code to MAY_BE_* maskNikita Popov2019-09-231-32/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-08-131-0/+1
|\ \ | |/
| * Generalize delref assertionNikita Popov2019-08-131-0/+1
| | | | | | | | The refcount should never become negative, not just during GC.
* | Merge branch 'PHP-7.4'Dmitry Stogov2019-07-101-2/+8
|\ \ | |/ | | | | | | * PHP-7.4: Reduce cost for references to strings and resources
| * Reduce cost for references to strings and resourcesDmitry Stogov2019-07-101-2/+8
| |
| * Backported call frame initialization improvementDmitry Stogov2019-04-121-1/+0
| |
* | Add do...while(0) for RETURN_* and ZVAL_* APIstwosee2019-06-121-4/+4
| | | | | | | | Closes GH-4255.
* | Simplify call frame initializationDmitry Stogov2019-04-111-1/+0
| |
* | Change to php.net mail addressXinchen Hui2019-04-081-1/+1
| |
* | Merge branch 'PHP-7.4'Nikita Popov2019-03-181-0/+1
|\ \ | |/
| * Fixed bug #72685Nikita Popov2019-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have a large performance problem when implementing lexers working on UTF-8 strings in PHP. This kind of code tends to perform a large number of matches at different offsets on a single string. This is generally fast. However, if /u mode is used, the full string will be UTF-8 validated on each match. This results in quadratic runtime. This patch fixes the issue by adding a IS_STR_VALID_UTF8 flag, which is set when we have determined that the string is valid UTF8 and further validation is skipped. A limitation of this approach is that we can't set the flag for interned strings. I think this is not a problem for this use-case which will generally work on dynamic data. If we want to use this flag for other purposes as well (mbstring?) then it might be worthwhile to UTF-8 validate strings during interning. But right now this doesn't seem useful.
* | Merge branch 'PHP-7.4'Joe Watkins2019-03-121-1/+2
|\ \ | |/ | | | | | | * PHP-7.4: zend_weakrefs
| * zend_weakrefsJoe Watkins2019-03-121-1/+2
| |
* | Refactor zend_object_handlers API to pass zend_object* and zend_string* ↵Dmitry Stogov2019-02-041-1/+1
|/ | | | insted of zval(s).
* 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
|
* Implement typed propertiesNikita Popov2019-01-111-8/+44
| | | | | | | | | | 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>
* Merge branch 'PHP-7.3'Nikita Popov2018-11-151-0/+8
|\
| * Fixed bug #77165Nikita Popov2018-11-151-0/+8
| | | | | | | | | | | | Also add some helper macros for PROTECT/UNPROTECT that check for IMMUTABLE. These checks are needed for nearly any use of PROTECT/UNPROTECT.
| * Future-proof email addressesZeev Suraski2018-11-011-3/+3
| |
* | Update email addresses. We're still @Zend, but future proofing it...Zeev Suraski2018-11-011-3/+3
| |
* | Introduce get_properties_for() handlerNikita Popov2018-10-101-3/+0
| | | | | | | | | | This handler allows getting the object properties for a particular purpose, such as array casting, serialization, etc.
* | Clarify that the get_properties handler is requiredNikita Popov2018-10-041-1/+1
|/ | | | | | Some places were checking for non-null get_properties, some weren't. Make it clear that the handler is required and such checks are not necessary.
* Fix #76820: Z_COPYABLE invalid definitionChristoph M. Becker2018-08-301-2/+2
| | | | We remove the extraneous parenthesis.
* Pack zend_constant.flags and zend_constant.module_number into reserved space ↵Dmitry Stogov2018-07-261-0/+4
| | | | inside zend_constant.value.
* Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | The $Id$ keywords were used in Subversion where they can be substituted with filename, last revision number change, last changed date, and last user who changed it. In Git this functionality is different and can be done with Git attribute ident. These need to be defined manually for each file in the .gitattributes file and are afterwards replaced with 40-character hexadecimal blob object name which is based only on the particular file contents. This patch simplifies handling of $Id$ keywords by removing them since they are not used anymore.
* Fix build with ZEND_RC_DEBUGAnatol Belski2018-07-111-3/+3
|
* Fixed bug #76509Nikita Popov2018-06-251-0/+6
| | | | | | | | | | | In PHP static properties are shared between inheriting classes, unless they are explicitly overwritten. However, because this functionality was implemented using reference, it was possible to break the implementation by reassigning the static property reference. This is fixed by switching the implementation from using references to using INDIRECTs, which cannot be affected by userland code.
* Use COPY_DEREF instead of COPY_UNREFNikita Popov2018-06-251-4/+3
| | | | | | | | | This fixes the behavior when the storage location of the fetch is modified before the operand is dereferenced by the using VM opcode. Furthermore it elimiates references as a possible return value from *_R opcodes, which will give us more opportunities for inferences, in particular in regard to typed properties.
* Fix the Z_IMMUTABLE macro - '(' was mismatchedTyson Andre2018-06-101-2/+2
| | | | | | | | | | | The macro properly has two matching `(` and `)` symbols after this change. This typo was causing syntax errors when compiling extensions using the (deprecated) macro. This fixes a bug in the PHP 7.3 branch introduced by 742d5a01ed5bd39a18929c04a5f5c5596a4b005b
* Use SSE2 instruction to reset HashTableDmitry Stogov2018-05-301-1/+24
|
* Changed worst HashTable load factor from 1.0 to 0.5Dmitry Stogov2018-05-041-0/+2
|
* Implemented Request #76178 (Class constants are slow: they should be inlined ↵Dmitry Stogov2018-05-031-0/+4
| | | | | | at runtime) Run-time cache is used to eliminate recalculation of constant expression in RECV_INIT opcode (only non reference countable values are cached).