Commit graph

604 commits

Author SHA1 Message Date
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
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
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
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
Máté Kocsis
960318ed95
Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00
Máté Kocsis
ac0853eb26
Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Nikita Popov
ae6f45ad45 var_dump(): Don't skip recursion detection on first level
This is confusing. The current output doesn't make it clear that
we're in fact recursing to the top-level structure.

Closes GH-5171.
2020-02-12 11:25:50 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
7c34d73876 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add SKIPIF to test requiring mbregex
2020-01-30 11:21:32 +01:00
Nikita Popov
a73f98eda9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add SKIPIF to test requiring mbregex
2020-01-30 11:21:26 +01:00
Nikita Popov
6ccd675776 Add SKIPIF to test requiring mbregex 2020-01-30 11:20:42 +01:00
Nikita Popov
7d170eb295 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix shift ub in mbstring
  Restore digit check in mb_decode_numericentity()
2020-01-30 10:08:21 +01:00
Nikita Popov
9aadcb18e1 Restore digit check in mb_decode_numericentity()
I replaced it with a multiplication overflow check in
18599f9c52. However, we need both,
because the code for restoring the number can't handle numbers
with many leading zeros right now and I don't feel like teaching it.
2020-01-30 10:07:01 +01:00
Nikita Popov
2e97ae91c8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix mb_ord() crash if internal encoding not supported
2020-01-29 16:19:21 +01:00
Nikita Popov
acc616c455 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix mb_ord() crash if internal encoding not supported
2020-01-29 16:19:14 +01:00
Nikita Popov
a62c06c4cf Fix mb_ord() crash if internal encoding not supported
enc_name can be NULL here. Take the name from the mbfl_encoding
instead.
2020-01-29 16:18:46 +01:00
Nikita Popov
b2c8abe951 Merge branch 'PHP-7.4'
* PHP-7.4:
  Better overflow check for entity decoding
2020-01-29 16:08:55 +01:00
Nikita Popov
18599f9c52 Better overflow check for entity decoding
Check for multiplication overflow rather than number of digits.
2020-01-29 16:08:46 +01:00
Nikita Popov
42e22a2d91 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix use of mb_ereg_search_getregs() after invalid pattern
2020-01-29 12:50:47 +01:00
Nikita Popov
b3f07afabc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix use of mb_ereg_search_getregs() after invalid pattern
2020-01-29 12:50:40 +01:00
Nikita Popov
392ad206a4 Fix use of mb_ereg_search_getregs() after invalid pattern
This segfaulted because we assumed that if there are matches,
there must be a regular expression as well.
2020-01-29 12:50:18 +01:00
Nikita Popov
083bbf5140 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix length inconsistency in mb_convert_encoding
2020-01-29 12:22:58 +01:00
Nikita Popov
5589bf4d4a Fix length inconsistency in mb_convert_encoding
Don't mix strlen() and ZSTR_LEN(). If the encoding contains a
NULL byte, this will overflow the buffer.

NULL bytes will still make this behave oddly because the consuming
code will cut off the string there, but let's address that in master...
2020-01-29 12:19:28 +01:00
Nikita Popov
bc32cce6a2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix recovery of large entities in mb_decode_numericentity()
2020-01-29 11:49:27 +01:00
Nikita Popov
91f878779c Fix recovery of large entities in mb_decode_numericentity()
Make sure we don't overflow the integer.
2020-01-29 11:48:34 +01:00
Nikita Popov
38d205a5b1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix memory leak in mb_str_split
2020-01-28 17:40:07 +01:00
Nikita Popov
9fcaf25c93 Fix memory leak in mb_str_split 2020-01-28 17:39:49 +01:00
George Peter Banyard
ba82e18755 Allow empty needle in mb_strrchr() 2020-01-25 12:22:01 +01:00
George Peter Banyard
986da2a436 Convert warnings to ValueError in mb_strpos function family.
Closes GH-5109
2020-01-24 23:59:22 +01:00
Nikita Popov
9e0e8d5650 Handle mb_str(r)ipos offset consistently as well 2020-01-24 10:54:20 +01:00
Nikita Popov
ce6169832f Move offset error checking into mbfl_strpos
This avoids calculating the full length only in order to validate
the offset, as mbfl_strpos needs to find the offset internally
anyway.
2020-01-24 10:50:02 +01:00
Christoph M. Becker
da9c206781 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79154: mb_convert_encoding() can modify $from_encoding
2020-01-22 10:32:06 +01:00
Christoph M. Becker
ab846173e2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79154: mb_convert_encoding() can modify $from_encoding
2020-01-22 10:30:25 +01:00
Christoph M. Becker
9be31a582a Fix #79154: mb_convert_encoding() can modify $from_encoding
We must not modify arrays passed by value.
2020-01-22 10:28:07 +01:00
Christoph M. Becker
4327b113a0 Fix test expectation
As of PHP 8.0.0, array to string conversion raises a warning.
2020-01-22 10:21:55 +01:00
Christoph M. Becker
8f4d07bff0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79149: SEGV in mb_convert_encoding with non-string encodings
2020-01-22 09:45:37 +01:00
Christoph M. Becker
94c9dc498f Fix #79149: SEGV in mb_convert_encoding with non-string encodings
We must not assume that `hash_entry` `IS_STRING`, but rather use
`encoding_str` which is guaranteed to be.
2020-01-22 09:43:51 +01:00
Stanislav Malyshev
545f77d313 Merge branch 'PHP-7.4'
* PHP-7.4:
  Update NEWS
  Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
  Fix #79099: OOB read in php_strip_tags_ex
  Fix #79091: heap use-after-free in session_create_id()
2020-01-20 22:47:28 -08:00
Stanislav Malyshev
a29c793381 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
  Fix #79099: OOB read in php_strip_tags_ex
  Fix #79091: heap use-after-free in session_create_id()
2020-01-20 22:47:01 -08:00
Stanislav Malyshev
25ec7eb346 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
  Fix #79099: OOB read in php_strip_tags_ex
  Fix #79091: heap use-after-free in session_create_id()
2020-01-20 22:46:29 -08:00