Commit Graph

63636 Commits

Author SHA1 Message Date
Niels Dossche
509906b2a5 Fix GH-11438: mysqlnd fails to authenticate with sha256_password accounts using passwords longer than 19 characters
https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html
tells us that the nonce used in this authentication method is 20 bytes
long. However, we might receive additional scramble data in
php_mysqlnd_greet_read not used in this method.
On my test setup, I received 21 bytes (20 bytes + '\0'). This resulted
in the xor computation to incorrectly include the NUL byte. Every
password of at least 20 characters therefore failed to authenticate
using this method.

Looking at mysql-server source code also seems to reveal that it always
uses a fixed number of scramble bytes [1].

[1] ea7087d885/sql/auth/sha2_password.cc (L1078-L1079)

Closes GH-11445.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2023-08-03 20:28:11 +02:00
Derick Rethans
a8f4171655 Fixed bug GH-11854 (DateTime:createFromFormat stopped parsing datetime with extra space) 2023-08-03 09:52:34 +01:00
Derick Rethans
851890bd9c Import timelib 2022.09 2023-08-03 09:42:31 +01:00
Niels Dossche
139a69261f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11440: authentication to a sha256_password account fails over SSL
2023-08-02 20:33:24 +02:00
nielsdos
94127c53aa Fix GH-11440: authentication to a sha256_password account fails over SSL
This is similar to bug #78680, but that bug wasn't really fixed in all
places. This is the only remaining place.

Closes GH-11444.
2023-08-02 20:30:49 +02:00
Niels Dossche
82eda28616 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix json_encode result on DOMDocument
2023-08-01 17:31:55 +02:00
Niels Dossche
6e468bbd3b Fix json_encode result on DOMDocument
According to https://www.php.net/manual/en/class.domdocument:
  When using json_encode() on a DOMDocument object the result will be
  that of encoding an empty object.

But this was broken in 8.1. The output was `{"config": null}`.
That's because the config property is defined with a default value of
NULL, hence it was included. The other properties are not included
because they don't have a default property, and nothing is ever written
to their backing field. Hence, the JSON encoder excludes them.
Similarly, `(array) $doc` would yield the same `config` key in the
array.

Closes GH-11840.
2023-08-01 17:28:51 +02:00
Ilija Tovilo
e14421cd73
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix zend/test arginfo stub hash
2023-08-01 11:41:46 +02:00
Ilija Tovilo
e61dbe54e9
Fix zend/test arginfo stub hash 2023-08-01 11:41:13 +02:00
Ben Ramsey
7ecb284926
Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 20:06:37 -05:00
Ben Ramsey
ebbccb3dc6
Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 20:01:03 -05:00
Niels Dossche
62228a2568
Disable global state test on Windows
It looks like the config.w32 uses CHECK_HEADER_ADD_INCLUDE to add the include
path to libxml into the search path.
That doesn't happen in zend-test.
To add to the Windows trouble, libxml is statically linked in, ext/libxml can
only be built statically but ext/zend-test can be built both statically and
dynamically.
So the regression tests won't work in all possible configurations anyway on Windows.
All of this is no problem on Linux because it just uses dynamic linking
and pkg-config, without any magic.

Signed-off-by: Ben Ramsey <ramsey@php.net>
2023-07-31 19:55:10 -05:00
Derick Rethans
855dd2767a Fixed another broken merge (sorry) 2023-07-31 20:24:20 +01:00
Derick Rethans
dcc429557d Fixed artifacts from merging 2023-07-31 20:08:45 +01:00
Derick Rethans
47a347e8b0 Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 20:05:20 +01:00
Derick Rethans
93b43ac238 Fix broken merge 2023-07-31 20:05:12 +01:00
Derick Rethans
deddf4692a Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 19:54:44 +01:00
Derick Rethans
0870ebb862 Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 19:53:43 +01:00
Niels Dossche
c283c3ab0b Sanitize libxml2 globals before parsing
Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().
2023-07-31 19:47:19 +01:00
Niels Dossche
80316123f3 Fix buffer mismanagement in phar_dir_read()
Fixes GHSA-jqcx-ccgc-xwhv.
2023-07-31 19:47:05 +01:00
Ilija Tovilo
f2328302b6
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Check if restart is pending before trying to lock SHM
2023-07-31 20:00:49 +02:00
Mikhail Galanin
3e9792f4a2
Check if restart is pending before trying to lock SHM
This reduces lock contention when Opcache restart is scheduled
but not yet started.

