Commit Graph

1257 Commits

Author SHA1 Message Date
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov
312201dce4 Add get_gc handle for object iterators
Optional handler with the same semantics as the object handler.
2020-07-01 15:17:22 +02:00
Máté Kocsis
30067894fc
Update outdated arginfo hashes 2020-06-30 16:02:11 +02:00
George Peter Banyard
892b32d839 Drop non-well numeric string in Intl test 2020-06-28 19:30:07 +02:00
Nikita Popov
ff19ec2df3 Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.

A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.

Closes GH-5216.
2020-06-24 15:31:41 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Nikita Popov
15846ff115 Add ZVAL_OBJ_COPY macro
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
2020-06-17 16:36:56 +02:00
Nikita Popov
257dbb0450 Add zend_call_known_function() API family
This adds the following APIs:

void zend_call_known_function(
    zend_function *fn, zend_object *object, zend_class_entry *called_scope,
    zval *retval_ptr, int param_count, zval *params);

void zend_call_known_instance_method(
    zend_function *fn, zend_object *object, zval *retval_ptr, int param_count, zval *params);
void zend_call_known_instance_method_with_0_params(
    zend_function *fn, zend_object *object, zval *retval_ptr);
void zend_call_known_instance_method_with_1_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param);
void zend_call_known_instance_method_with_2_params(
    zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2);

These are used to perform a call if you already have the
zend_function you want to call. zend_call_known_function()
is the base API, the rest are just really thin wrappers around
it for the common case of instance method calls.

Closes GH-5692.
2020-06-09 16:21:54 +02:00
Máté Kocsis
596561009c
Fix some UNKNOWN default values
In ext/ffi, ext/intl, ext/mysqli, and ext/pcntl
2020-06-09 09:46:51 +02:00
Máté Kocsis
aa9b0ccda8
Add tests to check mismatching function signatures
Closes GH-5666
2020-06-06 09:23:34 +02:00
George Peter Banyard
4c6ecc820b Refactor IntlBreakIterator::next() handling 2020-06-05 22:16:33 +02:00
George Peter Banyard
7af0466044 Convert code path which should never happen to assertion 2020-06-05 22:11:06 +02:00
George Peter Banyard
97757e759d Fix weird zend_bool usage in Intl Calendar::roll() method
This code really needs to be review as it's convoluted for no good reason.
2020-06-04 22:56:10 +02:00
Christoph M. Becker
864fb0ec23 Implement #47074: phpinfo() reports "On" as 1 for the some extensions
What is modified as boolean, should also be displayed as boolean.
2020-06-04 11:25:45 +02:00
Máté Kocsis
fbe30592d6
Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00
George Peter Banyard
ea8686540a Fix [-Wundef] warning in INTL extension 2020-05-20 18:22:10 +02:00
George Peter Banyard
1f05966a41 Use new Fast ZPP macros for string|int parar types
Closes GH-5512
2020-05-13 12:07:02 +02:00
Nikita Popov
28af364d2a Deprecate old ReflectionParameter type declaration APIs
This deprecates:

    ReflectionParameter::isArray()
    ReflectionParameter::isCallable()
    ReflectionParameter::getClass()

These APIs have been superseded by ReflectionParameter::getType()
since PHP 7.0. Types introduced since that time are not available
through the old APIs, and their behavior is getting increasingly
confusing. This is how they interact with PHP 8 union types:

 * isArray() will return true if the type is array or ?array,
   but not any other union type
 * Same for isCallable().
 * getClass() will return a class for T|int etc, as long as the
   union only contains a single type. T1|T2 will return null.

This behavior is not particularly reasonable or useful, and will
get more confusing as new type system extensions are added.

Closes GH-5209.
2020-05-11 17:01:40 +02:00
Máté Kocsis
4a816584a4
Make float to string casts locale-independent
From now on, float to string casting will always behave locale-independently.
RFC: https://wiki.php.net/rfc/locale_independent_float_to_string
Closes GH-5224

Co-authored-by: George Peter Banyard <girgias@php.net>
2020-05-08 10:52:23 +02:00
Christoph M. Becker
c915c60171 Update intl test suite for ICU 67.1 2020-04-24 11:24:44 +02:00
vibhutisawant
481caf17bc Fix Bug #79431 Various compiler warnings on Big endian architecture with GCC 5.4.0
Fix [-Werror=maybe-uninitialized] compilation warnings on big endian system

