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

17931 Commits

Author SHA1 Message Date
ndossche
8f9a8c00e7 Fix GH-21421: SoapClient typemap property breaks engine assumptions
The conversion away from resources introduced the contents of the
typemap property, which internally uses IS_PTR zvals.
These should never be exposed because to userland they break engine
assumptions. To solve this, we hide this in an internal field.
We also disable cloning in the process which is broken in most cases
because it doesn't clone internal data.

Closes GH-21422.
2026-03-23 22:07:45 +01:00
ndossche
614b22ab46 Add array size maximum to array_diff()
This silences some reports about the equivalence to array_merge()'s
issue. However, this is different as no packed fill is used in this
code, so it doesn't have the same bug that array_merge() had.

Closes GH-21449.
2026-03-21 10:20:11 +01:00
Ilija Tovilo
0039af028c Propagate bind error for stream_socket_server()
When stream_socket_server() fails during bind(), we're currently only showing
"Unknown error" in the error message. Properly propagate this error for better
diagnostics.

Closes GH-21328
2026-03-16 08:53:38 +01:00
Tim Starling
605c0756c9 ext/zip: add ZipArchive::openString() method
Fixes to GH-14078:

* Rename ZipArchive::openBuffer() to ::openString().
* For consistency with ::open(), return int|bool, don't throw an
  exception on error. Provide error information via existing properties
  and accessors.
* Fix memory leak when ::openString() is called but ::close() is not
  called. Add test.
* Fix memory leak when a call to ::open() is followed by a call to
  ::openString(). Add test.
* Let libzip own the source, don't call zip_source_keep().
* Share buffer handling with ZipArchive::addFromString().

Elsewhere:

* If there is an error from zip_close() during a call to
  ZipArchive::open(), emit a warning but proceed to open the archive,
  don't return early. Add test.
* When buffers are saved by ZipArchive::addFromString(), release them
  in ZipArchive::close() and ::open(), don't accumulate buffers until
  the free_obj handler is called.
* Factor out buffer handling and reuse it in ZipArchive::openString()

Closes GH-21205.
Closes GH-14078.

Co-authored-by: Soner Sayakci <s.sayakci@shopware.com>
Co-authored-by: Ghaith Olabi <24876890+Gaitholabi@users.noreply.github.com>
2026-03-14 15:03:36 +01:00
武田 憲太郎
31962aa086 ext/pgsql: Enable lo_tell64/lo_truncate64 by removing dead VE_PG_LO64 guards
The guards reference undefined VE_PG_LO64, a misspelling of
HAVE_PG_LO64 (removed in GH-14628), making the 64-bit code paths
permanently dead. Remove the guards to unconditionally enable the
64-bit variants for PostgreSQL >= 9.3, consistent with pg_lo_seek().

Dropped from GH-21386 as not suitable for backport.