Closes GH-11805
2023-07-31 20:00:31 +02:00
Dmitry Stogov
91dc3e15e9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect QM_ASSIGN elimination
2023-07-31 14:51:06 +03:00
Dmitry Stogov
b5f8a7270a Fixed incorrect QM_ASSIGN elimination
Fixes OSS Fuzz #60895
2023-07-31 14:50:13 +03:00
Ilija Tovilo
5d90c5057d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Replace xfail with skipif in calendar_clear_variation1.phpt
2023-07-27 12:30:27 +02:00
Ilija Tovilo
6b6a5cd28e
Replace xfail with skipif in calendar_clear_variation1.phpt
Fixes GH-11128
Closes GH-11801
2023-07-27 12:29:49 +02:00
Niels Dossche
9a358b2842 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix DOM test
2023-07-26 18:05:51 +02:00
Niels Dossche
bed0e54104 Fix DOM test 2023-07-26 18:05:24 +02:00
Niels Dossche
86580c6624 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone
2023-07-26 17:23:45 +02:00
Niels Dossche
bf4e7bd3ed Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone
At one point this was changed from a bool to an int in libxml2, with
negative values meaning it is unspecified. Because it is cast to a bool
this therefore returned true instead of the expected false.

Closes GH-11793.
2023-07-26 17:20:10 +02:00
Niels Dossche
e76b62bcb2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix empty argument cases for DOMParentNode methods
  Fix DOMCharacterData::replaceWith() with itself
  Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS()
  Fix DOMEntity field getter bugs
2023-07-24 19:01:22 +02:00
Niels Dossche
abb1d2e824 Fix empty argument cases for DOMParentNode methods
Closes GH-11768.
2023-07-24 18:58:39 +02:00
Niels Dossche
1cf2d216a2 Fix DOMCharacterData::replaceWith() with itself
Previously, when replacing the node with itself (or contained within
itself), the node disappeared.

Closes GH-11770.
2023-07-24 18:58:17 +02:00
Niels Dossche
168bc8146f Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS()
Closes GH-11776.
2023-07-24 18:57:16 +02:00
Niels Dossche
d439ee18ed Fix DOMEntity field getter bugs
- publicId could crash PHP if none was provided
- notationName never worked

The fields of this classs were untested. This new test file changes that.

Closes GH-11779.
2023-07-24 18:55:51 +02:00
Dmitry Stogov
d6a795b935 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect QM_ASSIGN elimination
2023-07-24 15:43:21 +03:00
Dmitry Stogov
9fc0eab4b4 Fixed incorrect QM_ASSIGN elimination
Fixes OSS Fuzz #60735
2023-07-24 15:42:30 +03:00
Niels Dossche
31bd62865f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Prevent int overflow on $decimals in number_format
2023-07-21 13:51:04 +02:00
Marc Bennewitz
429f20e981 Prevent int overflow on $decimals in number_format
Closes GH-11714.
Closes GH-11649.
2023-07-21 13:50:18 +02:00
Niels Dossche
404f1d3700 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
2023-07-21 13:09:44 +02:00
Niels Dossche
ee3f932390 Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
There are a couple of oddities.

1) The interned strings buffer comprises the whole hashtable
   datastructure.
   Therefore, it seems that the interned strings buffer size is the size of
   only said table. However, in the current code it also includes the size
   of the zend_accel_shared_globals.

2) ZCSG(interned_strings).end is computed starting from the accelerator
   globals struct itself. I would expect it to start from the part where
   the interned strings table starts.

3) When computing the used size, it is done using
   ZCSG(interned_strings).end - ZCSG(interned_strings).start. However,
   this does not include the uin32_t slots array because
   ZCSG(interned_strings).start pointers after that array.

This patch corrrects these 3 points.

Closes GH-11717.
2023-07-21 13:04:53 +02:00
Ilija Tovilo
88fab26365
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix leaking definitions on FFI::cdef()->new()
2023-07-21 10:42:42 +02:00
Ilija Tovilo
11d6bea98a
Fix leaking definitions on FFI::cdef()->new()
Previously, FFI_G(symbols) and FFI_G(tags) were never cleaned up when calling
new on an existing object. However, if cdef() is called without parameters these
globals are NULL and might be created when new() creates new definitions. These
would then be discarded without freeing them.

