Commit graph

2576 commits

Author SHA1 Message Date
Niels Dossche
ab47c189f3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Resolve GH-17112 for lower branches
2024-12-11 19:32:48 +01:00
Niels Dossche
754aa7706b
Resolve GH-17112 for lower branches
See https://github.com/php/php-src/pull/17114#issuecomment-2533050450
2024-12-11 19:32:36 +01:00
David Carlier
f47a45ecff
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-11 08:49:00 +01:00
David Carlier
89b4f94024
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-11 08:48:49 +01:00
David Carlier
c34d4fbbf4
Fix GH-16360 mb_substr overflow on start and length arguments.
occurs when they are negated to start working from the end instead
when set with ZEND_LONG_MIN.
2024-10-11 08:46:48 +01:00
Niels Dossche
07e418abfb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16261: Reference invariant broken in mb_convert_variables()
2024-10-07 17:49:56 +02:00
Niels Dossche
2fe8c4a4fc
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16261: Reference invariant broken in mb_convert_variables()
2024-10-07 17:49:24 +02:00
Niels Dossche
bf70d9ba0d
Fix GH-16261: Reference invariant broken in mb_convert_variables()
The behaviour is weird in the sense that the reference must get
unwrapped. What ended up happening is that when destroying the old
reference the sources list was not cleaned properly. We add handling for
that. Normally we would use use ZEND_TRY_ASSIGN_STRINGL but that doesn't
work here as it would keep the reference and change values through
references (see bug #26639).

Closes GH-16272.
2024-10-07 17:46:06 +02:00
Yuya Hamada
f815310c98 Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 18:28:43 +09:00
Yuya Hamada
4e23d3945a Merge branch 'PHP-8.2' into PHP-8.3 2024-10-05 18:26:25 +09:00
Yuya Hamada
d840200cea Fix GH-16229: Address overflowed in mb_send_mail when empty string 2024-10-05 18:24:09 +09:00
Ayesh Karunaratne
3afb96184e ext/mbstring: Update to Unicode 16
Updates UCD to Unicode 16.0 (released 2024 Sept).

Previously: 0fdffc18, #7502, #14680

Unicode 16 adds several new character sets and case folding rules.
However, the existing ucgendat script can still parse them.

This also adds a couple test cases to make sure the new rules for
East Asian Wide characters and case folding work correctly. These
tests fail on Unicode 15.1 and older because those verisons do not
contain those rules.
2024-09-17 10:40:00 +09:00
tekimen
dc5f3b9562
Fix GH-15824 mb_detect_encoding() invalid "UTF8" (#15829)
I fixed from strcasecmp to strncasecmp.
However, strncasecmp is specify size to #3 parameter.
Hence, Add check length to mime and aliases.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-11 09:40:35 +09:00
Peter Kokot
0f3b2e506b
Autotools: Move extension setup to main check (#15797)
Also, redundant PHP_MBREGEX check is removed and wrapped in a single
"if" check.
2024-09-08 08:31:21 +02:00
DanielEScherzer
5dd0575698
Generated arginfo header files: combine preprocessor conditional blocks (#15736)
When functions' or class methods' availability is based on some preprocessor
condition, the generated arginfo header files wrap the declarations in the
preprocessor `#if` conditional blocks, one per declaration, even if they are in
the same conditional block based on comments in the stub file. Instead of
having multiple conditional blocks one after the other with the same condition,
combine them into a single conditional block.
2024-09-04 13:04:22 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
9a2fdbec48 ext/mbstring: Use standard wording for ValueError 2024-08-21 21:12:17 +01:00
Peter Kokot
41709ac89f
Update ext/mbstring and ext/snmp dependencies (#15469)
The mbstring extension requires the pcre extension and snmp extension
requires the spl extension.
2024-08-17 21:11:28 +02:00
Peter Kokot
bb35da336d
Autotools: Sync CS in extensions (#15343)
- Redundant double quotes removed
- AS_* macros used
- Few nits adjusted here and there
2024-08-11 17:42:26 +02:00
Peter Kokot
16d9bd0aae
Sync AC_DEFINE help texts (#15207) 2024-08-03 09:47:39 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
7fd54f9d12
Remove duplicate ZEND_ENABLE_STATIC_TSRMLS_CACHE flag (#15080) 2024-07-29 10:17:23 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
b0db5e76a0
Autotools: Normalize ext/mbstring installed headers (#15097)
This uses the default PHP_INSTALL_HEADERS macro instead of a wrapper,
making this in tune with the rest of the extensions.
2024-07-24 22:41:16 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
Peter Kokot
0e2e8e0f13
Autotools: Quote all PHP_ADD_BUILD_DIR arguments (#14947)
- All arguments quoted for consistency
- m4_normalize used where list of directories becomes a bit simpler to
  read and see the diff
2024-07-14 16:58:43 +02:00
Peter Kokot
1ee4bf1c5f
Autotools: Use LIBS for appending -lonig (#14936)
LDFLAGS is by convention used more for linker options like -s and -L.
The -l option should go to LIBS instead. This does the same check but
is more understandable in the logs and M4 code.
2024-07-13 06:37:58 +02:00
Peter Kokot
149abd2fe9
Autotools: Refactor oniguruma invalid KOI8 check (#14928)
- Fixed warning: cast from pointer to integer of different size
  using the intptr_t instead of int type case
- CS synced
- Check wrapped in AC_CACHE_CHECK
- Over-quoted arguments reduced
- Also the include flags added to the check when building with oniguruma
  installed on custom places
2024-07-12 19:26:18 +02:00
Peter Kokot
9e94d2b040
Autotools: Refactor builtin checks (#14835)
This creates a single M4 macro PHP_CHECK_BUILTIN and removes other
PHP_CHECK_BUILTIN_* macros. Checks are wrapped in AC_CACHE_CHECK and
PHP_HAVE_BUILTIN_* CPP macro definitions are defined to 1 if builtin
is found and undefined if not.

This also changes all PHP_HAVE_BUILTIN_ symbols to be either undefined
or defined (to value 1) and syncs all #if/ifdef/defined usages of them
in the php-src code. This way it is simpler to use them because they
don't need to be defined to value 0 on Windows, for example. This is
done as previous usages in php-src were mixed and on many places they
were only checked with ifdef.
2024-07-08 21:25:16 +02:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Ayesh Karunaratne
421ac9ac28 ext/mbstring: update to Unicode 15
Updates UCD to Unicode 15.1 (released 2023 Sept). The upcoming
Unicode 16 version will be released roughly on 2024 Sept.

Previously: 0fdffc18, #7502

UCD 15.1 `DerivedNormalizationProps` contains multiple properties in
the same line, which breaks the parser. This also updates the
`ucgendat.php` script to allow 2 or three fields in each line, and to
look for the `Cased` and `Case_Ignorable` properties in either of the
fields to mimic the previous behavior.
2024-06-29 17:24:52 +02:00
Ayesh Karunaratne
23f99f08c9 ext/mbstring: update UCD parser to accept characters with multiple properties 2024-06-29 17:24:52 +02:00
Peter Kokot
a82d86479c
Replace WIN32 conditions with _WIN32 or PHP_WIN32 (#14462)
* Replace WIN32 conditions with _WIN32 or PHP_WIN32

WIN32 is defined by the SDK and not defined all the time on Windows by
compilers or the environment. _WIN32 is defined as 1 when the
compilation target is 32-bit ARM, 64-bit ARM, x86, or x64. Otherwise,
undefined.

This syncs these usages one step further.

Upstream libgd has replaced WIN32 with _WIN32 via
c60d9fe577

PHP_WIN32 is added to ext/sockets/sockets.stub.php as done in other
*.stub.php files at this point.

* Use PHP_WIN32 in ext/random

* Use PHP_WIN32 in ext/sockets

* Use _WIN32 in xxhash.h as done upstream

See https://github.com/Cyan4973/xxHash/pull/931

* Update end comment with PHP_WIN32
2024-06-10 21:59:41 +02:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Gina Peter Banyard
672539870d ext/mbstring: Fix some [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
25a5146180
Clean-up unused headers (#14365)
* ext/mbstring.c: clean-up headers and include intrinsics
2024-06-01 17:12:42 +01:00
Gina Peter Banyard
48d5ae98e7
ext/standard: Refactor exec.c public APIs to use zend_string pointers (#14353)
* Pull zend_string* from INI directive

* Ensure that mail.force_extra_parameters INI directive does not have any nul bytes

* ext/standard: Make php_escape_shell_cmd() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_cmd()

* ext/standard: Make php_escape_shell_arg() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_arg()
2024-05-29 10:59:17 +01:00
Gina Peter Banyard
c96e8946e1 ext/mbstring: Check encoding passed to mb_http_output() has no null bytes 2024-04-24 15:39:47 +01:00
Gina Peter Banyard
86dfbadc06 ext/mbstring: Always pass length to php_mb_get_encoding_or_pass()
We have access to this information, so propagate it instead of calling strlen().
This also removes the newly introduced _ex() variant.
2024-04-24 15:39:47 +01:00
Gina Peter Banyard
b61479bb28 ext/mbstring: Pass string length to _php_mb_ini_mbstring_http_output_set() 2024-04-24 15:39:47 +01:00
Niels Dossche
f81370847c
Fix GH-13815: mb_trim() inaccurate $characters default value (#13820)
Because the default characters are defined in the stub file, and the
stub file is UTF-8 (typically), the characters are encoded in the string
as UTF-8. When using a different character encoding, there is a mismatch
between what mb_trim expects and the UTF-8 encoded string it gets.

One way of solving this is by making the characters argument nullable,
which would mean that it always uses the internal code path that has the
unicode codepoints that are defaulted actually stored as codepoint
numbers instead of in a string.

Co-authored-by: @ranvis
2024-04-24 09:07:55 +02:00
tekimen
bedafdcf4a
Fix GH-13968: Build failed when with --enable-mbregex on MSVC (#13971)
I added /utf-8 flag in CFLAGS_MBSTRING at config.w32

Advised from Hirokawa-san thanks
2024-04-16 22:33:49 +02:00
David Carlier
39c67e37db
Merge branch 'PHP-8.3' 2024-04-10 10:01:57 +01:00
David Carlier
2cfd9df109
Fix GH-13932: Attempt to fix mbstring on windows build (msvc).
Build failure due to lack of VLA support in older compiler versions.
2024-04-10 10:01:11 +01:00
Ben Ramsey
7ca4300db8
Merge branch 'PHP-8.3' 2024-04-09 23:55:11 -05:00
Niels Dossche
c7c1336d0a
Adapt regression test 2024-04-09 23:52:19 -05:00
Alex Dowad
3394efc63e
Fix infinite loop in mb_encode_mimeheader 2024-04-09 23:52:11 -05:00
tekimen
0f1e97957a
Fix GH-13789: build failed mbstring_arginfo.h when Visual C++ on Windows (#13906)
Probably CP932 environment can't compile. So add /utf-8 flag.
2024-04-07 21:43:46 +02:00
tekimen
4d51bfa270
[RFC] Add mb_ucfirst and mb_lcfirst functions (#13161) 2024-03-20 17:25:19 +01:00
Peter Kokot
056c43f848 [skip ci] Sync file permissions in Git repository
Git can track executable (0755) and non-executable (0644) file modes.
This is a minor file permissions sync across the php-src Git repository.

- build/config.guess (0755 as done upstream)
- build/config.sub (0755 as done upstream)
- ext/*/?*.stub.php (0644)
- ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk (0755 due to shebang usage)
2024-02-20 17:58:47 +01:00