Commit graph

139 commits

Author SHA1 Message Date
Tyson Andre
5624d2eb00 Make some opcache types consistent with reflection information
Remove functions such as filter_id() where reference counts and types are
identical to what's in opcache.

Remove null types from zend_func_info.c that aren't in Reflection
(php would throw now)

Fix the Reflection type information for assert_options()

    php > assert_options(ASSERT_CALLBACK, static function() {});
    php > var_export(assert_options(ASSERT_CALLBACK));
    Closure::__set_state(array(
    ))

Closes GH-4958.
2019-12-04 07:31:06 +01:00
Máté Kocsis
c58b12334d Add union return types with one class 2019-11-18 12:44:38 +01:00
Nikita Popov
292a1aeb59 Support union types for args in gen stubs
Using this requires care! The zpp implementation for this union
must be consistent with the arginfo implementation!

Apart from array|object, this is probably only the case for
int|float right now.
2019-11-15 17:33:37 +01:00
Nikita Popov
40dcf2bd3d password_hash() can't return false 2019-11-15 12:43:57 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Nikita Popov
9bbbc9e7e9 Add support for union types in stubs
This is the MVP for supporting union types in PHP stubs. Return
types with only builtin types work, which is the part we mainly
need.

Closes GH-4895.
2019-11-08 17:32:18 +01:00
Máté Kocsis
ab6b412a0b
Add stubs for standard lib functions 2019-11-07 17:59:03 +01:00
Máté Kocsis
14bdb0cfc7 Fix consistency issues with array accesses warnings/exceptions
* 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.
2019-11-06 12:56:47 +01:00
Nikita Popov
93ba3abe63 Warn on strtr(["" => "x"])
Previously:
 * If only ["" => "x"] was present, the original string was returned
   without warning.
 * If both ["" => "x"] and at least one more element was present,
   false was returned without warning.

New behavior:
 * Ignore "" keys in the replacement array (and perform any remaining
   replacement).
 * Throw a warning indicating that an empty string replacement has
   been ignored.

Closes GH-4792.
2019-10-30 10:53:45 +01:00
Nikita Popov
becda2e041 Promote mt_rand() min/max warning to ValueError 2019-10-30 10:36:42 +01:00
Máté Kocsis
ad9ea5abde Add stubs for various standard functions
Closes GH-4851.
2019-10-30 10:34:06 +01:00
Máté Kocsis
fee94da127 Add stubs for directory and file functions 2019-10-30 10:10:40 +01:00
Colin O'Dell
e7335eb420 Allow array_splice() length to be null 2019-10-23 11:22:12 +02:00
Colin O'Dell
e6d3146bdc Accept null lengths for substr functions()
If a null $length is passed to any of these functions, behave as if no
parameter was passed:

 - substr()
 - substr_count()
 - substr_compare()
 - iconv_substr()
2019-10-22 12:09:04 +02: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
theodorejb
ef9736e062 Convert string function arginfo to PHP stubs 2019-10-07 11:13:16 +02:00
theodorejb
e60d9da167 Fix array_fill stub return type
This was missed in commit d5e9ef8f0f.
2019-10-02 18:01:27 +02:00
George Peter Banyard
1ca4ab09a5 Promote warnings to errors in array_push()
This is in line with the engine change from
https://wiki.php.net/rfc/engine_warnings.
2019-10-02 10:38:23 +02:00
George Peter Banyard
70e604ee46 Promote warnings to errors in extract() 2019-08-28 23:15:01 +02:00
Burak Çakırel
d2210dc2ea Add assert arginfo stubs
Closes GH-4619.
2019-08-26 15:41:31 +02:00
Nikita Popov
a98307df87 Make arginfo printing of prefer-ref arguments nicer 2019-08-26 15:39:39 +02:00
Nikita Popov
a47f170a75 Assert that symbol table is available in compact()
I believe NULL here is no longer possible due to the dynamic call
check. A similar assumption already exists in the extract()
implementation.
2019-08-26 14:25:48 +02:00
Theodore Brown
d5f42d68c8 Convert remaining array function arginfo to PHP stubs 2019-08-26 12:53:00 +02:00
Olumide Samson
b9c961e160 Add some header and html function stub 2019-08-25 15:27:58 +02:00
inem0o
baeb10d736 Add sha1 arginfo stubs 2019-08-19 12:35:53 +02:00
inem0o
8150c65ae4 Add pageinfo arginfo stubs 2019-08-19 11:29:22 +02:00
inem0o
b7c4d8e846 Add metaphone arginfo stubs 2019-08-19 11:18:44 +02:00
inem0o
ff7900f551 Add md5 arginfo stubs 2019-08-19 09:41:46 +02:00
inem0o
f795bdfd30 Add lcg arginfo stubs 2019-08-16 12:56:07 +02:00
inem0o
f1eca42825 Add ftok arginfo stubs 2019-08-16 12:53:11 +02:00
Theodore Brown
e2b0fb946b Add hrtime arginfo stubs 2019-08-14 16:46:10 +02:00
jason-liew
ffffaf12cf add some stubs for array func in basic_functions 2019-08-14 15:27:58 +02:00
Islam Israfilov
1dc88ff67e Add inet_ntop and inet_pton stubs 2019-08-13 14:52:14 +02:00
inem0o
ccf79547af Add crypt() function's stub
Closes GH-4515.
2019-08-13 11:28:32 +02:00
inem0o
fb363f7f00 add syslog arginfo stubs 2019-08-13 09:58:26 +02:00
inem0o
1376f61aed Add crc32 stub 2019-08-11 18:33:58 +02:00
inem0o
b98bc5bd92 Add base64_encode / base64_decode stubs
Closes GH-4504.
2019-08-10 17:40:10 +02:00
Nikita Popov
d9e2d18505 Add some basic_functions stubs 2019-08-10 12:34:29 +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