Closes GH-11751
2023-07-21 10:42:19 +02:00
Ilija Tovilo
e8c9c73118
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix hash_pbkdf2 options parameter
2023-07-18 19:23:10 +02:00
Ilija Tovilo
7cae6eb8db
Fix hash_pbkdf2 options parameter
The value needs to be initialized to NULL as it is optional. Furthermore, the
parameter was completely missing in the stub signature.

Closes GH-11731
2023-07-18 19:21:13 +02:00
Niels Dossche
8b1d352ed8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Prevent potential deadlock if accelerated globals cannot be allocated
2023-07-17 13:00:00 +02:00
Niels Dossche
b0bc057e86 Prevent potential deadlock if accelerated globals cannot be allocated
Not sure if this is possible to hit in practice, zend_accel_error_noreturn
doesn't return so the unlock isn't called. Other callsites that use both
zend_accel_error_noreturn and zend_shared_alloc_unlock first perform the
unlocking.

Closes GH-11718.
2023-07-17 12:49:15 +02:00
George Peter Banyard
5f716bf2df
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
2023-07-17 07:09:34 +01:00
SakiTakamachi
e0aadc1c0d
Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
This also includes a fix for the MySQL ND driver to actually respect the user decided behaviour.

Closes GH-11622

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-07-17 07:08:45 +01:00
Niels Dossche
f2ed2b877d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle fragments consisting out of multiple children without a single root correctly
2023-07-13 16:12:35 +02:00
Niels Dossche
5c26258eeb Handle fragments consisting out of multiple children without a single root correctly
Closes GH-11698.
2023-07-13 16:09:04 +02:00
George Peter Banyard
1e41b0f1a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/intl: Fix memory leak in MessageFormatter::format()
2023-07-12 15:44:41 +01:00
George Peter Banyard
536dbd74fa
ext/intl: Fix memory leak in MessageFormatter::format()
Closes GH-11658
2023-07-12 15:43:45 +01:00
Ilija Tovilo
57229836d4
Fix bug-gh11600.phpt 2023-07-12 14:54:56 +02:00
Ilija Tovilo
892704267c
[skip ci] Mark bug-gh11600 as xfail 2023-07-12 14:08:28 +02:00
Niels Dossche
9c47f33a5f Fix bug-gh11600.phpt to work with different ICU versions 2023-07-12 10:35:59 +02:00
Niels Dossche
3552a1be97 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add regression test for GH-11682
2023-07-11 23:07:17 +02:00
Niels Dossche
48b246e038 Add regression test for GH-11682
This bug was already fixed via 15ff830, but we really need more
test coverage.

Co-authored-by: Arne Blankerts <arne@blankerts.de>
2023-07-11 23:02:01 +02:00
Niels Dossche
832a3d193f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10914: OPCache with Enum and Callback functions results in segmentation fault
2023-07-11 17:40:21 +02:00
Niels Dossche
bc42179133 Fix GH-10914: OPCache with Enum and Callback functions results in segmentation fault
See linked issue for analysis.

Closes GH-11675.
2023-07-11 17:38:09 +02:00
Derick Rethans
a4bdaeabf6 Fix bug GH-11600: Can't parse time strings which include (narrow) non-breaking space characters 2023-07-11 16:29:04 +01:00
Derick Rethans
c02ac26685 Import timelib 2022.08 2023-07-11 16:27:15 +01:00
Niels Dossche
47b7570f07 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix tests for stat rdev
2023-07-11 13:57:28 +02:00
Niels Dossche
6b87e08b82 Fix tests for stat rdev
If HAVE_STRUCT_STAT_ST_RDEV is not set, rdev will be -1. %d only matches
a natural number, we should let it match negative numbers too.
2023-07-11 13:57:17 +02:00
Niels Dossche
57ff1c354e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11630: proc_nice_basic.phpt only works at certain nice levels
  Fix GH-11629: bug77020.phpt tries to send mail
  Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
