1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

679 Commits

Author SHA1 Message Date
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 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 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
Nikita Popov 7db3a51884 Only fetch to_encoding once in mb_convert_encoding()
Instead of doing it on every conversion. This is both more efficient
and avoids generating multiple warnings.
2020-01-28 15:12:24 +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
Nikita Popov 0f6d223ddb Add #defines for mbfl_strpos error conditions 2020-01-24 10:02:41 +01:00
Christoph M. Becker f1bf4bf6eb Don't leak encoding_str 2020-01-22 11:15:16 +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 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
George Peter Banyard 483efc7e50 Allow empty needles in mb_strpos and mb_strstr function family.
MBstring analogous implementation to 6d578482a9

Closes GH-4977
2020-01-07 22:53:35 +01:00
Máté Kocsis aadd3aaed9 Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +01:00
Máté Kocsis 7b4a4d2ace Use RETURN_THROWS() after try_convert_to_string() 2020-01-03 17:04:06 +01:00
Máté Kocsis 12ce73a5bb Use RETURN_THROWS() after zend_value_error() 2019-12-31 16:58:15 +01:00
Máté Kocsis 345703724c Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Máté Kocsis 2ab123b84e Convert string|array union parameter types
Closes GH-4995
2019-12-20 10:15:52 +01:00
George Peter Banyard fdf45debdf Remove deprecated behaviour of passing encoding as third parameter in mb_strrpos()
Merged GH-5011
2019-12-13 22:03:27 +01:00
Christoph M. Becker e2100619ac Expect appropriate parameter type in the first place
`mb_encode_numericentity()` and `mb_decode_numericentity()` accepted
arbitrary zvals as `$convmap`, but ignored anything else than arrays.
This appears to be an unresolved relict of their ZPP conversion for
PHP 5.3[1].  We now expect an array in the first place.

We also expect `count($convmap)` to be a multiple of four (else we
throw a `ValueError`), and do no longer special case empty `$convmap`.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=1c77f594294aee9d60e7309279c616c01c39ba9d>
2019-10-07 16:48:08 +02:00
Christoph M. Becker 8f7238ed5c Explicitly declare empty parameter list 2019-10-06 19:04:51 +02:00
Christoph M. Becker 0a47096c08 Add MBString arginfo stubs 2019-10-06 17:45:32 +02:00
Nikita Popov 21e631e473 Merge branch 'PHP-7.4' 2019-10-06 10:07:57 +02:00
Nikita Popov 6623e7ac51 Add support for mbstring.regex_retry_limit
This is very similar to the existing mbstring.regex_stack_limit,
but for backtracking. The default value matches pcre.backtrack_limit.
Only used on libonig >= 2.8.0.
2019-10-06 10:06:33 +02:00
Christoph M. Becker d0d7508d1b Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78609: mb_check_encoding() no longer supports stringable objects
2019-09-30 13:07:19 +02:00
Christoph M. Becker 70f367d48a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78609: mb_check_encoding() no longer supports stringable objects
2019-09-30 13:06:57 +02:00
Christoph M. Becker 2046b3ce4f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78609: mb_check_encoding() no longer supports stringable objects
2019-09-30 13:04:54 +02:00
Christoph M. Becker 45db6fa567 Fix #78609: mb_check_encoding() no longer supports stringable objects
We apply type juggling for other types than array.
2019-09-30 12:42:04 +02:00
Gabriel Caruso 5d6e923d46 Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Christoph M. Becker 48892e6d24 Remove unused parameter
Cf. <https://bugs.php.net/78579>.
2019-09-21 16:30:17 +02:00
Christoph M. Becker 8293667f60 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78579: mb_decode_numericentity: args number inconsistency
2019-09-21 16:18:20 +02:00
Christoph M. Becker 6dea11acd8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78579: mb_decode_numericentity: args number inconsistency
2019-09-21 16:17:45 +02:00
Christoph M. Becker 698088ca7c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78579: mb_decode_numericentity: args number inconsistency
2019-09-21 16:16:52 +02:00
Christoph M. Becker 398b308316 Fix #78579: mb_decode_numericentity: args number inconsistency
mb_decode_numericentity() accepts a fourth optional parameter, which is
unused, however.  Since this parameter doesn't do any harm, and to avoid
the small BC break, we're keeping this parameter for PHP 7, but adjust
the arginfo.

For PHP 8, we will remove this parameter.
2019-09-21 16:15:23 +02:00
Nikita Popov 36db71df47 Merge branch 'PHP-7.4' 2019-07-22 12:28:40 +02:00
Nikita Popov 39e756e7fe Deprecate encoding as 3rd param to mb_strrpos() 2019-07-22 11:39:52 +02:00
Nikita Popov 8fc58a1a1d Merge branch 'PHP-7.4' 2019-07-01 11:14:54 +02:00
Nikita Popov 7defd5f69c Fix unused variable warnings when mbregex disabled 2019-07-01 11:14:35 +02:00
Dmitry Stogov e029cc4dd4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cheaper checks for exceptions thrown from __toString()
2019-06-06 02:23:17 +03:00
Dmitry Stogov 457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov 7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Dmitry Stogov f9dbfcd6fa Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed compatibility with phpdbg
2019-04-18 01:34:13 +03:00
Dmitry Stogov 4c1a25ad5f Fixed compatibility with phpdbg 2019-04-18 01:33:56 +03:00
Nikita Popov 1d53d6df7e Merge branch 'PHP-7.4' 2019-04-17 14:06:05 +02:00