summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Add support for the mixed typeMáté Kocsis2020-05-221-0/+2
| | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/mixed_type_v2 Closes GH-5313 Co-authored-by: Dan Ackroyd <danack@basereality.com>
* | | Improve error messages for invalid property accessMáté Kocsis2020-05-181-1/+2
| | | | | | | | | | | | | | | Closes GH-5446 Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
* | | Assert on unknown type in zend_get_type_by_const()Nikita Popov2020-05-131-2/+1
| | |
* | | Rename zend_zval_get_type() APINikita Popov2020-05-131-1/+3
| | | | | | | | | | | | | | | | | | We have a bunch of APIs for getting type names and it's sometimes hard to keep them apart ... make it clear that this is the one you definitely do not want to use.
* | | Add Fast ZPP string|int type checkGeorge Peter Banyard2020-05-021-0/+17
| | |
* | | Completely remove disabled functions from function tableNikita Popov2020-04-301-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, disabling a function only replaces the internal function handler with one that throws a warning, and a few places in the engine special-case such functions, such as function_exists. This leaves us with a Schrödinger's function, which both does not exist (function_exists returns false) and does exist (you cannot define a function with the same name). In particular, this prevents the implementation of robust polyfills, as reported in https://bugs.php.net/bug.php?id=79382: if (!function_exists('getallheaders')) { function getallheaders(...) { ... } } If getallheaders() is a disabled function, this code will break. This patch changes disable_functions to remove the functions from the function table completely. For all intents and purposes, it will look like the function does not exist. This also renders two bits of PHP functionality obsolete and thus deprecated: * ReflectionFunction::isDisabled(), as it will no longer be possible to construct the ReflectionFunction of a disabled function in the first place. * get_defined_functions() with $exclude_disabled=false, as get_defined_functions() now never returns disabled functions. Fixed bug #79382. Closes GH-5473.
* | | Remove redundant addref+dtorNikita Popov2020-04-291-1/+1
| | |
* | | Pass existing lcname to check_magic_method_implementationNikita Popov2020-04-271-8/+3
| | |
* | | Use zend_string in zend_check_magic_method implementationGabriel Caruso2020-04-271-32/+16
| | |
* | | Check Serialization magic methods structureGabriel Caruso2020-04-261-0/+12
| | | | | | | | | | | | Closes GH-5441
* | | Remove ZEND_ACC_DTOR flagNikita Popov2020-04-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is only used in reflection, where doing a simple string check is acceptable. I'm also dropping the "dtor" printing in the reflection dump. Dtors are just one of many magic methods, I don't think there's a point in explicitly highlighting them, when the name is already unambiguous.
* | | Align magic methods' camelCase with documentationGabriel Caruso2020-04-161-2/+2
| | | | | | | | | | | | Closes GH-5398
* | | Add zend_string_concat2 APINikita Popov2020-04-141-5/+3
| | |
* | | Always use __invoke callable name for objectsNikita Popov2020-04-141-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | The callable name is provided also if it's not callable, in which case it's basically "what it would be if it were callable", which is ClassName::__invoke. The current behavior of casting the object to string makes very little sense as this will just throw an exception for most objects.
* | | Add zend_create_member_string() APINikita Popov2020-04-141-15/+3
| | | | | | | | | | | | This is a recurring pattern.
* | | Export the zend_string_concat3() APINikita Popov2020-04-091-8/+4
| | |
* | | Export API for fetching internal func defaultNikita Popov2020-04-091-0/+99
| | | | | | | | | | | | Make this functionality available outside reflection.
* | | Assert that arginfo parameter name is presentNikita Popov2020-04-071-2/+3
| | |
* | | Display nullability in type error messages for internal functionsMáté Kocsis2020-03-311-21/+40
| | | | | | | | | | | | Closes GH-5327
* | | Make cast_object handler requiredNikita Popov2020-03-311-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | Avoid subtle differences in behavior depending on whether the handler is absent or returns FAILURE. If you previously set cast_object to NULL, create a handler that always returns FAILURE instead.
* | | Improve argument error messages in ext/standardMáté Kocsis2020-03-181-8/+33
| | | | | | | | | | | | Closes GH-5198
* | | Remove NO_ACCESS flag for zend_is_callable()Nikita Popov2020-03-061-3/+1
| | | | | | | | | | | | We may add support for fake_scope if necessary.
* | | Store aliased name of trait methodNikita Popov2020-03-031-49/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Change argument error message formatMáté Kocsis2020-02-261-10/+11
| | | | | | | | | | | | Closes GH-5211
* | | Require all internal functions to have arginfoNikita Popov2020-02-261-1/+5
| | |
* | | Make type error messages more consistentMáté Kocsis2020-02-171-42/+46
| | | | | | | | | | | | Closes GH-5092
* | | Constrain number parameter of numfmt_format to int|floatChristoph M. Becker2020-02-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is inline with similar changes to the math functions. Especially, array to number conversion makes no sense here, and is likely to hide a programming error. To make that feasible, we introduce the `n` specifier for classic ZPP so we can stick with `zend_parse_method_parameters()`. We also remove a test case, which has been degenerated to a ZPP test.
* | | Reset required_num_args for disabled functionsNikita Popov2020-02-121-0/+1
| | | | | | | | | | | | Otherwise we may get arginfo/zpp mismatch errors.
* | | Merge branch 'PHP-7.4'Nikita Popov2020-01-301-6/+1
|\ \ \ | |/ / | | | | | | | | | | | | * PHP-7.4: Reset trampoline on executor startup Fix UAF in is_callable() and allocated trampoline
| * | Fix UAF in is_callable() and allocated trampolineNikita Popov2020-01-301-7/+1
| | | | | | | | | | | | | | | By nulling out the function_handler, so it will not get used below. Reuse the existing helper for this purpose.
* | | Simplify constant updating for propertiesNikita Popov2020-01-211-31/+24
| | | | | | | | | | | | | | | | | | Instead of walking up the parent chain, use the scope stored in the property info. This way we only need to walk one list of property infos.
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-12-171-1/+3
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed memory leak
| * | Fixed memory leakDmitry Stogov2019-12-171-1/+3
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-12-171-1/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed memory leaks
| * | Fixed memory leaksDmitry Stogov2019-12-171-1/+6
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-12-111-2/+5
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Addirional fix for bug #78918
| * | Addirional fix for bug #78918Dmitry Stogov2019-12-111-2/+5
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-091-0/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix build
| * | Fix buildNikita Popov2019-12-091-0/+1
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-12-091-0/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback. Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
| * | Call zend_unregister_ini_entries() when unload extension loaded through dl() ↵Dmitry Stogov2019-12-091-0/+6
| | | | | | | | | | | | | | | | | | without MSHUTDOWN callback. Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-041-5/+7
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed bug #78898
| * | Fixed bug #78898Nikita Popov2019-12-041-5/+7
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-11-251-0/+6
|\ \ \ | |/ / | | | | | | | | | | | | | | | * PHP-7.4: Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) Consolidate NEWS for 7.4.0 release WIP: Merge NEWS
| * | Merge branch 'PHP-7.3' into PHP-7.4Dmitry Stogov2019-11-251-0/+6
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value)
| | * Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value)Dmitry Stogov2019-11-251-0/+6
| | |
* | | Implement union typesNikita Popov2019-11-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-18/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix consistency issues with array accesses warnings/exceptionsMáté Kocsis2019-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change a number of "resource used as offset" notices to warnings, which were previously missed. * Throw the "resource used as offset" warning for isset() as well. * Make array_key_exists() behavior with regard to different key types consistent with isset() and normal array accesses. All key types now use the usual coercions and array/object keys throw TypeError. Closes GH-4887.
* | | zend_parse_parameters_throw() is obsoleteChristoph M. Becker2019-11-011-14/+0
| | | | | | | | | | | | | | | | | | Since `zend_parse_parameters()` throws now, there is no reason to explicitly call `zend_parse_parameters_throw()` anymore, and since both have actually the same implementation, we redefine the latter as macro.