2023-07-10 13:34:21 +02:00
Niels Dossche
c408a8b604 Fix GH-11630: proc_nice_basic.phpt only works at certain nice levels
Closes GH-11635.
2023-07-10 13:30:00 +02:00
Niels Dossche
06d87e4c14 Fix GH-11629: bug77020.phpt tries to send mail
Closes GH-11636.
2023-07-10 13:29:49 +02:00
Niels Dossche
15ff830373 Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
Depending on the libxml2 version, the behaviour is either to not
render the fragment correctly, or to wrap it inside <></>. Fix it by
unpacking fragments manually. This has the side effect that we need to
move the unlinking check in the replacement function to earlier because
the empty child list is now possible in non-error cases.
Also fixes a mistake in the linked list management.

Closes GH-11627.
2023-07-10 13:29:31 +02:00
Niels Dossche
3ee2ade917 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing check on EVP_VerifyUpdate() in phar util
2023-07-09 22:55:01 +02:00
Niels Dossche
0d07b6d647 Add missing check on EVP_VerifyUpdate() in phar util
Closes GH-11640.
2023-07-09 22:54:27 +02:00
Niels Dossche
e25e14ad95 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix return value of _php_server_push_callback in case of failure
2023-07-09 01:09:50 +02:00
Niels Dossche
dc9adda653 Fix return value of _php_server_push_callback in case of failure
It should return CURL_PUSH_DENY by default instead of CURL_PUSH_OK in
the branch I added, just like the check above.
I forgot to change this after doing tests.
2023-07-09 01:08:34 +02:00
Niels Dossche
d0c824cb7e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION
2023-07-08 21:39:17 +02:00
Niels Dossche
3ccd8d7866 Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION
Previously this caused a SIGABRT.

Closes GH-11639.
2023-07-08 21:32:10 +02:00
Niels Dossche
4dcb5af3a9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10562: Memory leak and invalid state with consecutive ftp_nb_fget
2023-07-07 17:59:00 +02:00
Niels Dossche
c962a96c34 Fix GH-10562: Memory leak and invalid state with consecutive ftp_nb_fget
When the user does not fully consume the data stream, but instead opens
a new one, a memory leak occurs. Moreover, the state is invalid: when
more commands arrive they'll be handled out-of-sync because the state of
the client does not match what the server is doing.
This leads to all sorts of weirdness, for example:
  Warning: ftp_nb_fget(): OK.

Fix it by gracefully closing the old data stream when a new data stream
is started.

Closes GH-11606.
2023-07-07 17:55:53 +02:00
Ilija Tovilo
30a80b8e41
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  tests(ext-curl): fix HTTP/2 Server Push tests
2023-07-07 10:38:48 +02:00
Kévin Dunglas
47d478806a
tests(ext-curl): fix HTTP/2 Server Push tests
Closes GH-10669
2023-07-07 10:38:26 +02:00
Niels Dossche
ca661f2c34 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix replaced error handling in SQLite3Stmt::__construct
2023-07-07 10:27:42 +02:00
Niels Dossche
824d1f95ad Fix replaced error handling in SQLite3Stmt::__construct
The error handling is replaced using zend_replace_error_handling(), but
when SQLITE3_CHECK_INITIALIZED() returns early, the old error handling
isn't restored.

In the past, SQLITE3_CHECK_INITIALIZED() threw a warning when the check
failed. This was replaced a few years ago with an error exception. So we
can fix the bug by just removing the replacing error handling as it
accomplishes nothing anymore.

Closes GH-11607.
2023-07-07 10:24:54 +02:00
Niels Dossche
6e0f4865bd Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix most external GD 2.3.3 compatibility
2023-07-06 21:40:20 +02:00
Michael Orlitzky
0aaad46c15 Fix most external GD 2.3.3 compatibility
* ext/gd/tests/bug45799.phpt: tweak to work with external gd.

The expected output from this test contains an extra newline with
gd-2.3.3 from the system (Gentoo). Adding a whitespace wildcard takes
care of it, and the test still passes with the bundled version of gd.

* ext/gd/tests: external gd-2.3.3 compatibility.

Support for the legacy "gd" image format was removed from gd-2.3.3
upstream:
  https://github.com/libgd/libgd/blob/master/CHANGELOG.md#233---2021-09-12

Several tests for the gd extension utilize that format, and naturally
fail when gd-2.3.3 from the system is used. This commit skips those
tests when the version of gd is at least 2.3.3.

* ext/gd/tests/bug73159.phpt: skip with external gd >= 2.3.3

This test uses the imagegd2() function to check that
  https://github.com/libgd/libgd/issues/289

