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
5aa649cf51
Merge branch 'PHP-7.4'
2020-06-17 09:35:19 +02:00
Nikita Popov
3d6199db8a
Add mbregex skipif
2020-06-17 09:35:02 +02:00
Nikita Popov
bbe74a6e3a
Merge branch 'PHP-7.4'
2020-06-16 14:32:33 +02:00
Nikita Popov
3f2f36d5d4
Fix non-default syntax in mb_ereg_search()
2020-06-16 14:31:29 +02:00
Nikita Popov
88021ffe0e
Fix count_commas implementation
...
Ooops, I did not account for the changing length here.
2020-06-12 11:04:35 +02:00
Nikita Popov
f691693ebc
Fix null pointer ub in encoding parsing
...
And do a bit of drive-by cleanup by extracting count_commas and
reducing some variable scopes.
2020-06-12 10:08:34 +02:00
Christoph M. Becker
5a04796f76
Fix MSVC level 1 (severe) warnings
...
We fix (hopefully) all instances of:
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273 >
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312 >
`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.
We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.
[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html >
2020-06-05 11:17:05 +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
68164f40ce
Fix [-Wundef] warning in MBString extension
2020-05-16 15:31:20 +02:00
George Peter Banyard
7dd332f110
Refactor mb_substitute_character()
...
Using the new Fast ZPP API for string|int|null
This also fixes Bug #79448 which was too disruptive to fix in PHP 7.x
2020-05-11 17:30:01 +02:00
Nikita Popov
d38f819647
Fix test file encoding
...
The mb_http_input_pass.phpt was intended to use the same encoding
as mb_http_input.phpt, not UTF-8.
2020-05-07 21:18:49 +02:00
Nikita Popov
481b7421f3
Throw warning if invalid internal_encoding ini is specified
2020-05-07 14:44:13 +02:00
Nikita Popov
217f6013b3
Remove no_language from mbfl_string
...
This is not actually used for anything and just causes confusion.
2020-05-07 11:36:57 +02:00
Nikita Popov
226d9dd30a
Only allow "pass" as input/output encoding
...
"pass" is not a real encoding, it just means "don't perform any
conversion". Using it as an internal encoding or passing it to
any of the mbstring() function will not work (and on master commonly
assert).
2020-05-07 11:19:14 +02:00
Nikita Popov
5bfa9598f4
Return false from failed mb_convert_variables()
...
If we fail to detect the encoding return false, just like
mb_convert_encoding() does, and the implementation here clearly
intended. Previously the "pass" pseudo-incoding was returned.
2020-05-07 10:16:46 +02:00
Nikita Popov
71f48260af
Fix assertion failure when failing to detect encoding
...
Looks like prior to 7.3 this just passed the original string
through. Since 7.3 it returns false. Let's stick with that
behavior.
2020-05-06 22:56:01 +02:00
Nikita Popov
901417f0ae
Fix mbfl default allocators
...
Forgot to remove the persistent allocators from here.
2020-05-04 23:41:39 +02:00
Nikita Popov
a0cae937c5
Spec mbfl allocators as infallible
...
And remove all NULL checks.
2020-05-04 23:19:07 +02:00
Nikita Popov
7d4ff8443e
Remove persistent allocators from libmbfl
...
These functions are not used, and I don't think we have any plans
to ever use them.
2020-05-04 23:19:07 +02:00
Máté Kocsis
6111d64cda
Improve a last couple of argument error messages
...
Closes GH-5404
2020-04-20 13:09:00 +02:00
George Peter Banyard
2a4c81f1ee
Fix [-Wjump-misses-init] in php_mbregex.c by adding an inner scope
2020-04-18 14:52:48 +02:00
Máté Kocsis
1f48feebb9
Improve some TypeError and ValueError messages
...
Closes GH-5377
2020-04-14 14:38:45 +02:00
George Peter Banyard
01762e56ed
Adapt assertion as mbfl_strwidth returns a size_t
2020-04-12 19:34:05 +02:00
George Peter Banyard
3eba187b15
Refactor and remove dead code in mb_ereg(i)_replace
...
We do not support the 'e' option anymore.
Merged together code which would emit an error if this option is present.
This also makes it clearer that the whole branch in the replacement section supporting this option is never hit, thus removed.
2020-04-10 17:56:05 +02:00
George Peter Banyard
12ec7a2730
Convert if blocks to assertions and adapt stubs accordingly
2020-04-09 13:50:37 +02:00
George Peter Banyard
73455778d4
Cache MBFL encoding for Oniguruma regex functions.
...
Closes GH-5355
2020-04-09 13:48:55 +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
38d93262a0
Update mb_strrpos() stub
...
We no longer accept the encoding as 3rd param, so we can make this
a proper int argument.
2020-04-08 12:03:14 +02:00
Nikita Popov
8ff1991503
Fix test
2020-04-08 09:41:14 +02:00
George Peter Banyard
1e8459d626
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Revert "Went to fast and forgot to update tests"
Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails"
2020-04-07 22:49:17 +02:00
George Peter Banyard
9b98cf3209
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Revert "Went to fast and forgot to update tests"
Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails"
2020-04-07 22:27:00 +02:00
George Peter Banyard
a0df5f3b54
Revert "Went to fast and forgot to update tests"
...
This reverts commit 656eac74fa
.
2020-04-07 22:24:40 +02:00
George Peter Banyard
6031b08240
Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails"
...
This commit brings some substantial changes in behaviour due to the weird implementation.
This will be fixed in master due to BC concerns.
This reverts commit 1333b46d6d
.
2020-04-07 22:23:24 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
...
Closes GH-5352
2020-04-05 21:15:30 +02:00
George Peter Banyard
1b6f61e7c4
Promote invalid case mode to ValueError in mb_case_converter
...
Add assertions to check the return value is not NULL as this indicates a bug.
Add identical assertion to mb_strtoupper and mb_strtolower.
This means these functions can't return false anymore, ammend stubs accordingly.
2020-04-05 03:33:08 +02:00
George Peter Banyard
a34e73de5a
mb_scrub() can't return false anymore
...
Also drop the intermediary function which was only used here
2020-04-05 01:44:39 +02:00
George Peter Banyard
07062e1fc5
Promote some warnings to ValueError in mbstring
...
Promoted warnings are:
* Empty encoding lists
* Unknown language
* Start and Width out of bound
2020-04-05 01:44:38 +02:00
George Peter Banyard
bd52b62ae0
Convert some if blocks to assertions
2020-04-05 01:44:38 +02:00
George Peter Banyard
fc5a88f614
Merge branch 'PHP-7.4'
2020-04-03 22:23:03 +02:00
George Peter Banyard
c31b2bbd46
Merge branch 'PHP-7.3' into PHP-7.4
2020-04-03 22:10:56 +02:00
George Peter Banyard
656eac74fa
Went to fast and forgot to update tests
...
However due to the really lax conversion to integer all strings pass as 0
2020-04-03 22:03:00 +02:00
George Peter Banyard
9cb9c53f1f
Merge branch 'PHP-7.4'
2020-04-03 21:30:35 +02:00
George Peter Banyard
7a42611870
Merge branch 'PHP-7.3' into PHP-7.4
2020-04-03 21:28:07 +02:00
George Peter Banyard
1333b46d6d
Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails
2020-04-03 21:18:45 +02:00
Christoph M. Becker
17d4e66204
Fix #68690 : Hypothetical off-by-one condition
...
We fix this, even though `filter->cache == jisx0213_u2_tbl_len` can
never be true here.
2020-04-03 14:20:37 +02:00
George Peter Banyard
fa3b8c75fb
Promote unknown encoding throws in encoding array/string list
...
For the string list we emit still emit a warning by comparing arg_num to 0
Closes GH-5337
2020-04-03 10:58:46 +02:00
George Peter Banyard
656046873c
Refactor mb_substr_count()
...
Promote empty needle warning to ValueError
Convert if branch into an assertion as if mbfl_substr_count fails this now implies a bug
Thus mb_substr_count() can only return int now, fix stubs accordingly
2020-04-02 22:40:00 +02:00
George Peter Banyard
165fde9a37
Convert if branch to assertion in mb_strlen
...
This operation should never fail, therefore it's converted to an assertion.
Thus this mb_strlen() can now only return int, fix stubs accordingly
2020-04-02 22:40:00 +02:00
George Peter Banyard
d44ee9112f
Promote mb_str_split warning to ValueError
...
Also add a TODO about documenting this funcion on PHP.net
Convert some checks to assertions as if they don't hold something went wrong during memory allocation
Due to these changes this function cannot return false anymore, fix stubs accordingly
2020-04-02 22:40:00 +02:00