Commit Graph

30 Commits

Author SHA1 Message Date
Tim Düsterhus
ff472ce6fc
Support the #[\AllowDynamicProperties] attribute in stubs (#8776)
* Support the `#[\AllowDynamicProperties]` attribute in stubs

* Use `#[\AllowDynamicProperties]` attribute in stubs

* Disallow applying both `@strict-properties` and `#[\AllowDynamicProperties]`
2022-06-21 09:28:57 +02:00
Máté Kocsis
49d3dde211
Declare true return types (#8759) 2022-06-18 22:06:50 +02:00
Tyson Andre
32e2d97a26
Allow internal functions to declare if they support compile-time evaluation, add functions. (#7780)
https://wiki.php.net/rfc/strtolower-ascii means that these functions no longer
depend on the current locale in php 8.2. Before that, this was unsafe to
evaluate at compile time.

Followup to GH-7506

Add strcmp/strcasecmp/strtolower/strtoupper functions

Add bin2hex/hex2bin and related functions

Update test of garbage collection using strtolower to use something else to create a refcounted string
2021-12-20 09:27:06 -05:00
Máté Kocsis
8e6e9838b0
Add support for generating MAY_BE_ARRAY_OF_REF func info flag (#7416) 2021-08-30 13:50:34 +02:00
Máté Kocsis
4a7a414735
Fix callable and iterable handling 2021-08-25 10:37:43 +02:00
Máté Kocsis
bdfe0ab505
Generate Zend, ext/spl and ext/json optimizer func info from stubs
Closes GH-7397
2021-08-25 10:37:27 +02:00
Máté Kocsis
b1822899fc
Add support for generating optimizer function info from stubs (#7367) 2021-08-24 16:35:33 +02:00
Máté Kocsis
339ce9430e
Declare the $value param of define() as mixed 2021-07-14 22:02:59 +02:00
Joe Watkins
27ce269c1b
Revert "Fix bug #24214 implement access to skip_last in user API for backtrace"
This reverts commit a5cef84de8.
2021-06-08 11:30:37 +02:00
Joe Watkins
a5cef84de8
Fix bug #24214 implement access to skip_last in user API for backtrace 2021-06-06 08:37:32 +02:00
Ilija Tovilo
269c8dac1d
Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00
Máté Kocsis
4c6533c257
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
2021-02-22 15:24:03 +01:00
Máté Kocsis
6ce70447ac
Generate zend class entries based on stubs
Closes GH-6685
2021-02-14 23:18:28 +01:00
Máté Kocsis
40ebfd6730
Remove some incorrect mixed parameter types 2020-11-21 23:17:35 +01:00
Máté Kocsis
7aa2d3519b
Zend parameter renames amendment
Closes GH-6228
2020-09-29 11:04:09 +02:00
Nikita Popov
12d087c346 Use C zpp for get_class_vars() 2020-09-22 13:05:05 +02:00
Máté Kocsis
0d330e1a02
Add a few missing parameter types in stubs
Related to GH-5627
2020-07-30 14:26:45 +02:00
Máté Kocsis
5770b66722
Cleanup argument handling of Zend functions and methods
Closes GH-5847
2020-07-21 14:47:03 +02:00
George Peter Banyard
7ac9e9bf64 Use ZPP callable check in zend built in functions 2020-07-08 19:38:46 +02:00
codinghuang
5ea28fe6c4
Use correct ZPP mechanism in get_class_methods()
From now on, instead of returning null, an exception is thrown when
not a string or an object is passed to the function.

Closes GH-5792
2020-07-02 11:40:05 +02:00
Máté Kocsis
e93d20ad7e
Add ZPP macros for class name or object parameters
Closes GH-5647
2020-06-30 11:19:30 +02:00
Máté Kocsis
b3718430de
Annotate internal functions with the mixed type
Closes GH-5618
2020-05-25 17:30:57 +02:00
Nikita Popov
a0abc26ef7 Add get_resource_id() function
Behavior is same as for (int) $resource, just under a clearer
name. Also type-safe, in that the parameter actually needs to
be a resource.

Closes GH-5427.
2020-05-11 12:04:16 +02:00
Nikita Popov
53eee290b6 Completely remove disabled functions from function table
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.
2020-04-30 09:53:57 +02:00
Nikita Popov
292085f336 Generate zend_builtin_functions FEs from stubs 2020-04-21 12:23:56 +02:00
George Peter Banyard
55a3e5b99e Promote some warnings to Errors in Zend basic functions
Closes GH-5325
2020-03-31 16:32:58 +02:00
Máté Kocsis
0e8070778e
Make get_defined_vars() always return an array
GH-5025
2019-12-20 14:31:57 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Nikita Popov
5f80eb7842 Fix required number of arguments in stubs
* get_parent_class() argument is optional
* Mark array_filter() $callback as optional
* The $base of gmp_strval() is optional
* DateTime constructor also accepts zero arguments
* hash_update_file() stream context is optional
* xmlwriter_write_dtd_entity() $isparam argument is optional
2019-10-07 16:33:41 +02:00
Nikita Popov
33886f710c Generate arginfo from PHP stub files
Signature stubs for internal functions are specified in xyz.stub.php,
from which we generate actual arginfo structures in xyz_arginfo.h.
This file then needs to be included in the implementation appropriately.

Arginfo from stubs can be regenerated using scripts/dev/gen_stub.php.
However, this should also automatically happen when the stub file is
modified.
2019-08-09 14:51:25 +02:00