is fixed. When an external gd without support for the "gd" format is
used, no error is thrown, but a nonsense result is printed: this is
normal. The corresponding upstream test is disabled in that situation;
it's not expected to work.

This commit skips the corresponding PHP test under the same
circumstances to fix a test failure with external gd >= 2.3.3.

* ext/gd/tests/bug73155.phpt: skip with external gd >= 2.3.3

This test uses the imagegd2() function to check that
  https://github.com/libgd/libgd/issues/309

is fixed. When an external gd without support for the "gd" format is
used, no error is thrown, but a nonsense result is printed: this is
normal. The corresponding upstream test is disabled in that situation;
it's not expected to work.

This commit skips the corresponding PHP test under the same
circumstances to fix a test failure with external gd >= 2.3.3.

* ext/gd/tests/bug73157.phpt: skip with external gd >= 2.3.3

This test ensures that the third (chunk_size) parameter to imagegd2()
is respected when a fourth parameter is also given. However, when an
external gd without support for the "gd" format is used, the call to
imagegd2() does not really work at all. It doesn't fail, but it
produces an "image" with a nonsense chunk size.

To avoid failures when an external gd >= 2.3.3 is used, we skip the
test entirely in that case.

* ext/gd/tests/bug77973.phpt: accept lowercase "Invalid"

This test fails with an external gd because the test expects "Invalid"
where upstream gd says "invalid". This commit tweaks the expected
output to accept an arbitrary character in the i/I position.

* ext/gd/tests/bug39780_extern.phpt: update for external gd-2.3.3.

Since there are no CI runs with external gd, I can only assume that
this test has fallen out-of-date due to changes in PHP itself. I've
tweaked the expected output (only slightly) so that the test passes
with both gd-2.3.2 and gd-2.3.3.

* ext/gd/tests/bug66356.phpt: update expected output for external gd.

Newer (external) versions of GD start their error messages with
lowercase characters, whereas this test is expecting them in
uppercase. A single-character wildcard now supports both formats.

* ext/gd/tests/imagegd_truecolor.phpt: skip with external gd >= 2.3.3.

This test uses the imagegd() function, but the "gd" format has been
disabled by default in upstream gd-2.3.3. We still get some kind of
image data back from the call to imagegd(), but its "signature",
"truecolor", and "size" no longer match the expected values. This
commit skips the test when an external gd >= 2.3.3 is used.

* ext/gd/tests/createfromwbmp2_extern.phpt: update for external gd-2.3.3.
* ext/gd/tests/libgd00086_extern.phpt: update for external gd-2.3.3.

Since there are no CI runs with external gd, I can only assume that
this test has fallen out-of-date due to changes in PHP itself. I've
tweaked the expected output (only slightly) so that the test passes
with both gd-2.3.2 and gd-2.3.3.

* ext/gd/tests/bug77272.phpt: update expected output for external gd.

Newer (external) versions of GD start their error messages with
lowercase characters, whereas this test is expecting them in
uppercase. A single-character wildcard now supports both formats.

* ext/gd/tests/bug77479.phpt: update for newer external gd.

This test fails with gd-2.3.3 (at least) due to minor capitalization
and whitespace issues. We add some wildcards to account for the
difference.

Closes GH-11257.
Closes GH-11262.
Closes GH-11264.
Closes GH-11280.
2023-07-06 21:39:40 +02:00
Ilija Tovilo
4e3d9b26f9
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Implement flaky test section
2023-07-06 09:46:03 +02:00
Ilija Tovilo
849fdcae7d
Implement flaky test section
This re-uses the already used for automatic retesting. That's certainly better
than XFAIL.

Closes GH-11325
2023-07-06 09:45:35 +02:00
Ilija Tovilo
80153c9c2b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Retire AppVeyor
2023-07-05 15:16:01 +02:00
Ilija Tovilo
f47dc259aa
Retire AppVeyor
Closes GH-11566
2023-07-05 15:14:20 +02:00
Ilija Tovilo
60dd88c93e
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Use waitpid(-1) over WAIT_ANY
2023-07-04 10:29:14 +02:00
Ilija Tovilo
46e9c5104c
Use waitpid(-1) over WAIT_ANY
This macro is only available in glibc.

