summaryrefslogtreecommitdiff
path: root/Zend/zend_closures.c
Commit message (Collapse)AuthorAgeFilesLines
* Add ZVAL_OBJ_COPY macroNikita Popov2020-06-171-4/+2
| | | | | For the common ZVAL_OBJ + GC_ADDREF pattern. This mirrors the existing ZVAL_STR_COPY API.
* Fix expression warnings and break warningstwosee2020-06-071-1/+1
| | | | Close GH-5675.
* Generate method entries for ClosureMáté Kocsis2020-05-191-10/+1
|
* Store aliased name of trait methodNikita Popov2020-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Eliminate uses of ZVAL_ZVAL and friendsNikita Popov2020-01-201-1/+1
| | | | | | | | Instead add RETURN_COPY(_VALUE) macros will the expected behavior. RETURN_ZVAL doesn't make any sense since PHP 7, but has stuck around, probably because the alternative was to write directly to the return_value variable.
* Use RETURN_THROWS() after zend_parse_method_parameters()Máté Kocsis2020-01-021-1/+1
|
* Use RETURN_THROWS() during ZPP in main, sapi, win32, and ZendMáté Kocsis2019-12-301-2/+2
|
* Merge branch 'PHP-7.4'Nikita Popov2019-12-181-1/+1
|\ | | | | | | | | * PHP-7.4: Fix use-after-free when trying to write to closure property
| * Fix use-after-free when trying to write to closure propertyNikita Popov2019-12-181-1/+1
| |
* | Make zend_type a 2-field structNikita Popov2019-11-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-10-301-0/+1
|\ \ | |/ | | | | | | * PHP-7.4: Add missing refcount increment
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-301-0/+1
| |\ | | | | | | | | | | | | * PHP-7.3: Add missing refcount increment
| | * Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-10-301-0/+1
| | |\ | | | | | | | | | | | | | | | | * PHP-7.2: Add missing refcount increment
| | | * Add missing refcount incrementNikita Popov2019-10-301-0/+1
| | | |
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-10-291-1/+8
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Fixed bug #78689
| * | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-291-1/+8
| |\ \ \ | | |/ / | | | | | | | | | | | | * PHP-7.3: Fixed bug #78689
| | * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-10-291-1/+8
| | |\ \ | | | |/ | | | | | | | | | | | | * PHP-7.2: Fixed bug #78689
| | | * Fixed bug #78689Nikita Popov2019-10-291-1/+8
| | | |
* | | | Remove ability to unbind $this of closures if usedNikita Popov2019-10-281-2/+2
| | | | | | | | | | | | | | | | This was deprecated in PHP 7.4, removing it for PHP 8.0.
* | | | Add Zend class/interface arginfo stubsChristoph M. Becker2019-10-151-25/+6
| | | | | | | | | | | | | | | | | | | | | | | | We also change `Generator::throw()` to expect a `Throwable` in the first place, and we now throw a TypeError instead of returning `false` from `Exception::getTraceAsString()`.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-10-091-1/+1
|\ \ \ \ | |/ / /
| * | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-091-1/+1
| |\ \ \ | | |/ /
| | * | Fixed bug #78658Nikita Popov2019-10-091-1/+1
| | | |
| | * | Future-proof email addressesZeev Suraski2018-11-011-1/+1
| | | |
* | | | Comparison cleanup:Dmitry Stogov2019-10-071-3/+4
| | | | | | | | | | | | | | | | | | | | - introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval) - remove compare_objects() object handler, and keep only compare() handler
* | | | Add check_only parameter to get_closure handlerChristoph M. Becker2019-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `get_closure` handlers are called to check whether an object is callable, and to actually get the closure, respectively. The behavior of the handler might differ for these two cases, particularly the handler may throw in the latter case, but should not in the former. Therefore we add a `check_only` parameter, to be able to distinguish the desired purpose.
* | | | Merge branch 'PHP-7.4'Dmitry Stogov2019-09-021-1/+2
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Free two bits in fn_flags by merging ZEND_ACC_HEAP_RT_CACHE/ZEND_ACC_USER_ARG_INFO and ZEND_ACC_DONE_PASS_TWO/ZEND_ACC_ARENA_ALLOCATED that may be used only for user/internal functions
| * | | Free two bits in fn_flags by merging ↵Dmitry Stogov2019-09-021-1/+2
| | | | | | | | | | | | | | | | ZEND_ACC_HEAP_RT_CACHE/ZEND_ACC_USER_ARG_INFO and ZEND_ACC_DONE_PASS_TWO/ZEND_ACC_ARENA_ALLOCATED that may be used only for user/internal functions
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-08-231-1/+2
|\ \ \ \ | |/ / /
| * | | Relax closure $this unbinding deprecationNikita Popov2019-08-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only deprecate unbinding of $this from a closure if $this is syntactically used within the closure. This is desired to support Laravel's macro system, see laravel/framework#29482. This should still allow us to implement the performance improvements we're interested in for PHP 8, without breaking existing use-cases.
* | | | Merge branch 'PHP-7.4'Nikita Popov2019-07-221-0/+3
|\ \ \ \ | |/ / /
| * | | Deprecate unbinding $this from non-static closureNikita Popov2019-07-221-0/+3
| | | |
* | | | Merge branch 'PHP-7.4'Dmitry Stogov2019-05-291-5/+5
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Mark "cold" functions
| * | | Mark "cold" functionsDmitry Stogov2019-05-291-5/+5
| | | |
* | | | Merge branch 'PHP-7.4'Dmitry Stogov2019-05-281-1/+2
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros
| * | | Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macrosDmitry Stogov2019-05-281-1/+2
| | | |
* | | | 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'Dmitry Stogov2019-03-111-0/+13
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.4: Closure::fromCallable() supports only regular methods and magic method invoked through __call()/__callStatic(). It doesn't support method of internal classes invoked through C object or class handlers. This commit prevents crash described at bug #77708, but doesn't implement the desired behavior.
| * | | Closure::fromCallable() supports only regular methods and magic method ↵Dmitry Stogov2019-03-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | invoked through __call()/__callStatic(). It doesn't support method of internal classes invoked through C object or class handlers. This commit prevents crash described at bug #77708, but doesn't implement the desired behavior.
* | | | Refactor zend_object_handlers API to pass zend_object* and zend_string* ↵Dmitry Stogov2019-02-041-13/+13
| | | | | | | | | | | | | | | | insted of zval(s).
* | | | 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 static calls to non-static methodsNikita Popov2019-01-301-1/+1
| | | |
* | | | Forbid unbinding $this from methodsNikita Popov2019-01-301-6/+2
|/ / /
* | | Implement typed propertiesNikita Popov2019-01-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Use ZEND_THIS macro to hide implementation details in extensions code.Dmitry Stogov2018-11-151-4/+3
| | |
* | | Replace getThis() by EX(This), when additional check is not necessary.Dmitry Stogov2018-11-141-5/+4
| | |