Closes GH-5373
2020-04-15 23:30:06 +02:00
George Peter Banyard
04ab4d09be Add Intl resource bundle files for big-endian architecture.
Little and Big endian files have their own designated folder.
Both use the ASCII charset family.
We may want to add a big-endian/EBCDIC charset family resource bundle in the future.

The build script is currently left untouched as it seems to mostly be for Windows.
2020-04-14 15:30:01 +02:00
Máté Kocsis
f00bcfbb7d
Generate method entries for ext/intl
Closes GH-5370
2020-04-14 13:39:00 +02:00
Máté Kocsis
e088836bbc
Fix nullable types in PHPDoc 2020-04-12 00:25:33 +02:00
Máté Kocsis
4aa137c6a6
Fix the default value of the $length parameter of grapheme_substr() 2020-04-10 18:17:18 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Nikita Popov
2bcc4ab8f4 Verify that all stubs have a return type 2020-04-03 17:59:30 +02:00
Máté Kocsis
305b17e85f
Do not include the same stub multiple times
Closes GH-5322
2020-04-03 14:23:54 +02:00
Máté Kocsis
b6229fbca2
Display nullability in type error messages for internal functions
Closes GH-5327
2020-03-31 16:55:36 +02:00
Nikita Popov
8fd7f02ea4 Make cast_object handler required
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.
2020-03-31 14:37:49 +02:00
Nikita Popov
fb5bfcb75b Add a ZEND_UNCOMPARABLE value
To explicitly indicate that objects are uncomparable. For now
this has no functional difference from the usual 1 return value,
but makes intent clearer.
2020-03-31 12:36:48 +02:00
Nikita Popov
33ef3d64da Use separate typedef for bucket comparison function
Avoid performing the same casting dance inside each sort compare
function.
2020-03-04 12:46:06 +01:00
Máté Kocsis
cb933d63c2
Add stubs for IntlChar
Closes GH-5217
2020-02-28 18:10:52 +01:00
Máté Kocsis
d70e6bdcde
Add stubs for UConverter
Closes GH-5218
2020-02-28 14:37:37 +01:00
Nikita Popov
c5e8c25dda Merge branch 'PHP-7.4'
* PHP-7.4:
  Use type-checked ref assignment in UConverter
2020-02-28 10:22:11 +01:00
Nikita Popov
6d19acf54b Use type-checked ref assignment in UConverter 2020-02-28 10:21:50 +01:00
Máté Kocsis
960318ed95
Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00
Máté Kocsis
81fee9f29f
Get rid of method mapping of BreakIterator classes 2020-02-25 23:05:24 +01:00
Máté Kocsis
bcb7847139
Add stubs for Intl BreakIterator
Closes GH-5207
2020-02-25 23:05:03 +01:00
Nikita Popov
16897aacce Remove unnecessary checks in breakpoint iterator
The result of Z_INTL_BREAKITERATOR_P() cannot be NULL. This type
of macro in general can never be NULL.
2020-02-25 10:06:13 +01:00
Máté Kocsis
ac0853eb26
Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Christoph M. Becker
7d0102dfa7 Revert "Replace @param annotations with type declarations"
This reverts commit c31029f335.
2020-02-17 08:55:18 +01:00
Christoph M. Becker
c31029f335 Replace @param annotations with type declarations 2020-02-16 23:43:38 +01:00
Christoph M. Becker
6ee6097688 Constrain number parameter of numfmt_format to int|float
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.
2020-02-16 16:48:35 +01:00
George Peter Banyard
a7e3bbbc55 Fix [-Wmissing-field-initializers] compiler warning in transliterator_methods.c 2020-02-11 00:23:52 +01:00
Máté Kocsis
86780ff79f
Add stubs for NumberFormatter
Closes GH-4827
2020-02-09 22:10:12 +01:00
Máté Kocsis
c42572970a
Add various stubs for Intl
Closes GH-4826
2020-02-04 14:55:21 +01:00
Máté Kocsis
a827db24f1
Add stubs for IntlCalendar
Closes GH-4846
2020-02-04 14:50:02 +01:00
Máté Kocsis
223663807a
Fix ZPP of intl_cal_set() 2020-02-04 14:47:11 +01:00
Máté Kocsis
fe7761b0ad
Add stubs for IntlDateFormatter & MessageFormatter
Closes GH-4812
2020-02-04 13:08:06 +01:00