Closes GH-11588
2023-07-04 10:28:59 +02:00
Ilija Tovilo
ef4f08832c
Revert "Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs"
This reverts commit d7ab0ff0c8.
2023-07-04 09:11:14 +02:00
Máté Kocsis
d7ab0ff0c8
Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs 2023-07-03 08:32:58 +02:00
Niels Dossche
297fec099e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11300: license issue: restricted unicode license headers
2023-07-01 21:56:40 +02:00
Niels Dossche
ee42621ff6 Fix GH-11300: license issue: restricted unicode license headers
Closes GH-11572.
2023-07-01 21:55:21 +02:00
Anatol Belski
97f0d97d2a fileinfo: Backport xz detection patch
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 18:02:46 +02:00
Anatol Belski
86f79b299e
fileinfo: Backport xz detection fix
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 17:58:38 +02:00
Bob Weinand
cad47be8b6 Fix GH-11548 (Argument corruption when calling XMLReader::open or XMLReader::XML non-statically with observer active) 2023-06-30 15:18:37 +02:00
Ilija Tovilo
04cd8859dd
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Attempt to fix gh11498.phpt on MSAN
2023-06-30 09:42:34 +02:00
Ilija Tovilo
07dd0c80a8
Attempt to fix gh11498.phpt on MSAN
The issue might be that due to slow instrumentation the process might end before
we get to add it to the processes list. If the SIGCHLD handler executes before
adding the process to the list it will never be removed again.
2023-06-30 09:39:19 +02:00
Ilija Tovilo
838f6bffff
xfail socket zerocopy test on Cirrus + arm
Closes GH-11553
2023-06-29 08:48:48 +02:00
Ilija Tovilo
6b9d295674
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix serialization of RC1 objects appearing in object graph twice
2023-06-28 21:16:51 +02:00
Ilija Tovilo
d7d36692fd
Fix serialization of RC1 objects appearing in object graph twice
Previously, if an object had RC1 it would never be recorded in
php_serialize_data.ht because it was assumed that it could not be encountered
again. This assumption is incorrect though as the object itself may be saved
inside an array with RCn. This results in a new instance of the object, instead
of a second reference to the same object.

This is solved by tracking these objects in php_serialize_data.ht. To retain
performance, track if the current object resides in a potentially nested RCn
array. If not, and if the object is RC1 itself it may be omitted from
php_serialize_data.ht.

Additionally, we may treat the array root itself as RC1 because it may not
appear in the object graph again without recursion. Recursive arrays are still
somewhat broken even with this change, as the tracking of the array only happens
when the reference is encountered, thus resulting in a -> a' -> a' for a self
recursive array a -> a. Recursive arrays have limited support in serialize
anyway, so we ignore this case for now.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>
Co-authored-by: Martin Hoch <martin@littlerobot.de>

Closes GH-11349
Closes GH-11305
2023-06-28 21:15:03 +02:00
Niels Dossche
1288c07ba6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix context option check for "overwrite" in FTP
2023-06-27 17:54:39 +02:00
Jonas
1d369a871d Fix context option check for "overwrite" in FTP
Use zend_is_true() to read value of FTP context option "overwrite".

Closes GH-11332.
2023-06-27 17:53:45 +02:00
Ilija Tovilo
7d188491c4
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix use of uninitialized memory in pcntl SIGCHLD handling
2023-06-27 11:03:42 +02:00
Ilija Tovilo
003cf9da78
Fix use of uninitialized memory in pcntl SIGCHLD handling
psig needs to stay the tail, so that we don't get a dangling element on the end.

Closes GH-11536
2023-06-27 11:02:59 +02:00
Remi Collet
b972af9589
adapt test expectation with libzip 1.10 2023-06-26 09:10:40 +02:00
Ilija Tovilo
776a685aed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] XFAIL intl IntlCalendar::clear() test that may fail with ICU 73
2023-06-25 13:27:50 +02:00
Ilija Tovilo
8ec5a10916
[skip ci] XFAIL intl IntlCalendar::clear() test that may fail with ICU 73 2023-06-25 13:27:38 +02:00
Niels Dossche
a8bf8e37a9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing WUNTRACED
2023-06-25 11:18:15 +02:00
Niels Dossche
931d8d059b Add missing WUNTRACED
I forgot to add this in GH-11509.

Closes GH-11526.
2023-06-25 11:17:59 +02:00
Niels Dossche
022b6aa4cb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11498: SIGCHLD is not always returned from proc_open
2023-06-23 21:58:05 +02:00
nielsdos
f39b513916 Fix GH-11498: SIGCHLD is not always returned from proc_open
Linux, and maybe other unixes, may merge multiple standard signals into
a single one. This causes issues when keeping track of process IDs.
Solve this by manually checking which children are dead using waitpid().

