Commit graph

1244 commits

Author SHA1 Message Date
Nikita Popov
12214e1d46 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79817
2020-07-10 14:07:59 +02:00
Nikita Popov
3f8d71d37f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79817
2020-07-10 14:07:17 +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
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Alex Dowad
7e2147be23 Clean up some unused code (and fix some comments) in build scripts
- Fix typo in build/php.m4

- Nothing uses HAVE_INTTYPES_H; so remove check for header file

- Nothing defines ZEND_ACCONFIG_H_NO_C_PROTOS; so remove #ifndef

- `format_money` was removed in 2019, so <monetary.h> no longer needed

- Nothing uses HAVE_NETDB_H; so remove check for header file

- Nothing checks HAVE_TERMIOS_H; so remove check for header file

    (This was actually added when Wez Furlong was adding the original implementation of
    PTY support in `proc_open`, since replaced.)

- Nothing checks HAVE_SYS_AUXV_H; so remove check for header file

- PHP_BUILD_DATE variable is not used for anything, so remove it

    This variable was added to the Makefile, but from there, was not used for anything.
    The comments suggest it was intended to allow 'reproducible builds'. Presumably,
    this means that if a bug is found in a PHP binary somewhere, one could look at the
    Makefile which it was built from, see the date, and then could check the same
    code version out from source control. But... there can easily be multiple commits
    to the repo in the same day. Also, what makes us think that the Makefile which a
    binary was built from will be easily available?

    Besides, ext/standard/info.c already embeds the build date and time in each binary...
    but it does it using `__DATE__` and `__TIME__` (see `php_print_info`).

- Nothing checks HAVE_FINITE; so don't check for function

- Grammar fix to comment in build/php.m4

- Nothing sets $php_ldflags_add_usr_lib variable in configure, so remove conditional

    This was added in 2002, when Rasmus was having difficulty building PHP on some
    host and needed to have /usr/lib in the rpath. It was never documented and
    probably has never been used by anyone else.
2020-06-19 22:04:52 +02:00
twosee
83a77015ad Add helper APIs for maybe-interned string creation
Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.
2020-06-08 15:31:52 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Christoph M. Becker
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
Nikita Popov
2414b3d775 Ensure ctype_string is NULL for C locale
We already document that this is the case, but currently it's only
true if setlocale() has not been called. Make sure ctype_string is
always NULL, even with an explicit "C" locale call, so we can
more efficiently check whether we are in the "C" locale.

Closes GH-5542.
2020-05-07 21:26:13 +02:00
Nikita Popov
3f76947303 Rename locale_string to ctype_string
To make it more obvious that this only refers to the LC_CTYPE
locale.
2020-05-07 18:45:03 +02:00
Xinchen Hui
5d8cf36022 Folder marks 2020-05-07 23:03:25 +08:00
William Hudgins
31fb6a08b3 Add str_starts_with() and str_ends_with()
RFC: https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions

Closes GH-5300.
2020-05-05 16:03:47 +02:00
Xinchen Hui
f5fe4c3c38 Use ascii lowercase if locale is default C 2020-04-30 18:43:09 +08:00
Nikita Popov
90705d44e3 Treat invalid characters in basename() consistently
Always simply ignore (pass through) them. Previously the behavior
depended on where the invalid character occurred, as it messed
up the state management.
2020-04-29 18:43:09 +02:00
Nikita Popov
d50a12629d Clean up naming in basename() implementation 2020-04-29 18:43:09 +02:00
Nikita Popov
8e411fe54e Revert "Merge branch 'sse2_strtolower' of https://github.com/laruence/php-src"
This reverts commit 5a6373f904, reversing
changes made to 45cb42166d.

This breaks strtolower-win32.phpt.
2020-04-29 09:49:01 +02:00
Xinchen Hui
5a6373f904 Merge branch 'sse2_strtolower' of https://github.com/laruence/php-src
* 'sse2_strtolower' of https://github.com/laruence/php-src:
  Use ascii lowercase if locale is default C
2020-04-29 12:26:06 +08:00
Nikita Popov
dc1574e0a0 Fix ifunc resolver return type warning 2020-04-28 15:25:35 +02:00
Xinchen Hui
a233e128a5 Use ascii lowercase if locale is default C 2020-04-28 11:33:02 +08:00
Máté Kocsis
6111d64cda
Improve a last couple of argument error messages
Closes GH-5404
2020-04-20 13:09:00 +02:00
Máté Kocsis
1f48feebb9
Improve some TypeError and ValueError messages
Closes GH-5377
2020-04-14 14:38:45 +02:00
Máté Kocsis
bb6f374048
Improve argument error messages in ext/standard
Closes GH-5198
2020-03-18 19:56:10 +01:00
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