Commit graph

63570 commits

Author SHA1 Message Date
George Peter Banyard
02a80c5b82 Fix various bugs related to DNF types
- GH-11958: DNF types in trait properties do not get bound properly
 - GH-11883: Memory leak in zend_type_release() for non-arena allocated DNF types
 - Internal trait bound to userland class would not be arena allocated
 - Property DNF types were not properly deep copied during lazy loading

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: ju1ius <jules.bernable@gmail.com>
2023-08-15 15:34:33 +01:00
Niels Dossche
0b516aea25 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #81992: SplFixedArray::setSize() causes use-after-free
2023-08-14 21:34:04 +02:00
Niels Dossche
b71c6b2c6c Fix #81992: SplFixedArray::setSize() causes use-after-free
Upon resizing, the elements are destroyed from lower index to higher
index. When an element refers to an object with a destructor, it can
refer to a lower (i.e. already destroyed) element, causing a uaf.
Set refcounted zvals to NULL after destroying them to avoid a uaf.

Closes GH-11959.
2023-08-14 21:32:22 +02:00
Kamil Tekiela
7a4b213c1f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix error checking in mysqlnd
2023-08-10 15:25:37 +01:00
Kamil Tekiela
0d922aa595
Fix error checking in mysqlnd
Closes GH-11925
2023-08-10 15:23:54 +01:00
Ilija Tovilo
1aae59cf43
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix EXPECT for bug52820.phpt on newer curl versions
  Fix curl_basic_009.phpt for newer curl versions
2023-08-10 15:52:14 +02:00
Ilija Tovilo
0e843c5d82
Fix EXPECT for bug52820.phpt on newer curl versions
New curl versions have a "processing: url" line. The connection number in
"Closing connection" is apparently also dropped.
2023-08-10 15:51:53 +02:00
Ilija Tovilo
3af76b2302
Fix curl_basic_009.phpt for newer curl versions 2023-08-10 15:51:49 +02:00
Derick Rethans
b71d2e16e6 Fix GH-11416: Crash with DatePeriod when uninitialised objects are passed in (PHP 8.2+) 2023-08-09 16:10:14 +01:00
Derick Rethans
7f6e98cec7 Merge branch 'PHP-8.1' into PHP-8.2 2023-08-09 15:39:25 +01:00
Derick Rethans
4833b84854 Fix GH-11416: Crash with DatePeriod when uninitialised objects are passed in 2023-08-09 15:39:13 +01:00
Niels Dossche
8f1cbc8dea Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault when DOMParentNode::prepend() is called when the child disappears
2023-08-08 20:07:11 +02:00
Niels Dossche
d19e4da125 Fix segfault when DOMParentNode::prepend() is called when the child disappears
Closes GH-11906.
2023-08-08 20:06:39 +02:00
George Peter Banyard
52bd07c186 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix skipif condition on new test
2023-08-08 12:42:53 +01:00
George Peter Banyard
4cbc66d5e6 Fix skipif condition on new test
I'm an idiot, messed up the condition when tweaking the test manually before committing.
2023-08-08 12:42:16 +01:00
George Peter Banyard
1ff59b9ad9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix off-by-one bug when truncating tempnam prefix
2023-08-08 09:51:02 +01:00
Athos Ribeiro
cbfd73765a Fix off-by-one bug when truncating tempnam prefix
The tempnam documentation currently states that "Only the first 63
characters of the prefix are used, the rest are ignored". However when
the prefix is 64 characters-long, the current implementation fails to
strip the last character, diverging from the documented behavior. This
patch fixes the implementation so it matches the documented behavior for
that specific case where the prefix is 64 characters long.

Closes GH-11870

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-08-08 09:46:27 +01:00
Máté Kocsis
43e62aa21f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix return type of odbc_data_source()
2023-08-08 08:54:41 +02:00
Máté Kocsis
77252afaf0
Fix return type of odbc_data_source() 2023-08-08 08:52:41 +02:00
Niels Dossche
df6e8bd4fd Fix viable next sibling search for replaceWith
Closes GH-11888.
2023-08-07 20:23:06 +02:00
Niels Dossche
87148f6de2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix viable next sibling search for replaceWith
2023-08-07 20:21:05 +02:00
Niels Dossche
815b5ad501 Fix viable next sibling search for replaceWith
Closes GH-11888.
2023-08-07 20:19:31 +02:00
Niels Dossche
b80ded8303 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11830: ParentNode methods should perform their checks upfront
  Fix manually calling __construct() on DOM classes
2023-08-07 19:47:27 +02:00
Niels Dossche
dddd309da4 Fix GH-11830: ParentNode methods should perform their checks upfront
Closes GH-11887.
2023-08-07 19:39:05 +02:00
Niels Dossche
08c4db7f36 Fix manually calling __construct() on DOM classes
Closes GH-11894.
2023-08-07 19:37:47 +02:00
Kamil Tekiela
4db701c049
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:31:18 +01:00
Yurun
ca5d48213a
Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
Closes GH-11551.
2023-08-04 22:25:01 +01:00
Niels Dossche
00ab6bb078 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Mark buildFromIterator test as conflicting
2023-08-04 21:08:57 +02:00
Niels Dossche
dc586b121a Mark buildFromIterator test as conflicting
Commit 0b2e6bc2b0 started caching the directory entry type to improve
performance. Shortly after, we've seen flaky failures of the
buildFromIterator phar test.

When it fails, it's always a value error in the constructor of
RecursiveDirectoryIterator::__construct() with a "no such file or
directory" error. What's happening here is this:
1) A parallel test creates a subdirectory in the current working dir.
2) This test checks hasChildren() on a directory entry, the cached entry
   returns "yes" on the subdirectory.
3) The parallel test finishes and removes the subdirectory.
4) The constructor mentioned above is called, causing an exception
   because the directory is gone.

This race has always been possible, even before said commit. It's just
that it was very hard to hit before: the expensive stat call made the
race window hard to hit. The race is now easier to hit because of the
caching that is fast.

Since there's many tests that modify the current working directory, it
seems best to mark this as an "all" conflict. We cannot avoid every
TOC-TOU race when working with files with these phar tests.

In particular, mounteddir.phpt caused every conflict I saw on CI, but
there's more tests that create subdirectories in the current working
directory.

Closes GH-11869.
2023-08-04 21:08:39 +02:00
Niels Dossche
c59bfc8d98 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert the fix for GH-11498
2023-08-03 21:59:21 +02:00
Niels Dossche
f7be15dbad Revert the fix for GH-11498
People relied on manually waiting for children, but the fix for GH-11498
broke this. Fixing this in PHP is fundamentally incompatible with doing
the wait loop in userland. This reverts to the old behaviour.

Closes GH-11863.
2023-08-03 21:48:34 +02:00
Niels Dossche
77417f81cb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix missing link variable in test
2023-08-03 21:12:04 +02:00
Niels Dossche
162bd2a58a Fix missing link variable in test 2023-08-03 21:11:55 +02:00
Niels Dossche
75441d71d8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10964: Improve `man` page about the built-in server
  Fix GH-11438: mysqlnd fails to authenticate with sha256_password accounts using passwords longer than 19 characters
2023-08-03 20:32:30 +02:00
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