Test case is based on taka-oyama's test code.

Closes GH-11509.
2023-06-23 21:56:21 +02:00
Ilija Tovilo
7f9ad4a83a
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Mangle PCRE regex cache key with JIT option"
2023-06-22 23:14:27 +02:00
Ilija Tovilo
4d91665f78
Revert "Mangle PCRE regex cache key with JIT option"
This reverts commit 466fc78d2c.
2023-06-22 23:13:37 +02:00
nielsdos
c44f79b7d5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11492: Make test failure: ext/pdo_sqlite/tests/bug_42589.phpt
2023-06-22 20:51:11 +02:00
Vinicius Dias
039dd0b4bd Fix GH-11492: Make test failure: ext/pdo_sqlite/tests/bug_42589.phpt
Closes GH-11494.
2023-06-22 20:49:00 +02:00
Derick Rethans
1b5360587e Merge branch 'PHP-8.1' into PHP-8.2 2023-06-22 19:06:08 +01:00
Derick Rethans
0747616f84 Fixed GH-11368: Date modify returns invalid datetime 2023-06-22 17:58:19 +01:00
Ilija Tovilo
1441f30a8d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Remove session ID set through REQUEST_URI
2023-06-22 12:36:52 +02:00
Ilija Tovilo
f160eff441
Remove session ID set through REQUEST_URI 2023-06-22 12:35:55 +02:00
Ilija Tovilo
34a1a1bddb
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Mangle PCRE regex cache key with JIT option
2023-06-22 11:10:59 +02:00
Michael Voříšek
466fc78d2c
Mangle PCRE regex cache key with JIT option
Closes GH-11396
2023-06-22 11:08:54 +02:00
Dmitry Stogov
e50ed0f1a2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect VM stack overflow checks elimination
2023-06-20 12:00:20 +03:00
Dmitry Stogov
1a96d64828 Fixed incorrect VM stack overflow checks elimination 2023-06-20 11:59:36 +03:00
Niels Dossche
93becab506 Fix GH-11455: Segmentation fault with custom object date properties
Closes GH-11473.
2023-06-19 19:42:09 +02:00
nielsdos
de0223113a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"
2023-06-19 19:38:30 +02:00
nielsdos
c174ebfce0 Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM"
This reverts commit 7eb3e9cd17.

Although the fix follows the spec, it causes issues because a lot of old
code assumes the incorrect behaviour PHP had since a long time.
We cannot do this yet, especially not in a stable release.
We revert this for the time being.
See GH-11428.
2023-06-19 19:37:46 +02:00
Niels Dossche
862487e95e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #80332: Completely broken array access functionality with DOMNamedNodeMap
2023-06-18 15:02:46 +02:00
Niels Dossche
9f7d88802e Fix #80332: Completely broken array access functionality with DOMNamedNodeMap
The problem is the usage of zval_get_long(). In particular, if the
string is non-numeric the result of zval_get_long() will be 0 without
giving an error or warning. This is misleading for users: users get the
impression that they can use strings to access the map because it
coincidentally works for the first item (which is at index 0). Of
course, this fails with any other index which causes confusion and bugs.

This patch adds proper support for using string offsets while accessing
the map. It does so by detecting if it's a non-numeric string, and then
using the getNamedItem() method instead of item(). I had to split up the
array access implementation code for DOMNodeList and DOMNamedNodeMap
first to be able to do this.

Closes GH-11468.
2023-06-18 14:59:19 +02:00
David Carlier
bc45b34b30 Merge branch 'PHP-8.1' into PHP-8.2 2023-06-18 13:45:30 +01:00
David CARLIER
f194cdf852 ext/pgsql: fix PGtrace invalid free issue.
disable trace when closing the connection, is a no op if there is no stream
attached to it.

Close GH-11403
2023-06-18 13:44:39 +01:00
Niels Dossche
bb3e5a8f55 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM
2023-06-17 13:36:44 +02:00
nielsdos
7eb3e9cd17 Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM
The NULL namespace is only correct when there is no default namespace
override. When there is, we need to manually set it to the empty string
namespace.

