1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Commit Graph

66540 Commits

Author SHA1 Message Date
Niels Dossche
5eefdbc455 intl: Fix tests for icu update 2025-12-14 22:19:31 +01:00
Niels Dossche
56cbadf468 Fix GHSA-www2-q4fc-65wf 2025-12-14 19:40:16 +01:00
Niels Dossche
3529508a7a Fix GHSA-h96m-rvf9-jgm2 2025-12-14 19:40:12 +01:00
Jakub Zelenka
ecf82e74b6 Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref 2025-12-12 11:55:39 +01:00
David Carlier
08bd4909fe Fix GH-20603 issue on windows 32 bits.
the timeout needed to be unsigned.

close GH-20634

(cherry picked from commit ff51ac161d)
2025-12-12 11:51:33 +01:00
Ilija Tovilo
685bd9de81 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Suppress libxml deprecations
2025-12-02 16:41:37 +01:00
Ilija Tovilo
26b9395ad6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Suppress libxml deprecations
2025-12-02 16:38:08 +01:00
Ilija Tovilo
f7fb13eb07 Suppress libxml deprecations
Closes GH-20538
2025-12-02 16:37:50 +01:00
Daniel Scherzer
c343ede18d Fix GH-20426: fix Spoofchecker::setRestrictionLevel() error (#20427) 2025-12-01 13:37:49 -08:00
Niels Dossche
366ed4c750 Fix GH-20614: SplFixedArray incorrectly handles references in deserialization
All other code caters to dereferencing array elements, except the
unserialize handler. This causes references to be present in the fixed
array even though this seems not intentional as reference assign is
otherwise impossible.
On 8.5+ this causes an assertion failure. On 8.3+ this causes references
to be present where they shouldn't be.

Closes GH-20616.
2025-11-30 10:41:32 +01:00
David Carlier
4312a446d0 Fix GH-20601: ftp_connect() timeout argument overflow.
close GH-20603
2025-11-29 23:05:14 +00:00
David Carlier
c8e13af455 Fix GH-20602: imagescale() overflow with large height values.
close GH-20605
2025-11-29 13:30:49 +00:00
Niels Dossche
8fe7930533 Fix GH-20584: Information Leak of Memory
The string added had uninitialized memory due to
php_read_stream_all_chunks() not moving the buffer position, resulting
in the same data always being overwritten instead of new data being
added to the end of the buffer.

Closes GH-20592.
2025-11-28 18:38:48 +01:00
Niels Dossche
292a7f73ba Fix GH-20583: Stack overflow in http_build_query via deep structures
Closes GH-20590.
2025-11-28 18:38:18 +01:00
Niels Dossche
27f17c3322 Fix GH-20286: use-after-destroy during userland stream_close()
Closes GH-20493.

Co-authored-by: David Carlier <devnexen@gmail.com>
2025-11-23 17:46:28 +01:00
David Carlier
f88d247ce2 Fix GH-20551: imagegammacorrect out of range gamma value.
close GH-20552
2025-11-22 22:22:27 +00:00
Remi Collet
9d71c1e0b6 Fix GH-20528: Regression breaks mysql connexion using an IPv6 address enclosed in square brackets 2025-11-21 09:17:20 +01:00
Niels Dossche
159ef1401c Fix GH-20492: mbstring compile warning due to non-strings
This is a partial backport of ea69276f, but without changing public
headers as that's not allowed at this point.

Closes GH-20494.
2025-11-20 19:17:55 +01:00
Niels Dossche
a1912e3cdd Fix GH-20491: SLES15 compile error with mbstring oniguruma
The issue is specific to SLES15.
Arguably this should be reported to them as it seems to me they meddled
with the oniguruma source code.

The definition in oniguruma.h on that platform looks like this (same as upstream):
```c
ONIG_EXTERN
int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
```

Where `PV_` is defined as (differs):
```c
#ifndef PV_
#ifdef HAVE_STDARG_PROTOTYPES
# define PV_(args) args
#else
# define PV_(args) ()
#endif
#endif
```

So that means that `HAVE_STDARG_PROTOTYPES` is unset.
This can be set if we define `HAVE_STDARG_H`,
which we can do because PHP requires at least C99 in which the header
is always available.
We could also use an autoconf check, but this isn't really necessary as
it will always succeed.
2025-11-20 19:17:17 +01:00
Niels Dossche
8c2407714f libxml: Fix input buffer deprecation
While this fixed the last deprecation in ext/libxml, it's not a full
fix: The full fix would be to move to the context-specific APIs to
override the behaviour. However, that requires API/ABI incompatible
changes so that can't be done on a stable branch.

Closes GH-20525.
2025-11-19 18:41:28 +01:00
Niels Dossche
2f05830a5f zip: Don't truncate return value of zip_fread() with user sizes
The return type has been zip_int64_t since 2009, so we shouldn't
truncate to an int because the user may have requested a size that won't
fit in an int.

Closes GH-20509.
2025-11-18 20:30:42 +01:00
Niels Dossche
6054a900ff libxml: Fix some deprecations regarding input buffer/parser handling
Closes GH-20514.
2025-11-18 18:53:17 +01:00
Niels Dossche
93ce0500aa Fix assertion failures resulting in crashes with stream filter object parameters
This works for dynamic props but not for non-dynamic props due to the
missing INDIRECT handling.

Closes GH-20500.
2025-11-17 18:23:43 +01:00
Niels Dossche
46a15ed439 Fix crash in property existence test in ext/zip
When type == 2, the zval is not initialized, so zval_ptr_dtor() on it
will crash.
Unfortunately couldn't test with property_exists() or Reflection because
they have fast paths that go through the property info, but fortunately
there are paths that don't implement a fast path (e.g. because it
doesn't make sense at that point), like with array_column().
So we use array_column() to trigger the crash.

Closes GH-20496.
2025-11-16 21:28:30 +01:00
Niels Dossche
d9e40372fc Fix assertion failure when fseeking a phar file out of bounds
In 61884c3b52 I added these FIXME comments after I noticed that this
would cause an assertion failure. At that time I did not yet know what
to do here. I took a look at the code now and other streams return -1
and leave the file position untouched. So we do the same for phar.
This fixes the assertion failure and subsequent crashes, but also
changes one test output. However, I believe the new test output is
correct.

Closes GH-20475.
2025-11-15 14:33:33 +01:00
Niels Dossche
2f9d86b677 phar: Fix broken return value of fflush() for phar file entries
The flush functions always return EOF, even in the success path.
The success path should return 0 to indicate success.

Closes GH-20474.
2025-11-15 13:56:06 +01:00
Niels Dossche
48b19a8ede xml: Use safe_emalloc() correctly
Fortunately, libxml won't allow _at this point in time_ to have more
than INT_MAX/5 attributes, so this doesn't cause issues right now.
However, if this limit is ever raised then it can cause an integer
overflow which will cause a heap overflow.
So future-proof this code by properly using safe_emalloc().

Closes GH-20472.
2025-11-15 12:45:28 +01:00
Niels Dossche
8ad5915756 dom: Fix missing NUL byte check on C14NFile()
Closes GH-20466.
2025-11-13 00:03:13 +01:00
Niels Dossche
3cc36b0b5e Fix GH-20439: xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback (#20453)
We would need to escape the attributes, but there's no builtin method
that we can call in libxml2 to do so in a way consistent with the
attribute escape rules and expat.
In fact, expat just repeats the input, while we reconstruct it.
To fix the issue, and fix consistency with expat, we repeat the input as
well. This works by seeking to the start and end of the tag and passing
it to the default handler. This is fine for the parser because the
parser used in ext/xml is always in non-progressive mode, so we have
access to the entire input buffer.
2025-11-11 22:47:15 +01:00
Niels Dossche
4ee25395d5 Fix GH-20442: Phar does not respect case-insensitiveness of __halt_compiler() when reading stub
Functions are case insensitive. The flush code already takes this into
account by checking for the __halt_compiler() symbol in a case
insensitive manner; however the parsing code did not do that yet.

Closes GH-20445.
2025-11-10 22:42:32 +01:00
Niels Dossche
80b731659a Fix memory leak in array_diff() with custom type checks
Closes GH-20428.
2025-11-08 22:41:44 +01:00
Ilija Tovilo
ae01a8adcc Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/pcre/tests: support libpcre2-10.47
2025-11-07 18:53:22 +01:00
Ilija Tovilo
b4e8635f5c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/pcre/tests: support libpcre2-10.47
2025-11-07 18:53:16 +01:00
Michael Orlitzky
bdf62b55bb ext/pcre/tests: support libpcre2-10.47
In the latest version of libpcre2, the offsets appearing in some
"compilation failed" warnings have increased by one, as a result of

  https://github.com/PCRE2Project/pcre2/pull/756

This is causing spurious test failures, so in this commit we replace
the hard-coded offsets by a regex that matches both values.

Gentoo-bug: https://bugs.gentoo.org/965018

Closes GH-20397
2025-11-07 18:52:48 +01:00
Niels Dossche
7c96263cee dom: Fix compile warning due to misplaced const cast 2025-11-06 22:42:03 +01:00
Niels Dossche
d3a4b4b09c Fix crashes when trying to instantiate uninstantiable classes via date static constructors
Closes GH-20361.
2025-11-06 21:21:24 +01:00
Arnaud Le Blanc
b062410d32 Remove CE cache from non-interned file cache strings
Strings loaded from the file cache can not have a CE cache, because their cache
slot is invalid. Remove the IS_STR_CLASS_NAME_MAP_PTR flag from these strings.
We can also avoid updating the str flags in SERIALIZE_STR(), since the same
updates must also be done in UNSERIALIZE_STR().

This was already done for interned strings, but not for non-interned ones.

Fixes GH-20329
Closes GH-20337
2025-11-06 11:20:17 +01:00
Niels Dossche
0584e59734 tidy: Harden against tidyNodeGetText() failure
Either the buffer size or the return value needs to be checked.
From a quick look into the tidy source code, this can't fail right now
for our use case in practice, but it might in the future.

Closes GH-20389.
2025-11-05 20:21:32 +01:00
Ilija Tovilo
4cfc729ac7 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Avoid potential network port conflict in tests
2025-11-05 12:34:14 +01:00
Ilija Tovilo
004a3985e7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Avoid potential network port conflict in tests
2025-11-05 12:34:08 +01:00
Ilija Tovilo
c2f4508198 [skip ci] Avoid potential network port conflict in tests
These tests:

- ext/standard/tests/network/udp4loop.phpt
- ext/sockets/tests/socket_create_listen.phpt
- ext/sockets/tests/socket_create_listen-win32.phpt

all use port 31338. socket_create_listen.phpt and its win32 variant are mutually
exclusive, so they can't conflict. While udp4loop.phpt tries multiple ports, the
other tests do not. If udp4loop.phpt runs first and socket_create_listen.phpt
starts before it ends, the port is still blocked. Bump the start port for
udp4loop.phpt to avoid conflicts.
2025-11-05 12:29:31 +01:00
Niels Dossche
fcc159b4f6 Fix GH-20374: PHP with tidy and custom-tags
Both enums and integers map to TidyInteger, however, in the TidyInteger
case we always used zval_get_long(). So for a non-numeric string, this
would get turned into 0. 0 is the first enum value in that case, so the
wrong enum value could be selected.

To solve this, add special handling for strings and (stringable) objects
such that we can explicitly check for numeric strings, and if they're
not, handle them as normal strings instead of as 0.

Closes GH-20387.
2025-11-04 20:00:22 +01:00
Niels Dossche
04323955c1 pgsql: Fix memory leak when object init fails (#20387)
The return value is already overwritten by this point so we do have to
clean up the old return value (i.e. dataset) after all.
2025-11-04 19:59:38 +01:00
Niels Dossche
720e006982 random: Fix memory leak when serialization fails (#20383)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2025-11-04 08:32:22 +01:00
Gina Peter Banyard
94dc6ae871 ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
Also fix Windows CI with Postgres and CLEAN sections

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-11-04 00:04:30 +00:00
David Carlier
55f7303d73 ext/zip: fix memory leak when encryption is passed as userland array option.
Similar issue fixed in GH-19936.

close GH-20363
2025-11-02 21:15:07 +00:00
Niels Dossche
be8c8a9d6b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update zlib test to use separate file for flock()
2025-11-01 09:30:04 +01:00
Niels Dossche
df423e4f08 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update zlib test to use separate file for flock()
2025-11-01 09:29:55 +01:00
Niels Dossche
c3d6bf65d5 Update zlib test to use separate file for flock()
This should prevent the nightly failures that fail with permission
denied on platforms with mandatory locks.

Closes GH-20351.
2025-11-01 09:29:45 +01:00
Niels Dossche
6fe40de6e3 Fix GH-20302: Freeing a phar alias may invalidate PharFileInfo objects
Closes GH-20345.
2025-10-31 08:04:25 +01:00