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

242 Commits

Author SHA1 Message Date
Max Semenik 2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Christoph M. Becker 3516a9c8f0 Replace ISO_8859-* with ISO8859-* aliases for MBString
We also remove the mbregex ISO 8859 aliases with underscores.
2020-06-30 18:43:40 +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
George Peter Banyard 68164f40ce Fix [-Wundef] warning in MBString extension 2020-05-16 15:31:20 +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
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 73455778d4 Cache MBFL encoding for Oniguruma regex functions.
Closes GH-5355
2020-04-09 13:48:55 +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
Nikita Popov 11f0e1d1cb Move encoding fetching out of php_mb_convert_encoding() 2020-03-31 21:47:55 +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
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
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
Nikita Popov 22d2a80031 Merge branch 'PHP-7.4'
* PHP-7.4:
  Reset MBREX(search_re) in RSHUTDOWN
2020-01-29 16:05:47 +01:00
Nikita Popov 085371b299 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Reset MBREX(search_re) in RSHUTDOWN
2020-01-29 16:05:38 +01:00
Nikita Popov 560ff9725e Reset MBREX(search_re) in RSHUTDOWN
This is going to cause a segfault if reused in the next request.
To illustrate the issue, run these two scripts in sequence with
the built-in server:

// script1.php
mb_ereg_search_init('foobar');
mb_ereg_search('foo');

// script2.php
var_dump(mb_ereg_search_init("foobar"));
var_dump(mb_ereg_search_pos());
2020-01-29 16:05:11 +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
Máté Kocsis d1764ca330 Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis aadd3aaed9 Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +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
Christoph M. Becker 058fed6cd9 Just return on failing ZPP 2019-10-06 18:00:17 +02:00
Christoph M. Becker 013506779c Add missing zend_parse_parameters_none() 2019-10-06 17:56:40 +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
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 d2a1fe8462 Merge branch 'PHP-7.4' 2019-06-25 10:26:20 +02:00
Nikita Popov 46bad1d679 Fix region leak in mb_ereg_replace 2019-06-25 10:25:44 +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
Nikita Popov 47c74e780d Merge branch 'PHP-7.4' 2019-04-11 12:36:10 +02:00
Nikita Popov cd8312a77e Merge branch 'PHP-7.3' into PHP-7.4 2019-04-11 12:36:01 +02:00
Nikita Popov a61d24e4d8 Avoid onig match param unused variable warning 2019-04-11 12:35:24 +02:00
Stanislav Malyshev 63e0c22037 Merge branch 'PHP-7.4'
* PHP-7.4:
  Unfortunately, travis CI has old oniguruma library
  Update NEWS & UPGRADING
  Add fallbacks for older oniguruma versions
  Add mbstring.regex_stack_limit to php.ini-*
  Implement RF bug #72777 - ensure stack limits on mbstring functions.
2019-04-01 00:32:49 -07:00
Stanislav Malyshev 077ce33aa9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS & UPGRADING
  Add fallbacks for older oniguruma versions
  Add mbstring.regex_stack_limit to php.ini-*
  Implement RF bug #72777 - ensure stack limits on mbstring functions.
2019-04-01 00:05:36 -07:00
Stanislav Malyshev bc8f292c05 Merge branch 'mb-limit-73' into PHP-7.3
* mb-limit-73:
  Add fallbacks for older oniguruma versions
  Add mbstring.regex_stack_limit to php.ini-*
  Implement RF bug #72777 - ensure stack limits on mbstring functions.
2019-04-01 00:00:14 -07:00
Stanislav Malyshev e12c069d33 Add fallbacks for older oniguruma versions 2019-03-30 23:18:33 -07:00
Stanislav Malyshev 66c35b083b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Validate subject encoding in mb_split and mb_ereg_match
  Validate pattern against mbregex encoding
  SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws
2019-03-28 00:42:56 -07:00
Stanislav Malyshev 402adc1df1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Validate subject encoding in mb_split and mb_ereg_match
  Validate pattern against mbregex encoding
  SQLite3: add DEFENSIVE config for SQLite >= 3.26.0 as a mitigation strategy against potential security flaws
2019-03-28 00:35:22 -07:00
Yasuo Ohgaki 738016bd88 Implement RF bug #72777 - ensure stack limits on mbstring functions.
The patch creates new config: mbstring.regex_stack_limit, which
defaults to 100000.
2019-03-28 00:31:57 -07:00
Nikita Popov 0ecac37c40 Validate subject encoding in mb_split and mb_ereg_match
We were already validating the subject encoding in most functions,
but not these two.
2019-03-27 23:20:27 -07:00
Nikita Popov 40fe50daf6 Validate pattern against mbregex encoding
Oniguruma does not consistently perform this validation itself (at least
on older versions), so make sure we check pattern encoding validity on the
PHP side.
2019-03-27 23:19:46 -07:00
Nikita Popov 779b9bfe02 Merge branch 'PHP-7.4' 2019-02-11 15:00:52 +01:00
Nikita Popov e91d8ac5f6 Add MB_ONIGURUMA_VERSION and use it in a version dependent test 2019-02-11 14:53:19 +01:00
Nikita Popov d1c1481081 Unbundle oniguruma
And also switch detection over to pkg-config.
2019-02-11 14:53:19 +01:00
Nikita Popov 5702ce630b Merge branch 'PHP-7.4' 2019-02-11 12:32:38 +01:00
Nikita Popov f5d2a30466 Validate subject encoding in mb_split and mb_ereg_match
We were already validating the subject encoding in most functions,
but not these two.
2019-02-11 12:31:59 +01:00
Nikita Popov c9ab1078cc Merge branch 'PHP-7.4' 2019-02-11 12:12:54 +01:00