Closes GH-11428.
2023-06-17 13:36:00 +02:00
nielsdos
29a96e09b2 Fix GH-11451: Invalid associative array containing duplicate keys
It used the "add_new" variant which assumes the key doesn't already
exist. But in case of duplicate keys we have to take the last result.

Closes GH-11453.
2023-06-15 21:56:06 +02:00
nielsdos
923e72615f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix bug #55294 and #47530 and #47847: namespace reconciliation issues
2023-06-15 21:50:47 +02:00
nielsdos
b30be40b86 Fix bug #55294 and #47530 and #47847: namespace reconciliation issues
We'll use the DOM wrapper version of libxml2 instead of the regular one.
It's conforming to the behaviour we expect of DOM.
Most of this patch is tests.

I based and extended the tests on the code attached with the aforementioned
bug reports. Therefore the credits for the tests:
Co-authored-by: hilse at web dot de
Co-authored-by: robin2008 at altruists dot org
Co-authored-by: sgunderson at bigfoot dot com

We'll also change the searching point of the internal reconciliation to
start at the top of the added tree to avoid redundant work now that the
function is changed.

Closes GH-11454.
2023-06-15 21:50:00 +02:00
nielsdos
a9c6b840ad Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cross-compilation check in phar generation for FreeBSD
2023-06-13 19:13:34 +02:00
Peter
4fcb3e0d34 Fix cross-compilation check in phar generation for FreeBSD
FreeBSD's shell is very POSIX strict. This patch makes sure it works
correctly under FreeBSD too.

Closes GH-11441.
2023-06-13 19:09:58 +02:00
nielsdos
c160693515 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL
  Fix "invalid state error" with cloned namespace declarations
  Fix lifetime issue with getAttributeNodeNS()
2023-06-13 17:35:16 +02:00
nielsdos
a8a3b99e00 Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL
Closes GH-11446.
2023-06-13 17:30:57 +02:00
Niels Dossche
10d94aca4c Fix "invalid state error" with cloned namespace declarations
Closes GH-11429.
2023-06-13 17:30:18 +02:00
Niels Dossche
e309fd8461 Fix lifetime issue with getAttributeNodeNS()
It's the same issue that I fixed previously in GH-11402, but in a
different place.

Closes GH-11422.
2023-06-13 17:29:37 +02:00
Niels Dossche
2cbb0c0cc0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #70359 and #78577: segfaults with DOMNameSpaceNode
2023-06-09 21:41:49 +02:00
nielsdos
f2d673fb18 Fix #70359 and #78577: segfaults with DOMNameSpaceNode
* Fix type confusion and parent reference
* Manually manage the lifetime of the parent
* Add regression tests
* Break out to a helper, and apply the use-after-free fix to xpath

Closes GH-11402.
2023-06-09 21:35:55 +02:00
Jakub Zelenka
d687a1bf57
Merge branch 'PHP-8.1' into PHP-8.2 2023-06-09 16:50:24 +01:00
Jakub Zelenka
3fc013b2e2
Fix CS and checking for IPv6 SAN verify 2023-06-09 16:49:09 +01:00
Jakub Zelenka
58141f062b
Merge branch 'PHP-8.1' into PHP-8.2 2023-06-09 16:38:14 +01:00
James Lucas
fd09728bb6
Fix bug GH-9356: Incomplete SAN validation of IPv6 address
IPv6 addresses are valid entries in subjectAltNames. Certificate
Authorities may issue certificates including IPv6 addresses except
if they fall within addresses in the RFC 4193 range. Google and
CloudFlare provide IPv6 addresses in their DNS over HTTPS services.

Internal CAs do not have those restrictions and can issue Unique
local addresses in certificates.

Closes GH-11145
2023-06-09 16:33:46 +01:00
Pierrick Charron
32c7c433ac
Fix wrong backporting of previous soap patch 2023-06-06 18:49:32 -04:00
Pierrick Charron
38e4e58f42
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update NEWS
  Update NEWS
  Fix GH-11382 add missing hash header for bin2hex
  Fix missing randomness check and insufficient random bytes for SOAP HTTP Digest
2023-06-06 18:07:19 -04:00
Pierrick Charron
a5b8bfce7c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Update NEWS
  Fix GH-11382 add missing hash header for bin2hex
  Fix missing randomness check and insufficient random bytes for SOAP HTTP Digest
2023-06-06 18:01:56 -04:00