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

273 Commits

Author SHA1 Message Date
Alexandre Daubois
5ae8125993 Fix GH-16993: Fix filter_var_array to warn when validation filters are incorrectly combined with FILTER_NULL_ON_FAILURE flag (#19660) 2025-09-08 14:50:09 +02:00
Daniel Scherzer
0b326dcbab [RFC] FILTER_THROW_ON_FAILURE (#18896)
https://wiki.php.net/rfc/filter_throw_on_failure
2025-08-26 03:16:39 -07:00
Máté Kocsis
1cff1815d0 Add internal URI handling API (#19073)
Part of https://github.com/php/php-src/pull/14461. Related to https://wiki.php.net/rfc/url_parsing_api.
2025-08-19 18:35:09 +02:00
DanielEScherzer
171501b93f Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
Gina Peter Banyard
67bbf9c961 ext/filter: Remove ZPP test 2025-06-23 13:58:10 +02:00
Niels Dossche
3ba725a556 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:42 +02:00
Niels Dossche
a019fbd970 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:12 +02:00
Niels Dossche
8849a5336e Fix GH-18309: ipv6 filter integer overflow
The intermediate computation can cause a signed integer overflow, but
the input is correctly rejected later on by the check on variable `n`.
Solve this by using an unsigned number.

Closes GH-18312.
2025-04-11 23:35:00 +02:00
Derick Rethans
2e1d6785d5 Merge branch 'PHP-8.4' 2024-12-18 11:39:06 +00:00
Derick Rethans
c5469fa361 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-18 11:39:01 +00:00
Derick Rethans
3b154eb88c Consistent naming for test titles 2024-12-18 11:38:44 +00:00
Derick Rethans
e54c9e6cd3 Per RFC 6890, these are explicitly not reserved ranges 2024-12-18 11:38:44 +00:00
Derick Rethans
d25aac29ce Fixed GH-16944: Refactor IP ranges by using the tables from RFC 6890 2024-12-18 11:38:43 +00:00
Derick Rethans
f2fdcfc8c3 These were 6bone experimental network allocations, which have been returned to IANA (RFC 3701) 2024-12-18 11:27:04 +00:00
DanielEScherzer
aeb2d5cfa6 ext/[ef]*: fix a bunch of typos (GH-16621) 2024-10-28 11:28:32 +01:00
Christoph M. Becker
6715860286 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:22:26 +02:00
Christoph M. Becker
7930867e28 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:21:02 +02:00
Christoph M. Becker
f9ce5e79da Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
Domain name labels must not end with a hyphen, and that is also true
for the last label.  Apparently, this has been overlooked so far.

Closes GH-16540.
2024-10-21 21:19:54 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Ben Ramsey
bda372fc6c Merge branch 'PHP-8.3' 2024-06-05 01:11:59 -05:00
Ben Ramsey
e4453dcbd2 Merge branch 'PHP-8.2' into PHP-8.3 2024-06-05 01:11:30 -05:00
Ben Ramsey
8aff5b49c3 Merge branch 'PHP-8.1' into PHP-8.2 2024-06-05 01:10:47 -05:00
Niels Dossche
7e0e3cc820 Fix GHSA-w8qr-v226-r27w
We should not early-out with success status if we found an ipv6
hostname, we should keep checking the rest of the conditions.
Because integrating the if-check of the ipv6 hostname in the
"Validate domain" if-check made the code hard to read, I extracted the
condition out to a separate function. This also required to make
a few pointers const in order to have some clean code.
2024-06-05 00:31:17 -05:00
Juan Morales
c96b975f67 filter_input_array - Implement solution 2 of GH-13805 (#13804) 2024-04-07 00:18:12 +02:00
Peter Kokot
8d5fc8d23f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:44 +01:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
Ilija Tovilo
b169725757 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:44 +02:00
Ilija Tovilo
85ceb91789 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:10 +02:00
Ilija Tovilo
c2fb10d2d2 Fix filter_var with callback and explicit REQUIRE_SCALAR
For some reason, FILTER_CALLBACK disables the FILTER_REQUIRE_SCALAR flag that is
normally set by default. While surprising, this is not something we can change.

However, even specifying FILTER_REQUIRE_SCALAR explicitly does not corrently set
this flag. This is because FILTER_CALLBACK zeroes the flags after they have been
populated from the parameters.

We reverse the checks to make explicitly specifying the flag behave as expected.

Closes GH-12203
2023-09-14 11:48:40 +02:00
George Peter Banyard
a123ce9dd4 Merge branch 'PHP-8.2'
* PHP-8.2:
  Add missing EXTENSION section to tests
2022-10-27 14:42:40 +01:00
George Peter Banyard
a27ae67c0f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing EXTENSION section to tests
2022-10-27 14:42:17 +01:00
George Peter Banyard
a4acba9e52 Add missing EXTENSION section to tests 2022-10-27 14:39:43 +01:00
juan-morales
fca9e23a6f QA - filter_input - LCOV - FILTER_NULL_ON_FAILURE
Closes GH-9737.
2022-10-13 13:59:48 +02:00
root
d8fc05c05e Add FILTER_FLAG_GLOBAL_RANGE to filter Global IPs as per RFC 6890 2022-07-18 17:56:05 +01:00
Stanislav Malyshev
414d5620b0 Merge branch 'PHP-8.0' into PHP-8.1 2022-02-13 21:58:24 -08:00
Christoph M. Becker
82f1bf1b6b Fix #81708: UAF due to php_filter_float() failing for ints
We must only release the zval, if we actually assign a new zval.
2022-02-13 21:56:39 -08:00
Christoph M. Becker
a000af6ecc Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix FILTER_FLAG_NO_RES_RANGE flag
2021-12-19 16:25:54 +01:00
Yifan Tong
3587e13ab3 Fix FILTER_FLAG_NO_RES_RANGE flag
`2001:10::/28` is a reserved IPv6 range. But there's a typo in GH-7476,
which caused IPv6 address like `240b:0010::1` will be filtered by the
flag `FILTER_FLAG_NO_RES_RANGE`.

http://www.faqs.org/rfcs/rfc6890.html

Closes GH-7790.
2021-12-19 16:24:34 +01:00
Christoph M. Becker
1dcc0ff5f6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #61700: FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing
2021-09-20 17:45:34 +02:00
Christoph M. Becker
fbc922d55c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #61700: FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing
2021-09-20 17:39:22 +02:00
Christoph M. Becker
288c25f7d1 Fix #61700: FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing
It makes no sense to compare IPv6 address ranges as strings; there are
too many different representation possibilities.  Instead, we change
`_php_filter_validate_ipv6()` so that it can calculate the IP address
as integer array.  We do not rely on `inet_pton()` which may not be
available everywhere, at least IPv6 support may not, but rather parse
the IP address manually.  Finally, we compare the integers.

Note that this patch does not fix what we consider as reserved and
private, respectively, but merely tries to keep what we had so far.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-7476.
2021-09-20 17:38:05 +02:00
Nikita Popov
aa733e8ac8 Deprecate filter.default
There's a subtlety here regarding filter.default_flags. The RFC
stated that no separate deprecation warning will be emitted for
it, on the premise that it is only meaningful if filter.default
is set. However, it turns out that even FILTER_UNSAFE_RAW (which
is the "no-op filter") can be combined with stripping flags.
However, this is compensated by the fact that this doesn't actually
work when setting filter.default=unsafe_raw and non-default
filter.default_flags -- the flags are simply ignored in that case.
So everything works out in the end.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-12 09:33:08 +02:00
Nikita Popov
bf94010b4b Deprecate FILTER_SANITIZE_STRING/STRIPPED
Deprecate the FILTER_SANITIZE_STRING and FILTER_SANITIZE_STRIPPED
filters.

This is part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:46:59 +02:00
Stanislav Malyshev
d72e82bfc0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:40:02 -07:00
Stanislav Malyshev
892674ef70 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:39:23 -07:00
Stanislav Malyshev
2327e3d36a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:36:55 -07:00
Christoph M. Becker
a5538c6229 Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
We need to ensure that the password detected by parse_url() is actually
a valid password; we can re-use is_userinfo_valid() for that.
2021-06-20 21:49:49 -07:00
Nikita Popov
6600ad6067 Add some missing EXTENSIONS sections to misc tests 2021-06-14 14:52:44 +02:00
Nikita Popov
39131219e8 Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
e0dc84d3f6 Fix test file name
There's some kind of special characters at the end of the name
2021-06-11 11:58:00 +02:00