close GH-21437
2026-03-14 05:22:43 +00:00
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
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
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
tekimen
7a1c2612c0 [RFC] Add grapheme_strrev function (#20949)
* [RFC] Add grapheme_strrev function

Add more tests Arabic for grapheme_strrev function.
2026-03-04 09:47:26 +09:00
Nora Dossche
84b0a73685 Fix GH-13204: glob() fails if square bracket is in current directory (#19647)
The problem is not limited to square brackets, but to every meta
character. The solution is to override the glob functions for handling
paths with the VCWD ones in PHP. If that is not available, use the old
but limited workaround.
2026-03-03 22:29:07 +01:00
Ilija Tovilo
be6038a35e [skip ci] Also add ReflectionProperty::is{Readable,Writable}() to NEWS
Also fix typo (missing and), and align message with rest of the doc.
2026-02-27 15:46:48 +01:00
Frank Denis
8a907a9bd8 ext/sodium: Add support for libsodium 1.0.21 APIs (#20960)
Add support for new functions present in recent libsodium versions:

- Functions for IP address encryption:
  - sodium_crypto_ipcrypt_*
  - sodium_bin2ip/sodium_ip2bin helpers

- Extendable output functions:
  - SHAKE128/SHAKE256
  - TurboSHAKE128/TurboSHAKE256
2026-02-27 13:11:24 +01:00
Khaled Alam
0b4fbf2e70 ext/reflection: Add ReflectionConstant::inNamespace() method (#20902) 2026-02-16 21:28:32 -08:00
Alex Dowad
115ea486ac Merge branch 'PHP-8.5' 2026-02-17 06:51:21 +09:00
Alex Dowad
e106d688c2 Merge branch 'PHP-8.4' into PHP-8.5 2026-02-17 06:48:37 +09:00
Jordi Kroon
37c5a13d67 replace alloca with do_alloca in mb_guess_encoding_for_strings
This avoids a crash in cases where the list of candidate encodings is so huge
that alloca would fail. Such crashes have been observed when the list of
encodings was larger than around 208,000 entries.
2026-02-17 06:46:42 +09:00
David Carlier
b3c259c13c Revert "ext/posix: validate permissions argument in posix_mkfifo()"
This reverts commit 6bd97e72b7.
2026-02-16 17:49:37 +00:00
Arnaud Le Blanc
6f32a4a7df Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix build with -std=
2026-02-16 14:52:27 +01:00
Arnaud Le Blanc
ede7c67389 Fix build with -std=
When building in strict mode (e.g. -std=c11), compilation of
main/debug_gdb_scripts.c fails because asm() is not a standard top level
statement. __asm__() however can be reserved by the compiler even in strict
mode.

Partially fixes GH-21215. IR needs a similar fix (dstogov/ir#128).
Closes GH-21226.
2026-02-16 14:48:48 +01:00
Gina Peter Banyard
45029f33be Update NEWS and UPGRADING for ext/session changes 2026-02-16 11:51:48 +00:00
David Carlier
b6495c189a ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
we just mirror what is done for socket_connect()/AF_UNIX type.

close GH-21218
2026-02-15 21:54:19 +00:00
David Carlier
539c5d9f76 Fix GH-21162: pg_connect() on error memory leak.
The PHP_PQ_ERROR macro calls php_error_docref() which triggers user error handlers
thus libpq does not have the chance to clean the resources (and empty
connections string are allowed) on failure thus we avoid this macro
and delay the error handling after.

close GH-21165
2026-02-15 21:26:23 +00:00
Tim Düsterhus
ad83353a3d Fix line wrapping in NEWS/UPGRADING/UPGRADING.INTERNALS 2026-02-09 22:45:09 +01:00
David Carlier
19ee3e6697 Fix GH-21161: socket_set_option() crash with array 'addr' entry as null.
in the ipv6 address creation helper we need to use, for the error
message, the converted data rather than assuming the original
is a proper zend_string().

close GH-21166
2026-02-09 19:26:48 +00:00
Ilija Tovilo
81de7b964f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Improve shared_alloc_shm.c strategy to support OPcache JIT on Solaris
2026-02-09 14:58:57 +01:00
Petr Sumbera
7c6f08945f Improve shared_alloc_shm.c strategy to support OPcache JIT on Solaris
The SysV shared memory allocator in OPcache hardcodes a maximum segment size of
32MB (SEG_ALLOC_SIZE_MAX). If the JIT buffer exceeds this, which it does with
the default 64MB size, startup will fail with "Insufficient shared memory!".

The allocator will now try allocating a contiguous buffer first, and only then
use segmentation by searching for continuously smaller powers of 2.

Fixes GH-20718
Closes GH-20719
2026-02-09 14:58:13 +01:00
arshidkv12
6bd97e72b7 ext/posix: validate permissions argument in posix_mkfifo()
close GH-21102
2026-02-06 12:51:18 +00:00
arshidkv12
fdaa488144 ext/posix: validity check for flags argument in posix_access
close GH-21104
2026-02-06 05:51:28 +00:00
ndossche
e76044aa0b Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix timezone offset with seconds losing precision
2026-02-05 18:39:18 +01:00
Niels Dossche
ee26417b58 Fix timezone offset with seconds losing precision
There are two issues:
1. The 'e' formatter doesn't output the seconds of the timezone even if
   it has seconds.
2. var_dump(), (array) cast, serialization, ... don't include the
   timezone second offset in the output. This means that, for example,
   serializing and then unserializing a date object loses the seconds of
   the timezone. This can be observed by comparing the output of
   getTimezone() for `$dt` vs the unserialized object in the provided test.

Closes GH-20764.
2026-02-05 18:38:54 +01:00
Ilija Tovilo
f9df448bab Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix assign-op/inc/dec on untyped hooked property backing value
2026-02-05 14:48:15 +01:00
Ilija Tovilo
3cb85cc681 Fix assign-op/inc/dec on untyped hooked property backing value
Fixes OSS-Fuzz #478009707
Closes GH-21124
2026-02-05 14:46:06 +01:00
ndossche
34a341e59f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
2026-02-04 18:35:29 +01:00
Niels Dossche
7445b0f6d9 Fix GH-20936: DatePeriod::__set_state() cannot handle null start
The "current" and "end" field also rely on start_ce, which is set by
"start". Therefore, if "current" or "end" are provided, so must "start"
be provided.

Closes GH-20939.
2026-02-04 18:34:38 +01:00
Niels Dossche
52eb174ba6 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21097: Accessing Dom\Node properties can can throw TypeError(s)
2026-02-03 18:40:54 +01:00
Niels Dossche
b8fc6bd1c8 Fix GH-21097: Accessing Dom\Node properties can can throw TypeError(s)
Split the handler again, or defer to instanceof when performance doesn't
matter.

Closes GH-21108.
2026-02-03 18:36:28 +01:00
Arnaud Le Blanc
4a1cca7ddc Revert lazy proxy state after failed initialization
We don't expect the lazy proxy to be modified during initialization, but
this is allowed. The modification may set a property, still marked LAZY,
without removing the LAZY flag. This causes an assertion failure in GH-20174.

Both the RFC and the documentation specify that after an initialization
failure, the state of the object is reset to its pre-initialization state:

    If the initializer throws an exception, the object state is reverted to
    its pre-initialization state and the object is marked as lazy again. In
    other words, all effects on the object itself are reverted. Other side
    effects, such as effects on other objects, are not reverted. This prevents
    exposing a partially initialized instance in case of failure.

This behavior would have prevented this issue, but it was not implemented
for lazy proxies (only for ghosts).

Fix by implementing the missing behavior.

Fixes GH-20174
Closes GH-20181
2026-02-03 12:12:03 +01:00
Arnaud Le Blanc
83056c806c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Real instance of lazy proxy may have less magic methods
2026-02-03 12:05:11 +01:00
Arnaud Le Blanc
de26827275 Real instance of lazy proxy may have less magic methods
In GH-18039 we guard the underlying property before forwarding access
to the real instance of a lazy proxy. When the real instance lacks magic
methods, the assertion zobj->ce->ce_flags & ZEND_ACC_USE_GUARDS fails in
zend_get_property_guard().

Fix by checking that the real instance uses guards.

Fixes GH-20504
Closes GH-21093
2026-02-03 12:04:35 +01:00
Arnaud Le Blanc
1e81a9efc7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Mark object non-lazy before deleting info in zend_lazy_object_realize()
2026-02-03 11:50:32 +01:00
Arnaud Le Blanc
6d6d013d79 Mark object non-lazy before deleting info in zend_lazy_object_realize()
A lazy object is marked non-lazy when all its properties are
initialized. Before doing so we delete the object info, resulting in a
temporarily invalid state. In GH-20657 the GC is triggered at this moment.

Fix by deleting the object info _after_ marking it non lazy.

Fixes GH-20657
Closes GH-21094
2026-02-03 11:48:36 +01:00
Niels Dossche
d54e5106b0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
2026-01-30 18:14:19 +01:00
Niels Dossche
d73b2f782e Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
Prior to this patch there was a common read handler, and it relied on
the dom class set in the intern document. However, Dom\Implementation
allows creating DTDs unassociated with a document, so we can't rely on
an intern document and the check fails. This causes the ZVAL_NULL() path
to be taken.
To solve this, just split the handler.

Closes GH-21082.
2026-01-30 18:13:55 +01:00
Alexandre Daubois
e4935cf601 Merge branch 'PHP-8.5'
* PHP-8.5:
  Core: fix missing deprecation when accessing null array key with JIT (#20883)
2026-01-30 16:19:57 +01:00
Alexandre Daubois
4a6e6077ef Core: fix missing deprecation when accessing null array key with JIT (#20883) 2026-01-30 16:18:33 +01:00
David Carlier
b156471a30 Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
we check the FCC is properly initialised beforehand in its handler.

close GH-21025
2026-01-30 13:09:44 +00:00
David CARLIER
ce798afac3 Fix GH-21058: error_log() crash on null destination argument. (#21064)
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex
handling the null path and propagating the exception.

close GH-21064
2026-01-29 19:49:45 +00:00
arshidkv12
e9ae040629 Fix crash on (unset) cast in constant expression
Fixes GH-21072
Closes GH-21073
2026-01-29 17:00:06 +01:00
Ilija Tovilo
2f2b421a48 Fix segfault when preloading constant AST closure
Fixes GH-21059
Closes GH-21071
2026-01-29 13:30:41 +01:00
Tim Düsterhus
59433f8d3e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Zend/zend_call_stack.h: fix missing include on Windows (clang compat) (#20847)
2026-01-29 10:38:52 +01:00