Commit graph

56 commits

Author SHA1 Message Date
Máté Kocsis
d59bc80782
Fix smaller issues with stubs
GH-5025
2019-12-20 14:31:07 +01:00
Máté Kocsis
297b1f8335
Fix return type of strval()
GH-5024
2019-12-20 12:02:35 +01:00
Máté Kocsis
d7b2082352
Add stubs for standard library
Closes GH-5017
2019-12-20 12:01:35 +01:00
Máté Kocsis
2ab123b84e
Convert string|array union parameter types
Closes GH-4995
2019-12-20 10:15:52 +01:00
Máté Kocsis
beee92a887
Remove support for mixing parameter order in implode() 2019-12-12 13:49:05 +01:00
Máté Kocsis
37c1171451
Promote warnings to exceptions in password_*() functions 2019-12-12 12:14:53 +01:00
George Peter Banyard
4782e8e28a Return empty string instead of NULL in serialize().
Modifiy its return type accordingly and arginfo.
2019-12-12 00:01:28 +01:00
Máté Kocsis
51eefd8079
Add stubs for standard library 2019-12-11 18:50:36 +01:00
Máté Kocsis
9563449d8b
Add stubs for another batch of standard functions 2019-12-09 19:47:08 +01:00
Máté Kocsis
29ef07728e
Remove magic quotes legacy 2019-12-05 13:15:54 +01:00
Máté Kocsis
633926021b
Remove ezmlm_hash() function 2019-12-05 13:15:54 +01:00
Máté Kocsis
144b41ce88
Remove money_format() function 2019-12-05 13:15:54 +01:00
Máté Kocsis
64468d1e3b
Remove convert_cyr_string() function 2019-12-05 13:15:54 +01:00
Máté Kocsis
b63c625260
Remove hebrevc() function 2019-12-05 13:15:54 +01:00
Nikita Popov
a603c06e2e Support "string or array" in zpp
This is one of our more common argument unions. Usage is just
prototyped in a few places, certainly not a full conversion.

I'm removing the str_replace.phpt test, because aparently it was
split up into smaller tests at some point, but the original has
not been removed.

Closes GH-4970.
2019-12-05 12:25:57 +01:00
Máté Kocsis
04deb532f0
Promote warning to exception in log() function 2019-12-05 08:30:47 +01:00
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
0c2d4d698c Make sure that params with null default are marked nullable 2019-08-26 14:34:28 +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
George Peter Banyard
c1c8538f95 Promote warnings to errors in array_rand() 2019-08-26 13:31:02 +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