Commit graph

1272 commits

Author SHA1 Message Date
Philipp Tanlak
1668ad7cb1 Add str_contains() function
RFC: https://wiki.php.net/rfc/str_contains

Closes GH-5179.
2020-03-16 11:05:26 +01:00
Nikita Popov
e8678fcb42 Fixed bug #75902
Don't special-case nested arrays/objects in str_replace(), instead
perform a string cast on them as well. For arrays, this will always
result in the usual conversion warning.

This behavior is consistent with preg_replace(). If we didn't want
to cast the array to string here, we should instead perform the
replacement recursively. Silently copying it is just confusing.
2020-03-10 16:49:17 +01: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
8dd91f52a5 Remove state pointer argument from php_strip_tags 2020-01-27 16:13:36 +01:00
Christoph M. Becker
5d65641011 Merge branch 'PHP-7.4'
* PHP-7.4:
  Yet another check for php_strip_tags_ex()
2020-01-24 13:04:26 +01:00
Christoph M. Becker
372b678e56 Yet another check for php_strip_tags_ex() 2020-01-24 13:02:02 +01:00
Christoph M. Becker
1b7343b93c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Yet another check for php_strip_tags_ex()
2020-01-24 12:51:02 +01:00
Christoph M. Becker
6d57476fd7 Yet another check for php_strip_tags_ex() 2020-01-24 12:50:24 +01:00
Stanislav Malyshev
a698e36aa8 Merge branch 'PHP-7.4'
* PHP-7.4:
  More checks for php_strip_tags_ex
2020-01-22 23:06:35 -08:00
Stanislav Malyshev
984d508825 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  More checks for php_strip_tags_ex
2020-01-22 23:06:28 -08:00
Stanislav Malyshev
dd3c664f8f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  More checks for php_strip_tags_ex
2020-01-22 22:41:56 -08:00
Stanislav Malyshev
2dc170e25d More checks for php_strip_tags_ex 2020-01-22 22:37:30 -08: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
Stanislav Malyshev
0f79b1bf30 Fix #79099: OOB read in php_strip_tags_ex 2020-01-20 21:43:42 -08:00
Máté Kocsis
aadd3aaed9
Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +01:00
Máté Kocsis
9099dbd961
Use RETURN_THROWS() after zend_type_error() 2020-01-01 14:23:21 +01:00
Máté Kocsis
31cf9a7ea9
Use RETURN_THROWS() when an exception is thrown
Closes GH-5036
2019-12-30 17:38:10 +01:00
Máté Kocsis
e34a1f9289
Convert zend_parse_parameters_none() to fast ZPP in standard lib
Closes GH-5037
2019-12-30 15:28:37 +01:00
Máté Kocsis
f3d5a5a9d3
Promote warnings to exceptions in string search related functions
GH-5004
2019-12-20 16:43:40 +01:00
Máté Kocsis
2ab123b84e
Convert string|array union parameter types
Closes GH-4995
2019-12-20 10:15:52 +01:00
Máté Kocsis
e699b2865f
Fix exception message of implode() 2019-12-12 23:05:12 +01:00
Máté Kocsis
beee92a887
Remove support for mixing parameter order in implode() 2019-12-12 13:49:05 +01:00
George Peter Banyard
5fbd49f9ab Convert Errors to ValueErrors
Closes GH-4930
2019-12-05 14:22:54 +01:00
Máté Kocsis
144b41ce88
Remove money_format() function 2019-12-05 13:15:54 +01:00
Máté Kocsis
b63c625260
Remove hebrevc() function 2019-12-05 13:15:54 +01:00
Nikita Popov
a603c06e2e Support "string or array" in zpp
This is one of our more common argument unions. Usage is just
prototyped in a few places, certainly not a full conversion.

I'm removing the str_replace.phpt test, because aparently it was
split up into smaller tests at some point, but the original has
not been removed.

Closes GH-4970.
2019-12-05 12:25:57 +01:00
Christoph M. Becker
8a5601a364 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:39:58 +01:00
Christoph M. Becker
3356dd0575 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:39:35 +01:00
Christoph M. Becker
861fa60814 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:38:45 +01:00
Christoph M. Becker
600f1f898f Fix #78814: strip_tags allows / in tag name => whitelist bypass
When normalizing tags to check whether they are contained in the set
of allowable tags, we must not strip slashes, unless they come
immediately after the opening `<`, or immediately before the closing
`>`.
2019-12-02 11:37:25 +01:00
Christoph M. Becker
b6e79f3724 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78840: imploding $GLOBALS crashes
2019-11-27 09:34:57 +01:00
Christoph M. Becker
30aa2e8932 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78840: imploding $GLOBALS crashes
2019-11-27 09:33:55 +01:00
Christoph M. Becker
fee38633d2 Fix #78840: imploding $GLOBALS crashes
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01:00
George Peter Banyard
501a72e354 Promote warning to value error in strpbrk()
Closes GH-4598
2019-11-22 00:36:54 +01:00
Nikita Popov
93ba3abe63 Warn on strtr(["" => "x"])
Previously:
 * If only ["" => "x"] was present, the original string was returned
   without warning.
 * If both ["" => "x"] and at least one more element was present,
   false was returned without warning.

New behavior:
 * Ignore "" keys in the replacement array (and perform any remaining
   replacement).
 * Throw a warning indicating that an empty string replacement has
   been ignored.

Closes GH-4792.
2019-10-30 10:53:45 +01:00
Colin O'Dell
e6d3146bdc Accept null lengths for substr functions()
If a null $length is passed to any of these functions, behave as if no
parameter was passed:

 - substr()
 - substr_count()
 - substr_compare()
 - iconv_substr()
2019-10-22 12:09:04 +02:00
Colin O'Dell
8ccd58baca Add Z_PARAM_LONG_OR_NULL macro 2019-10-22 12:09:04 +02:00
theodorejb
ef9736e062 Convert string function arginfo to PHP stubs 2019-10-07 11:13:16 +02:00
Nikita Popov
fdc133063d Convert count_chars invalid mode error to ValueError 2019-10-07 11:10:05 +02:00
Nikita Popov
647b1c7fcf Remove most uses of ZEND_PARSE_PARAMETERS_END_EX()
As ZPP now throws, it makes no sense to specify an explicit return
value.
2019-10-07 10:02:18 +02:00
Nikita Popov
c0a54f41b3 Merge branch 'PHP-7.4' 2019-09-30 15:06:51 +02:00
Nikita Popov
1f0ffece91 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-30 15:06:43 +02:00
Nikita Popov
0805e132b0 Merge branch 'PHP-7.2' into PHP-7.3 2019-09-30 15:06:32 +02:00
Nikita Popov
6fcde56b03 Fixed bug #78612 2019-09-30 15:06:07 +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
George Peter Banyard
d0754b86b1 Promote warnings to errors in substr_count() 2019-08-31 23:37:04 +02:00
George Peter Banyard
0240b903c5 Promote warnings to errors in substr_compare() 2019-08-31 23:34:24 +02:00