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

1057 Commits

Author SHA1 Message Date
Christoph M. Becker
844a2dd6ac Fix #79986: str_ireplace bug with diacritics characters
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).

Closes GH-6007
2020-08-24 11:08:48 +02:00
Nikita Popov
9d9dffe60a Fixed bug #79951
One branch did not release tmp_replace_entry_str.

Also reduce the scope of some variables.
2020-08-11 10:33:59 +02:00
Evgeny Stepanischev
ce149b0cb8 Fixed bug #79849
Closes GH-5853.
2020-07-14 12:41:43 +02:00
Nikita Popov
a72c53a070 Fixed bug #79817
Use *_IND macros in a few places in string.c.
2020-07-10 14:06:41 +02:00
Christoph M. Becker
372b678e56 Yet another check for php_strip_tags_ex() 2020-01-24 13:02:02 +01: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
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
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
fee38633d2 Fix #78840: imploding $GLOBALS crashes
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01: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
Christoph M. Becker
a87ef5e3dd Fix #78346: strip_tags no longer handling nested php tags
When the strip tags state machine has been flattened, an if statement
has mistakenly been treated as else if.  We fix this, and also simplify
a bit right away.
2019-08-02 17:03:20 +02:00
Christoph M. Becker
b215d1339f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77937: preg_match failed
2019-06-11 08:44:07 +02:00
Christoph M. Becker
f3ff72e54b Fix #77937: preg_match failed
On some recent Windows systems, ext\pcre\tests\locales.phpt fails,
because 'pt_PT' is accepted by `setlocale()`, but not properly
supported by the ctype functions, which are used internally by PCRE2 to
build the localized character tables.

Since there appears to be no way to properly check whether a given
locale is fully supported, but we want to minimize BC impact, we filter
out typical Unix locale names, except for a few cases which have
already been properly supported on Windows.  This way code like

  setlocale(LC_ALL, 'de_DE.UTF-8', 'de_DE', 'German_Germany.1252');

should work like on older Windows systems.

It should be noted that the locale names causing trouble are not (yet)
documented as valid names anyway, see
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019>.
2019-06-11 08:42:32 +02:00
Christoph M. Becker
69bab6e5a5 Fix #78003: strip_tags output change since PHP 7.3
A refactoring of the strip tags state machine[1] missed the special
treatment of `depth > 0` when a `>` is encountered in state 2 or 3.  We
re-add it for BC reasons.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=5cf64742773ddbf9af69d962a4d12b567fcf0084>
2019-05-13 13:10:24 +02:00
Nikita Popov
08a3062816 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-08 11:41:48 +02:00
Nikita Popov
d7b5954f28 Fixed bug #77853 2019-04-08 11:40:50 +02:00
Nikita Popov
986b9b5ae3 Add additional no_sanitize_address attributes
To fix bug #77447 in release mode as well.
2019-01-18 15:02:30 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Nikita Popov
f4a9da389b Deprecate non-string needles in string search functions
Part of https://wiki.php.net/rfc/deprecations_php_7_3.
2018-07-21 22:34:09 +02:00
Dmitry Stogov
5cf6474277 Flatten strip_tags state machine (GCC overoptimized this function, producing enormpous amount of code). 2018-07-16 13:22:17 +03:00
Dmitry Stogov
67b4c3379a Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY() 2018-07-09 12:46:46 +03:00
Dmitry Stogov
14e6c0cb8c str_replace() micro-optimization 2018-07-03 17:47:08 +03:00
Dmitry Stogov
dd932f7e63 Changed php_add[c]slashes prototypes (removed should_free argument) 2018-06-29 00:19:16 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Nikita Popov
3182292015 Fix unused variable warnings 2018-04-26 16:53:58 +02:00
David Carlier
86cff0bd4c Avoid using _N in SSE code
The _N constant is already defined in OpenSSL. Instead use some
more explicit variable names.
2018-04-26 16:50:19 +02:00
Khan M Rashedun-Naby
ef79b3ae0c Author Name Character Fix 2018-04-06 08:37:09 +02:00
Anatol Belski
bb2bfa6213 Use const pointers 2018-03-17 12:45:22 +01:00
Anatol Belski
fa9ea3c9eb Use const pointers where appropriate 2018-03-16 20:37:51 +01:00
Anatol Belski
0097619925 Use const pointers at some appropriate places 2018-03-16 15:43:30 +01:00
Xinchen Hui
5a0b8c125a slashchars are 16 bytes aligned 2018-03-16 16:01:32 +08:00
Xinchen Hui
4353e1100e Fixed folder 2018-03-16 13:23:35 +08:00
Xinchen Hui
9f456d6880 Optimized str_rot13 with SSE2 instructions 2018-03-16 10:52:57 +08:00
Xinchen Hui
13eca3d428 Avoding memory allocation 2018-02-26 16:54:53 +08:00
Xinchen Hui
fd88e7e3a1 Avoding memory allocation 2018-02-26 16:48:49 +08:00
zufuliu
bff179888f Improve similar_text(), reduce recursive call to php_similar_char()
If the longest common substring is the leftmost common substring, there
is no need to check the string prefixes for further common substrings,
since there are none.
2018-02-22 15:59:24 +01:00
Anatol Belski
bc3de8caea Fix def signature to match declaration 2018-02-21 11:53:38 +01:00
Xinchen Hui
91635b011b Optimized php_stripslash with SSSE3 instr 2018-02-21 10:09:11 +08:00
Xinchen Hui
5091f5ff9c Simplified the codes (the penalty of loading unaligned address is negligible) 2018-02-20 20:56:23 +08:00
Xinchen Hui
22e7329d9a change layout 2018-02-18 19:47:41 +08:00
Xinchen Hui
ac5cdd46f3 Move map out of loop 2018-02-18 19:34:48 +08:00
Xinchen Hui
c79f2de2cf Optimized strrev with SSSE3
since strrev is not wildly used, and SSSE3 is defined default by some
compiler, so won't try to do ifunc here.
2018-02-17 23:19:31 +08:00
Xinchen Hui
ab9162426b change argument parsing 2018-02-17 22:29:59 +08:00