1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

72501 Commits

Author SHA1 Message Date
Ilija Tovilo
92ba1e4ea0 Prevent closing of innerstream of php://temp stream
Fixes GH-21221
Closes GH-21222
2026-03-13 20:34:04 +01:00
Arshid
44d4f0e45a ext/soap: Use smart_str_appends() instead of smart_str_appendl(..., strlen(...)) (GH-21426) 2026-03-13 16:05:06 +01:00
Arshid
5ccaccda97 ext/reflection: Use smart_str_append instead of smart_str_appendl (#21413) 2026-03-12 17:14:03 -07:00
ndossche
e9b3ea82b5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
2026-03-12 22:02:01 +01:00
ndossche
757dadcf1f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
2026-03-12 22:01:21 +01:00
Ilia Alshanetsky
7950482562 Fix GH-21083: Skip private_key_bits validation for EC/curve-based keys
openssl_pkey_new() checks private_key_bits >= 384 before generating any
key. For EC, X25519, ED25519, X448, and ED448 the size is inherent to
the curve or algorithm, so this check doesn't apply and causes failures
when default_bits is missing from openssl.cnf (which is the case in
OpenSSL 3.6's default config).

Skip the minimum-bits check for key types that don't use private_key_bits.

Closes GH-21387.
2026-03-12 21:53:22 +01:00
David CARLIER
b0aa6b9626 ext/soap: various optimisations
* replace strcat/strncpy with memcpy for pre-allocated buffers.
* remove redundant memset before struct copy.
2026-03-12 17:56:43 +00:00
ndossche
46357cbaaf dom: Merge declaration and assignment 2026-03-12 17:48:38 +01:00
ndossche
28c6659b06 dom: Simplify return value management of xpath callback 2026-03-12 17:48:38 +01:00
ndossche
8b7c70da21 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21357: XSLTProcessor works with DOMDocument, but fails with Dom\XMLDocument
2026-03-11 22:31:39 +01:00
ndossche
a3f486dfa3 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21357: XSLTProcessor works with DOMDocument, but fails with Dom\XMLDocument
2026-03-11 22:31:33 +01:00
ndossche
284fd7779d Fix GH-21357: XSLTProcessor works with DOMDocument, but fails with Dom\XMLDocument
Registering namespace after the parsing is too late because parsing can
fail due to attributes referencing namespaces.
So we have to register fake namespaces before the parsing.
However, the clone operation reconciles namespaces in the wrong way, so
we have to clone via an object.

Closes GH-21371.
2026-03-11 22:31:03 +01:00
Dmitry Stogov
79556df7ee Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
2026-03-11 15:23:22 +03:00
Dmitry Stogov
35ee95a827 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
2026-03-11 15:23:12 +03:00
Ilia Alshanetsky
80dc4c19d6 Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
Insert type guards (CHECK_OP1_TRACE_TYPE / CHECK_OP2_TRACE_TYPE) on the
sensitive bailout paths in ADD/SUB/MUL JIT compilation: the MAY_BE_UNDEF
and non-numeric operand breaks. Guards are only emitted when the traced
operand type is IS_LONG or IS_DOUBLE, ensuring TSSA result type
predictions stay valid for side traces without affecting the normal
numeric fast path.


Fixes GH-20838

Co-authored-by: Dmitry Stogov <dmitrystogov@gmail.com>
2026-03-11 15:22:50 +03:00
Gina Peter Banyard
c658d3c787 ext/pgsql: use smart_str_append_double() instead of snprintf call (#21406) 2026-03-11 01:51:53 +00:00
David Carlier
ed887241be Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/soap: Fix wrong cookie options offset calculation, using separator offset instead.
2026-03-10 22:01:03 +00:00
David Carlier
f04873c1b8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/soap: Fix wrong cookie options offset calculation, using separator offset instead.
2026-03-10 21:59:38 +00:00
David Carlier
1b61d555fb ext/soap: Fix wrong cookie options offset calculation, using separator offset instead.
The cookie option parser uses a wrong offset to start scanning
attributes, causing cookie values containing substrings like
"path=" or "domain=" to be falsely matched as attributes.

close GH-21400
2026-03-10 21:58:52 +00:00
Gina Peter Banyard
7f20223143 ext/soap: use zend_string_equals_literal() instead of strcmp() (#21405) 2026-03-10 20:13:05 +00:00
ndossche
9a73c009f3 Merge branch 'PHP-8.5'
* PHP-8.5:
  soap: Fix const violation
2026-03-10 21:08:56 +01:00
ndossche
f33091c972 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  soap: Fix const violation
2026-03-10 21:08:51 +01:00
ndossche
c4c1261196 soap: Fix const violation 2026-03-10 21:06:20 +01:00
ndossche
d3055912b7 Merge branch 'PHP-8.5'
* PHP-8.5:
  soap: Fix const-generic compile warning
2026-03-10 20:52:05 +01:00
ndossche
bc0871dd3d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  soap: Fix const-generic compile warning
2026-03-10 20:52:00 +01:00
ndossche
ae0bf447b4 soap: Fix const-generic compile warning 2026-03-10 20:51:51 +01:00
ndossche
98ededcc6d Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix memory leak in shm_get_var() when variable is corrupted
2026-03-10 20:30:37 +01:00
ndossche
14f0f8650c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leak in shm_get_var() when variable is corrupted
2026-03-10 20:30:31 +01:00
ndossche
ea8aab9220 Fix memory leak in shm_get_var() when variable is corrupted
This path wasn't tested (clearly).
To trigger this we use FFI, which seemed like the easiest way that
doesn't involve using another process messing with the shared memory.

Closes GH-21388.
2026-03-10 20:30:02 +01:00
ndossche
64092352a4 Merge branch 'PHP-8.5'
* PHP-8.5:
  Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
2026-03-10 20:29:14 +01:00
ndossche
3b8aac8dad Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
2026-03-10 20:29:08 +01:00
ndossche
3073948885 Revert "ext/session: Fix memory leak due to multiple exception happening during session abort"
This reverts commit 0acde11945.

The patch is incorrect as described in GH-21200 in the post-merge
comments.
2026-03-10 20:28:47 +01:00
Tim Düsterhus
6e664a04cb reflection: Check against the known string in is_closure_invoke() (#21402)
This can likely succeed by just comparing pointers in a majority of cases.
2026-03-10 20:06:34 +01:00
Tim Düsterhus
f29bc086f1 reflection: Remove _DO_THROW() macro (#21399)
This is an unnecessary layer of indirection that hides the exception type and
does not exist elsewhere (in a similar way).
2026-03-10 08:04:21 +01:00
Weilin Du
da1e89fd3d RFC: Add Form Feed in Trim Functions (#20788)
RFC: https://wiki.php.net/rfc/trim_form_feed

Resolves GH-20783.
2026-03-09 22:28:50 +01:00
ndossche
0155b50984 phar: Fix const-generic compile warnings 2026-03-09 20:45:07 +01:00
Calvin Buckley
d81db0b9de Merge branch 'PHP-8.5'
* PHP-8.5:
  Update NEWS for pcntl fix [skip ci]
  ext/pcntl: Bump num_signals to uint16_t (#21347)
2026-03-09 14:31:32 -03:00
Calvin Buckley
f38058d223 ext/pcntl: Bump num_signals to uint16_t (#21347)
On AIX, NSIG is def'd as SIGMAX64+1, and SIGMAX64 itself is def'd as
255:

```
$ grep -Rw SIGMAX64 /QOpenSys/usr/include/
/QOpenSys/usr/include/sys/signal.h:#define SIGMAX64 255
/QOpenSys/usr/include/sys/signal.h:#define SIGMAX SIGMAX64
/QOpenSys/usr/include/sys/signal.h:#define NSIG64               (SIGMAX64+1)
```

...this causes an overflow when we set num_signals from the value of
NSIG, per GCC:

```
/rpmbuild/BUILD/php-8.5.3/ext/pcntl/pcntl.c:216:25: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  PCNTL_G(num_signals) = NSIG;
                         ^~~~
```

...when we try to use pcntl to i.e. install a signal handler, we get an
error from pcntl:

```
Fatal error: Uncaught ValueError: pcntl_signal(): Argument #1 ($signal) must be less than 0 in phar:///QOpenSys/pkgs/bin/composer/vendor/seld/signal-handler/src/SignalHandler.php:491
```

The easiest way to deal with this silly AIX behaviour is to just promote
the storage size.
2026-03-09 14:29:06 -03:00
David Carlier
148dc1dd66 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
2026-03-09 07:45:20 +00:00
David Carlier
b0470d1669 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
2026-03-09 07:42:53 +00:00
武田 憲太郎
35d98cb6ce ext/pgsql: Fix preprocessor guard typo that silently disabled a feature
Fix `PQTRACE_SUPPRESS_TIMESTAMPS` guard misspelling in pgsql.stub.php.

The guard has been misspelled as `PQTRACE_SUPPPRESS_TIMESTAMPS`
(three P's) since 7ec8ae12c4, preventing the
`PGSQL_TRACE_SUPPRESS_TIMESTAMPS` constant from being registered.

close GH-21386
2026-03-09 07:41:04 +00:00
KentarouTakeda
c56e8caaed ext/pgsql, ext/pdo_pgsql: Remove preprocessor guards for symbols predating libpq 10 (#21384)
While working on php/doc-en#5409 to clean up outdated PostgreSQL
version notes in the documentation, I noticed that the source code
also retains #ifdef guards for symbols guaranteed to exist in
libpq >= 10.0 (the minimum enforced in build/php.m4 via
PQencryptPasswordConn).

Removed guards (all confirmed in PostgreSQL 10 documentation):

- `PG_DIAG_{INTERNAL_POSITION,INTERNAL_QUERY}`: libpq 8.0+
- `PG_DIAG_{SCHEMA,TABLE,COLUMN,DATATYPE,CONSTRAINT}_NAME`: libpq 9.3+
- `PG_DIAG_SEVERITY_NONLOCALIZED`: libpq 9.6+
- `CONNECTION_SSL_STARTUP`: libpq 8.0+
- `CONNECTION_CONSUME`: libpq 10.0+

Refs:
- https://www.postgresql.org/docs/10/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD
- https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-PQCONNECTSTARTPARAMS
- 53e31d5883/build/php.m4 (L1927)
2026-03-08 05:42:50 +00:00
Ilia Alshanetsky
53e31d5883 Fix GH-21362: ReflectionMethod::invoke() allows different Closures (#21366)
ReflectionMethod::invoke() (and invokeArgs()) for Closure::__invoke()
incorrectly accepted any Closure object, not just the one the
ReflectionMethod was created from. This happened because all Closures
share a single zend_ce_closure class entry, so the instanceof_function()
check always passed.

Fix: store the original Closure object in intern->obj during
ReflectionMethod construction, then compare object identity in
reflection_method_invoke() to reject different Closure instances.

Closes GH-21362
2026-03-07 17:19:33 -08:00
Kamil Tekiela
eedbffec2e Empty some values of mysqli_get_charset() (#21361)
* Stop reporting unhelpful values in mysqli_get_charset

* Remove element "comment" as it has been undocumented
2026-03-07 22:09:02 +00:00
Peter Kokot
58acc671db ext/mbstring: Fix deprecation warning (#21363)
This fixes the PHP deprecation warning:

    PHP Deprecated:  Implicit conversion from float 2048.96875 to int
    loses precision in .../ext/mbstring/gen_rare_cp_bitvec.php on line 9
2026-03-07 16:16:59 +01:00
David CARLIER
f830fa9948 Sockets refactoring 2026 (#21365)
ext/sockets: internal refactorings.

- remove redundant memsets and faster socket unix path copy.
- simplify php_open_listen_sock.
- use INADDR_ANY directly instead of resolving via gethostbyname.
- remove redundant memsets in conversions.
2026-03-07 14:09:49 +00:00
Gina Peter Banyard
f2d96c84f0 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/session: Fix memory leak due to multiple exception happening during session abort
2026-03-07 13:30:28 +00:00
Gina Peter Banyard
10e02b0a4a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/session: Fix memory leak due to multiple exception happening during session abort
2026-03-07 13:30:15 +00:00
Gina Peter Banyard
0acde11945 ext/session: Fix memory leak due to multiple exception happening during session abort
Closes GH-21200

Co-authored-by: arshidkv12 <arshidkv12@gmail.com>
2026-03-07 13:28:42 +00:00
ndossche
61fd5ceb68 Merge branch 'PHP-8.5'
* PHP-8.5:
  Update ext/standard/libavifinfo
2026-03-07 11:18:33 +01:00