1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 18:13:00 +02:00
Commit Graph

1824 Commits

Author SHA1 Message Date
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
George Peter Banyard
f488b5d0f9 Merge mb_strstr() variants under a common implementation
This reduces heavy ducplicate code
2020-04-02 22:40:00 +02:00
George Peter Banyard
737871341f Improve code flow
These nested if-else blocks are unnecessary since we return early.
2020-04-02 22:40:00 +02:00
George Peter Banyard
577de174de Use ZEND_NUM_ARGS() macro instead of custom variable
Also why on earth would someone do this?
2020-04-02 22:40:00 +02:00
George Peter Banyard
4cd3d7b166 Promote empty string warning to ValueError in mb_ord() 2020-04-02 22:39:59 +02:00
George Peter Banyard
a54ee6e591 Merge branch 'PHP-7.4' 2020-04-01 04:55:35 +02:00
George Peter Banyard
cc0052678a Merge branch 'PHP-7.3' into PHP-7.4 2020-04-01 04:34:09 +02:00
George Peter Banyard
18dc9044f5 Fix bug 79441 2020-04-01 04:29:20 +02:00
George Peter Banyard
229dff9f08 Promote unsupported encoding warnings to ValueError 2020-04-01 00:54:36 +02:00
George Peter Banyard
21227dc1f1 Use php_mb_get_encoding instead of mbfl_name2encoding to get encoding
This reduces the number of places where the error message template is used.
Also promote the mb_check_encoding() warning to ValueError and add a test to cover the behaviour.
2020-03-31 23:39:39 +02:00
Nikita Popov
11f0e1d1cb Move encoding fetching out of php_mb_convert_encoding() 2020-03-31 21:47:55 +02:00
Nikita Popov
857fe616fa Remove unnecesary check in php_mb_check_encoding()
The caller makes sure that this is not NULL.
2020-03-31 21:02:00 +02:00
George Peter Banyard
daf45f68d2 Use explicit helper 2020-03-31 20:27:10 +02:00
George Peter Banyard
affc5a024a Encoding argument is always MBREX(current_mbctype) 2020-03-31 20:27:10 +02:00
George Peter Banyard
90eeca2531 Convert some unknown encoding warnings to ValueErrors in ext/mbstring
Promotes only the warnings where the encoding comes only from a string.
Functions which accept an array of encodings will be fixed at a later stage.

Closes GH-5317
2020-03-31 16:34:18 +02:00
Nikita Popov
3ca08ee764 Make sure mbstring.internal_encoding deprecation is always thrown
It was not thrown if the setting was specified via -d at least.
2020-03-31 10:47:23 +02:00
Nikita Popov
8a2ce27bba mb_detect_order(): Use proper array|string argument 2020-03-30 16:26:28 +02:00
Nikita Popov
500230fc85 Remove persistent arg from parse_encoding_array()
It is always zero.
2020-03-30 16:17:35 +02:00
Nikita Popov
b02b3539e7 mb_check_encoding(): Make var a proper array|string arg 2020-03-30 16:15:12 +02:00
Nikita Popov
50d07ff28c mb_detect_encoding(): Use proper array|string parameter
Needed to add support for nullabiltiy in some places.
2020-03-30 16:15:12 +02:00
Nikita Popov
bb6523693c mb_convert_variables(): Make $from an array|string argument 2020-03-30 15:51:04 +02:00
Nikita Popov
0d24422749 mb_convert_encoding(): Make $input a proper array|string arg 2020-03-30 15:41:55 +02:00
Nikita Popov
f24f6cbab9 mb_convert_encoding(): Make $from_encodings a proper array|string arg
Switching to FastZPP, as we don't support this in normal zpp.
2020-03-30 15:39:33 +02:00
Nikita Popov
7cea789cfc Parse mb_convert_encoding() encodings only once
Instead of re-parsing them for every converted value. Also reuse
the generic parse_array() helper.
2020-03-30 14:54:15 +02:00
Nikita Popov
cd5a29b820 Properly report unknown encoding in encoding lists
And clean up the related array and list parsing code.
2020-03-30 14:46:59 +02:00
Nikita Popov
ed850f2723 Move encoding fetching outside php_mb_stripos() 2020-03-30 12:29:11 +02:00
Christoph M. Becker
9e77d5a9da Fix #76999: mb_regex_set_options() return current options
When setting new options, `mb_regex_set_options()` is supposed to
return the *previous* options.
2020-03-27 10:34:16 +01:00
Christoph M. Becker
ebdaeb8572 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:42:15 -07:00
Christoph M. Becker
db848e1482 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:40:48 -07:00
Christoph M. Becker
1fdffd1c55 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:40:00 -07:00
Nikita Popov
0fdffc1807 Update Unicode tables to 13.0.0 2020-03-12 11:29:51 +01:00
Máté Kocsis
960318ed95 Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00
George Peter Banyard
c7094d8926 Fix mbstring regex variable types to correspond to Oniguruma
The beginning and ending of a Oniguruma Regex are stored in a OnigRegion (which is a typedef to the Oniguruma re_registers struct) as as int* therefore change the type from size_t to int

Closes GH-5196
2020-02-26 11:24:03 +01:00
George Peter Banyard
363d87f256 Fix [-Wmissing-field-initializers] compiler warning in mbstring
Add missing NULL pointer for mbfl_convert_vtbl struct.
2020-02-21 13:19:09 +01:00
Máté Kocsis
ac0853eb26 Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00