Commit graph

2601 commits

Author SHA1 Message Date
Gina Peter Banyard
105c1e9896
tree: use zend_str_has_nul_byte() API (#19336) 2025-07-31 23:57:27 +01:00
Niels Dossche
719419a6e5
Fix unterminated string GCC warnings in mbstring (#19192)
Necessary for for Werror builds
2025-07-23 11:49:16 +02:00
DanielEScherzer
07f1cfd9b0
Deprecate producing output in a user output handler (#19067)
https://wiki.php.net/rfc/deprecations_php_8_4
2025-07-09 21:20:58 -07:00
Gina Peter Banyard
c7778641dd ext/mbstring: Remove ZPP tests 2025-06-23 13:58:31 +02:00
Niels Dossche
b727821c79
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18901: integer overflow mb_split
2025-06-22 13:09:09 +02:00
Niels Dossche
2577e3a703
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18901: integer overflow mb_split
2025-06-22 13:08:05 +02:00
Niels Dossche
a5f21ca700
Fix GH-18901: integer overflow mb_split
We prevent signed overflow by making the count unsigned. The actual
interpretation of the count doesn't matter as it's just used to denote a
limit.

The test output for some limit values looks strange though, so that may
need extra investigation. However, that's orthogonal to this fix.

Closes GH-18906.
2025-06-22 13:07:43 +02:00
Niels Dossche
be17e9ed54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix handling of references in zval_try_get_long()
2025-06-04 21:00:22 +02:00
Niels Dossche
2b383848a7
Fix handling of references in zval_try_get_long()
This API can't handle references, yet everyone keeps forgetting that it
can't and that you should DEREF upfront. Fix every type of this issue
once and for all by moving the reference handling to this Zend API.

Closes GH-18761.
2025-06-04 21:00:05 +02:00
Saki Takamachi
462fd4dffe
Small change SIMD codes (#18626)
* use zend_simd.h in zend_accelerator_util_funcs.c

* use zend_simd.h in mbstring

* Remove unnecessary SSE3 includes
2025-05-26 16:32:27 +09:00
David CARLIER
16e154a2c4
ext/mbstring: mb_ereg*_replace remove unreachable code. (#18646) 2025-05-25 10:44:59 +01:00
Niels Dossche
cd43536b27 Drop useless cast 2025-05-21 19:54:09 +02:00
Niels Dossche
33ae76405f Use zend_string for arg_separators
This allows us to avoid a call to `zend_ini_str` which took 6% of the
profile on my i7-4790 for a call to `http_build_query`. Now we can just
grab the value from the globals.
In other files this can avoid some length recomputations.
2025-05-21 19:54:09 +02:00
Peter Kokot
8622362394
Remove unused strcasecmp definition (#17050)
The strcasecmp usage was removed via
dc5f3b9562.
2025-03-21 18:30:22 +01:00
Niels Dossche
33c4ca36e4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix weird unpack behaviour in DOM
  Fix GH-17989: mb_output_handler crash with unset http_output_conv_mimetypes
2025-03-09 11:21:34 +01:00
Niels Dossche
aa6e58f82a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix weird unpack behaviour in DOM
  Fix GH-17989: mb_output_handler crash with unset http_output_conv_mimetypes
2025-03-09 11:21:27 +01:00
Niels Dossche
c7d3dc6fab
Fix GH-17989: mb_output_handler crash with unset http_output_conv_mimetypes
The INI option can be NULL or invalid, resulting in a NULL global.
So we have to add a NULL check.

Closes GH-17996.
2025-03-09 11:16:33 +01:00
Niels Dossche
b1841fdfa2
Avoid unnecessary string refcounting in ext/mbstring (#17892) 2025-02-23 00:23:53 +01:00
Christoph M. Becker
61f42f2d4e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17503: Undefined float conversion in mb_convert_variables
2025-02-04 15:55:06 +01:00
Christoph M. Becker
47a0922dee
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17503: Undefined float conversion in mb_convert_variables
2025-02-04 15:53:24 +01:00
Christoph M. Becker
55e676e181
Fix GH-17503: Undefined float conversion in mb_convert_variables
Conversion of floating point to integer values is undefined if the
integral part of the float value cannot be represented by the integer
type.  We need to cater to that explicitly (in a manner similar to
`zend_dval_to_lval_cap()`).

Closes GH-17689.
2025-02-04 15:51:48 +01:00
Christoph M. Becker
36b8a69009
Drop superfluous enum forward declaration (GH-17455)
Besides that it is not needed, it is not proper C, and Clang warns that
"forward references to 'enum' types are a Microsoft extension"
(`-Wmicrosoft-enum-forward-reference`).
2025-01-17 11:45:58 +01:00
Niels Dossche
44a2a5d3e9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Resolve GH-17112 for lower branches
2024-12-11 19:33:03 +01:00
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
Niels Dossche
75e7234f70
Drop redundant macro definitions from mbfl_defs.h
These are defined by the standard include headers we already use.
These cause conflicts which cause compiler warnings on some toolchains
(see GH-17112).

Closes GH-17114.
2024-12-11 19:22:32 +01:00
Christoph M. Becker
6e759e079f
Resolve some MSVC C4244 level 2 warnings
These got already approval by the respective code owners in GH-17076.
2024-12-11 00:12:13 +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