Commit Graph

5667 Commits

Author SHA1 Message Date
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
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
f47dc259aa
Retire AppVeyor
Closes GH-11566
2023-07-05 15:14:20 +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
1ede3137c9 Fix GH-11274: POST/PATCH request via file_get_contents + stream_context_create switches to GET after a HTTP 308 redirect
RFC 7231 states that status code 307 should keep the POST method upon
redirect. RFC 7538 does the same for code 308. Although it's not
mandated by the RFCs that PATCH is also kept (we can choose), it seems
like keeping PATCH will be the most consistent and understandable behaviour.

This patch also changes an existing test because it was testing for the
wrong behaviour.

Closes GH-11275.
2023-05-19 23:37:20 +02:00
Niels Dossche
b33fbbfe3d Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data
It's possible that the server already sent in more data than just the headers.
Since the stream only accepts progress increments after the headers are
processed, the already read data is never added to the process.
We account for this by adjusting the progress counter by the difference of
already read header data and the body.

For the test:
Co-authored-by: aetonsi <18366087+aetonsi@users.noreply.github.com>

Closes GH-10492.
2023-05-05 19:26:44 +02:00
Ilija Tovilo
dd44a9330e
Fix test bug60120.phpt
The process cmd was broken. We're now also checking that the process output is
actually what we expect.

Closes GH-11064
2023-04-13 12:56:18 +02:00
Niels Dossche
79c5b32d15 Fix GH-10990: mail() throws TypeError after iterating over $additional_headers array by reference
We should dereference the values, otherwise references don't work.

Closes GH-10991.
2023-04-01 19:44:43 +02:00
Niels Dossche
87862835e2 Fix undefined behaviour in unpack()
atoi()'s return value is actually undefined when an underflow or
overflow occurs. For example on 32-bit on my system the overflow test
which inputs "h2147483648" results in repetitions==2147483647 and on
64-bit this gives repetitions==-2147483648. The reason the test works on
32-bit is because there's a second undefined behaviour problem:
in case 'h' when repetitions==2147483647, we add 1 and divide by 2.
This is signed-wrap undefined behaviour and accidentally triggers the
overflow check like we wanted to.

Avoid all this trouble and use strtol with explicit error checking.

This also fixes a semantic bug where repetitions==INT_MAX would result
in the overflow check to trigger, even though there is no overflow.

Closes GH-10943.
2023-03-28 22:43:27 +02:00
Ilija Tovilo
e1ec67acd6
Unparallelize IO heavy tests
Alternative to GH-10892. This is somewhat unfortunate since these are also the
slow tests. I'm also not sure if this actually helps.

Closes GH-10953
2023-03-27 16:33:36 +02:00
Ilija Tovilo
57029ce92e
Fix buffer-overflow in php_fgetcsv() with \0 delimiter and enclosure
Fixes oss-fuzz #57392
Closes GH-10923
2023-03-25 17:42:39 +01:00
Ilija Tovilo
122f1287a0
Fix GH-10885: Leaking stream_socket_server context
`php_stream_context_set` already increases the refcount.

Closes GH-10886
2023-03-20 17:42:16 +01:00
Ilija Tovilo
ccca59728e
Move ARM64 build to Cirrus
Travis is very unreliable lately

