Commit Graph

131 Commits

Author SHA1 Message Date
Ilija Tovilo
925a30979c
Allowing catching arg type deprecations in intl classes
Closes GH-8115
Closes GH-8117
2022-03-03 11:26:35 +01:00
Máté Kocsis
2378f35787
Use single line phpdoc in stubs where possible 2021-07-20 13:16:56 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Máté Kocsis
65b96397b3
Declare tentative return types for ext/intl (#6986) 2021-07-06 10:55:43 +02:00
Nikita Popov
680d198d50 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81019
2021-05-17 16:33:44 +02:00
Nikita Popov
0bff67c0ab Fixed bug #81019
Before the zval -> zend_object migration, this code used macros
like FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK, which internally
clear the error. Now that they are no longer used, we need to
manually clear the error.
2021-05-17 16:33:35 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Nikita Popov
9d54609a19 Merge branch 'PHP-8.0'
* PHP-8.0:
  Use E_ERROR to report arginfo/zpp mismatch
  Make NumberFormatter ctor $pattern nullable
  Make IntlDateFormatter ctor $pattern nullable
2021-02-09 14:37:41 +01:00
Nikita Popov
f5768eaa2e Make NumberFormatter ctor $pattern nullable
Whether the pattern is needed depends on the used style. If no
pattern is needed, null is a more sensible value than an empty
string.

fixup
2021-02-09 14:36:41 +01:00
Máté Kocsis
c6723728df
Generate ext/intl class entries from stubs
Closes GH-6670
2021-02-09 13:37:24 +01:00
Nikita Popov
422d1665a2 Make convert_to_*_ex simple aliases of convert_to_*
Historically, the _ex variants separated the zval first, if a
conversion was necessary. This distinction no longer makes sense
since PHP 7.

The only difference that was still left is that _ex checked whether
the type is the same first, but the usage of these macros did not
actually distinguish on whether such an inlined check is valuable
or not in a given context.

Also drop the unused convert_to_explicit_type macros.
2021-01-14 12:11:11 +01:00
Máté Kocsis
186612e4d7
Improve parameter names in ext/intl
Closes GH-6309
2020-10-12 18:06:45 +02:00
Máté Kocsis
fd0b39905c
Promote warnings to exceptions in ext/intl
Closes GH-5972
2020-09-07 19:46:55 +02:00
Máté Kocsis
8107a1da5a
Use ZPP instead of custom type checks
We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
2020-09-04 14:32:34 +02:00
Nikita Popov
6b554251f7 Prevent double-construction of NumberFormatter 2020-08-26 10:25:09 +02:00
Máté Kocsis
046cc5e4c2
Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +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
Máté Kocsis
f00bcfbb7d
Generate method entries for ext/intl
Closes GH-5370
2020-04-14 13:39:00 +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
Máté Kocsis
305b17e85f
Do not include the same stub multiple times
Closes GH-5322
2020-04-03 14:23:54 +02: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
Máté Kocsis
86780ff79f
Add stubs for NumberFormatter
Closes GH-4827
2020-02-09 22:10:12 +01:00
Christoph M. Becker
aba6937c0a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79212: NumberFormatter::format() may detect wrong type
2020-02-03 12:30:42 +01:00
Christoph M. Becker
57b9eca83d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79212: NumberFormatter::format() may detect wrong type
2020-02-03 12:29:43 +01:00
Christoph M. Becker
c2935499b1 Fix #79212: NumberFormatter::format() may detect wrong type
We have to convert to number *before* detecting the type, to cater to
internal objects implementing `cast_object`.

We also get rid of the fallback behavior of using `FORMAT_TYPE_INT32`,
because that can no longer happen; after `convert_scalar_to_number_ex`
the type is either `IS_LONG` or `IS_DOUBLE`.  We cater explicitly to
the `IS_ARRAY` case what also avoids triggering a type confusion when
`::TYPE_INT64` is passed as `$type`.
2020-02-03 12:28:32 +01:00
Christoph M. Becker
1468484296 Fix #74063: NumberFormatter fails after retrieval from session
While it would be desireable to actually support unserialization of
NumberFormatter instances, at least we should not allow serialization
for now.

We also remove some doubtful tests, which have been added[1] claiming
that they would crash the intl extension, but apparently no fix has
been applied, and the test cases have not been marked as XFAIL.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=ed793b2a3f857fd49c0c1b036062140da5b3e674>
2020-01-30 10:13:29 +01:00
Máté Kocsis
019e8d438c
Throw exception for unconstructed intl objects
Closes GH-5052
2020-01-05 23:55:14 +01:00
Máté Kocsis
1b93cfee0c
Use RETURN_THROWS() after zend_parse_method_parameters() 2020-01-02 23:01:37 +01:00
Christoph M. Becker
8060a8507f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78912: INTL Support for accounting format
2019-12-09 16:35:45 +01:00
Christoph M. Becker
505cc77cbe Fix #78912: INTL Support for accounting format
We provide `NumberFormatter::CURRENCY_ACCOUNTING` to wrap
`UNUM_CURRENCY_ACCOUNTING `[1].

[1] <https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dae97cdd7ed612d07d251021c076efb1c5>
2019-12-09 16:34:56 +01:00
Máté Kocsis
969e7a3c8b Cleanup return values for Intl when parameter parsing is unsuccessful
Closes GH-4871.
2019-10-30 13:21:40 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
f821256d00 Remove unused is_constructor arguments 2019-07-15 12:36:31 +02:00
Dmitry Stogov
e188e4170f Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function by reference 2019-04-24 18:28:29 +03:00
Dmitry Stogov
2e4686b566 Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function by reference 2019-04-24 18:16:47 +03:00
Dmitry Stogov
34db07567d Use ZEND_TRA_ASSIGN_REF_... macros for by reference arguments of internal functions. 2019-04-24 16:14:48 +03:00
Nikita Popov
86ef425177 Intl: Don't separately report "bad arguments" errors
zpp will be throwing for these now, don't report them in addition to
that.
2019-03-11 11:32:20 +01:00
Nikita Popov
513b76794b Make zpp failures always throw, independent of strict_types
Previously zend_parse_parameters (and FastZPP) would handle invalid
arguments depending on strict_types: With strict_types=1, a TypeError
is thrown, with strict_types=0 a warning is thrown and (usually) NULL
is returned. Additionally, some functions (constructors always and
other methods sometimes) opt-it to throwing regardless of strict_types.

This commit changes zpp to always generate a TypeError exception in
PHP 8.
2019-03-11 11:32:20 +01:00
Dmitry Stogov
91ef4124e5 Refactor zend_object_handlers API to pass zend_object* and zend_string* insted of zval(s). 2019-02-04 13:20:25 +03:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Dmitry Stogov
0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov
c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03:00
Dmitry Stogov
8939c4d96b Get rid of ZEND_ACC_CTOR, ZEND_ACC_DTOR and ZEND_ACC_IMPLEMENTED_ABSTRACT 2018-09-05 13:16:10 +03:00
Christoph M. Becker
3d4fbdade4 Remove needless version checks
As of PHP 5.5.3, we're requiring ICU ≥ 4.0[1] anyway, so there's no
need to check for ICU 3.x.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=8831b00>
2018-08-01 17:53:38 +02:00
Dmitry Stogov
265c3ed6cf Fixed incorrrecr zval_dtor() usage to replace value of argument passed by reference, that may lead to memory leaks. 2018-07-05 10:57:49 +03:00