Closes GH-10795
2023-03-15 01:35:01 +01:00
Kévin Dunglas
ad85e71421
fix: support for timeouts with ZTS on Linux (#10141) 2023-03-03 11:35:06 +01:00
George Peter Banyard
adc5edd411
Fixed ValueError message in count_chars()
The value of the mode argument must be between 0 and 4 inclusive, not 1 and 4.
2023-02-26 14:27:46 +00:00
George Peter Banyard
2133970152
Fixed ValueError message in substr_compare()
It used some random argument name instead of
2023-02-26 14:25:02 +00:00
Stanislav Malyshev
85d9278db2 Merge branch 'PHP-8.0' into PHP-8.1 2023-02-12 21:33:39 -07:00
Tim Düsterhus
a92acbad87 crypt: Fix possible buffer overread in php_crypt() 2023-02-12 20:46:51 -07:00
Tim Düsterhus
c840f71524 crypt: Fix validation of malformed BCrypt hashes
PHP’s implementation of crypt_blowfish differs from the upstream Openwall
version by adding a “PHP Hack”, which allows one to cut short the BCrypt salt
by including a `$` character within the characters that represent the salt.

Hashes that are affected by the “PHP Hack” may erroneously validate any
password as valid when used with `password_verify` and when comparing the
return value of `crypt()` against the input.

The PHP Hack exists since the first version of PHP’s own crypt_blowfish
implementation that was added in 1e820eca02.

No clear reason is given for the PHP Hack’s existence. This commit removes it,
because BCrypt hashes containing a `$` character in their salt are not valid
BCrypt hashes.
2023-02-12 20:46:44 -07:00
Niels Dossche
a8c8fb2564
Fix incorrect check in cs_8559_5 in map_from_unicode()
The condition `code == 0x0450 || code == 0x045D` is always false because
of an incorrect range check on code.
According to the BMP coverage in the encoding spec for ISO-8859-5
(https://encoding.spec.whatwg.org/iso-8859-5-bmp.html) the range of
valid characters is 0x0401 - 0x045F (except for 0x040D, 0x0450, 0x045D).
The current check has an upper bound of 0x044F instead of 0x045F.
Fix this by changing the upper bound.

Closes GH-10399

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-25 00:08:28 +00:00
Máté Kocsis
3197104e85
Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3
Closes GH-10429
2023-01-24 19:05:33 +01:00
Niels Dossche
4bbbe6d652
Fix substr_replace with slots in repl_ht being UNDEF
The check that was supposed to check whether the array slot was UNDEF
was wrong and never triggered. This resulted in a replacement with the
empty string or the wrong string instead of the correct one. The correct
check pattern can be observed higher up in the function's code.

Closes GH-10323

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-15 15:31:34 +00:00
Niels Dossche
4c9375e504 Fix GH-10187: Segfault in stripslashes() with arm64
Closes GH-10188

Co-authored-by: todeveni <toni.viemero@iki.fi>
Signed-off-by: George Peter Banyard <girgias@php.net>
2022-12-30 16:40:56 +00:00
Christoph M. Becker
b2186ca7c4
Fix GH-9905: constant() behaves inconsistent when class is undefined
Directly referring to a constant of an undefined throws an exception;
there is not much point in `constant()` raising a fatal error in this
case.

Closes GH-9907.
2022-11-09 15:21:50 +01:00
Christoph M. Becker
31cdda2440
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't skip test on Windows due to missing ext/posix
2022-11-07 15:07:09 +01:00
Christoph M. Becker
4c35d6440b
Don't skip test on Windows due to missing ext/posix
ext/posix is not available on Windows, but there is no need to check
for root (i.e. elevated privileges) on this platform, either.

Closes GH-9886.
2022-11-07 15:01:25 +01:00
Ilija Tovilo
35167af771
Really fix test this time 2022-11-03 16:33:07 +01:00
Ilija Tovilo
bca1e1f557
Fix ext section
Ugh, sorry.
2022-11-03 15:19:44 +01:00
Ilija Tovilo
d2c663441d
Fix duplicate SKIPIF section 2022-11-03 15:18:13 +01:00
Ilija Tovilo
ed1e703716
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Migrate i386 to GitHub actions
2022-11-03 14:37:17 +01:00
Ilija Tovilo
75970077b0
Migrate i386 to GitHub actions
Closes GH-9856
2022-11-03 14:34:54 +01:00
Ilija Tovilo
2f225b3008
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [skip ci] Mark frequently failing hrtime test as XFAIL
2022-10-20 11:00:21 +02:00
Ilija Tovilo
4071e18620
[skip ci] Mark frequently failing hrtime test as XFAIL 2022-10-20 10:59:07 +02:00
Ilija Tovilo
296a09549b
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Prepare for Windows CI with Github Actions
2022-10-09 18:45:29 +02:00
Michael Voříšek
b43e49437c
Prepare for Windows CI with Github Actions 2022-10-09 18:44:59 +02:00
Christoph M. Becker
47c79a97f5
Use --EXTENSIONS-- section for newly added tests
As of PHP 8.1.0, the `--EXTENSIONS-- section is properly supported, and
CIs may make use of that (our AppVeyor CI does).  Thus it is important
to list required extensions there, since otherwise they may not be
loaded, causing the test to be skipped, or worse, to be borked.
2022-10-01 14:08:59 +02:00
Arnaud Le Blanc
d4b99542d5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Return immediately when FD_SETSIZE is exceeded (#9602)
2022-10-01 11:23:34 +02:00
Arnaud Le Blanc
80232de0e4
Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Christoph M. Becker
9caa71f94f
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert unintended test expectation change
2022-09-28 12:13:39 +02:00
Athos Ribeiro
e6a822d437
Revert unintended test expectation change
Commit fbe3059 included an unintended change to the test which checks if
dns_get_record populates its additional parameter. This patch reverts
such change.

The issue was not detected by the CIs because their tests run in
the --offline mode, and the test in question needs internet connection.

Closes GH-9625.
2022-09-28 12:12:21 +02:00
Derick Rethans
cfee252a95 Merge branch 'PHP-8.0' into PHP-8.1 2022-09-27 14:11:31 +01:00
Derick Rethans
def8c8d174 Merge branch 'PHP-7.4' into PHP-8.0 2022-09-27 14:11:14 +01:00
Derick Rethans
0611be4e82 Fix #81727: Don't mangle HTTP variable names that clash with ones that have a specific semantic meaning. 2022-09-09 17:10:04 +01:00
Christoph M. Becker
65619e868c
Fix tests
These changes have been overlooked, when 7908aae30c
had been reverted.
2022-08-30 16:52:33 +02:00
Ben Ramsey
1862152145
Revert "Fix GH-9296: ksort behaves incorrectly on arrays with mixed keys"
This reverts commit cd1aed8edd, as
discussed on internals (<https://externals.io/message/118483>).
2022-08-30 09:13:46 -05:00
Christoph M. Becker
725cb4e8ad
Revert "Fix GH-9296: ksort behaves incorrectly on arrays with mixed keys"
This reverts commit cd1aed8edd, as
discussed on internals (<https://externals.io/message/118483>).
2022-08-29 12:41:36 +02:00
Christoph M. Becker
5d196d9e7c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9316: $http_response_header is wrong for long status line
2022-08-18 12:30:45 +02:00
Christoph M. Becker
72da418719
Fix GH-9316: $http_response_header is wrong for long status line
While the reason-phrase in a HTTP response status line is usually
short, there is no actual limit specified by the RFCs.  As such, we
must not assume that the line fits into the buffer (which is currently
128 bytes large).

Since there is no real need to present the complete status line, we
simply read and discard the rest of a long line.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

Closes GH-9319.
2022-08-18 12:27:54 +02:00
twosee
14d71957ca
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Re-fix GH-8409: SSL handshake timeout persistent connections hanging
2022-08-14 20:14:57 +08:00
twosee
b8d07451d4
Re-fix GH-8409: SSL handshake timeout persistent connections hanging
This fix is another solution to replace d0527427be, use zend_try and zend_catch to make sure persistent stream will be released when error occurred.

Closes GH-9332.
2022-08-14 20:13:36 +08:00