1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

132092 Commits

Author SHA1 Message Date
Máté Kocsis
281669aeb4 Add support for true standalone type when generating methodsynopsis 2023-05-07 19:34:09 +02:00
Máté Kocsis
85338569de Narrow bool return types to true when possible 2023-05-07 19:34:09 +02:00
Niels Dossche
f6e296dbb9 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11180: hash_file() appears to be restricted to 3 arguments
2023-05-07 17:40:29 +02:00
Niels Dossche
e6730565b6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11180: hash_file() appears to be restricted to 3 arguments
2023-05-07 17:37:25 +02:00
Niels Dossche
baa07f3de3 Fix GH-11180: hash_file() appears to be restricted to 3 arguments
Closes GH-11198.
2023-05-07 17:33:28 +02:00
George Peter Banyard
646f54b594 ext/standard/array.c: use uint32_t instead of incorrect int type
Drive-by indentation fixes and bool usage
2023-05-07 15:01:37 +01:00
George Peter Banyard
1820c421f1 Prevent unnecessary string duplication in assert() (#11031) 2023-05-07 15:00:30 +01:00
Ilija Tovilo
5107483cd6 Correctly copy lineno for zval asts (#11203)
The comment was incorrect. Zval ASTs store their lineno in u2, but u2 does not
get copied in ZVAL_COPY. This triggers use-of-uninitialized errors with MSAN.
Unfortunately, I don't have a simple reproducer.
2023-05-07 13:17:19 +02:00
Niels Dossche
82b05373b1 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11160: Few tests failed building with new libxml 2.11.0
2023-05-06 23:15:57 +02:00
Niels Dossche
dc1a70c244 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11160: Few tests failed building with new libxml 2.11.0
2023-05-06 23:10:58 +02:00
Niels Dossche
7c0dfc5cf5 Fix GH-11160: Few tests failed building with new libxml 2.11.0
It's possible to categorise the failures into 2 categories:
  - Changed error message. In this case we either duplicate the test and
    modify the error message. Or if the change in error message is
    small, we use the EXPECTF matchers to make the test compatible with both
    old and new versions of libxml2.
  - Missing warnings. This is caused by a change in libxml2 where the
    parser started using SAX APIs internally [1]. In this case the
    error_type passed to php_libxml_internal_error_handler() changed from
    PHP_LIBXML_ERROR to PHP_LIBXML_CTX_WARNING because it internally
    started to use the SAX handlers instead of the generic handlers.
    However, for the SAX handlers the current input stack is empty, so
    nothing is actually printed. I fixed this by falling back to a
    regular warning without a filename & line number reference, which
    mimicks the old behaviour. Furthermore, this change now also shows
    an additional warning in a test which was previously hidden.

[1] 9a82b94a94

Closes GH-11162.
2023-05-06 23:10:07 +02:00
Niels Dossche
80efa76b8b Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix maximum argument count of pcntl_forkx()
2023-05-06 21:00:30 +02:00
Niels Dossche
a0e71cb811 Fix maximum argument count of pcntl_forkx()
Closes GH-11199.
2023-05-06 20:56:27 +02:00
Florian Moser
4d4b9604ca Fix GH-11054: Reset OpenSSL errors when using a PEM public key
The error happens when the PEM contains a public key, as it will be
first tried to be parsed as a certificate. The parsing as a certificate
fails, which then leads to a corresponding error tracked by PHP with
the next call to php_openssl_store_errors().

This change introduces an error marking to be able to reset the stored
errors to the state before trying the certificate.

Closes GH-11055
2023-05-06 11:56:31 +01:00
Jakub Zelenka
5690e8baea Add myself as a standard CODEOWNER to not miss some changes
I have got some knowledge of some pieces there so happy to do reviews.
2023-05-06 11:39:48 +01:00
Daniel Kesselberg
fa10dfcc81 Add PKCS7_NOOLDMIMETYPE and OPENSSL_CMS_OLDMIMETYPE
PKCS7_NOOLDMIMETYPE to use Content-Type application/pkcs7-mime
OPENSSL_CMS_OLDMIMETYPE to use Content-Type application/x-pkcs7-mime

SMIME_write_PKCS7 and SMIME_write_CMS are using SMIME_write_ASN1_ex.
The Content-Type application/x-pkcs7-mime is generated with the flag SMIME_OLDMIME (0x400).[^1]

SMIME_write_PKCS7 set SMIME_OLDMIME by default.[^2]
SMIME_write_CMS does not.[^3]

I picked OPENSSL_CMS_OLDMIMETYPE over OPENSSL_CMS_NOOLDMIMETYPE because that's what the flag actually does.

[^1]: 9a2f78e14a/crypto/asn1/asn_mime.c (L248-L251)
[^2]: 9a2f78e14a/crypto/pkcs7/pk7_mime.c (L41-L43)
[^3]: 9a2f78e14a/crypto/cms/cms_io.c (L93)

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-05-06 11:12:31 +01:00
David CARLIER
f18a0384c1 ext/pgsql: fix pg_trace test when trace mode is supported. (#11191) 2023-05-06 10:02:30 +01:00
Niels Dossche
ac5920f92b Fix GH-11141: Could not open input file: should be sent to stderr
I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stderr, ...), like
suggested in the linked issue.

Closes GH-11163.
2023-05-05 19:31:23 +02:00
nielsdos
42aaac3525 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data
2023-05-05 19:30:05 +02:00
nielsdos
1fc18a84d9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data
2023-05-05 19:28:01 +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
David CARLIER
f31d253849 ext/pgsql adding PGSQL_ERRORS_SQLSTATE constant support.
Close GH-11181
2023-05-05 15:08:27 +01:00
Calvin Buckley
3af5f47ce6 http_response_code should warn if headers were already sent
This would previously fail silently. We also return false to indicate the error.

Fixes GH-10742
Closes GH-10744
2023-05-05 15:24:56 +02:00
Cédric Anne
c02348cf9d Make SERVER_SOFTWARE compliant with RFC3875 (#11093) 2023-05-05 12:43:34 +01:00
David CARLIER
2e0f75ec14 ext/pgsql: pg_lo_read addressing the todo. (#11159) 2023-05-05 12:41:52 +01:00
Julien Quiaios
bb38ad7768 Add new test for array_fill() to cover the case when the parameter count is too large (#11184) 2023-05-05 12:36:17 +01:00
Bob Weinand
a9d11b64a7 Merge branch 'PHP-8.2' 2023-05-05 12:09:33 +02:00
Bob Weinand
cfbb47b57b Merge branch 'PHP-8.1' into PHP-8.2 2023-05-05 12:07:48 +02:00
David Carlier
7ec8ae12c4 ext/pgsql: pg_trace allow to refine its trace mode via 2 new constants.
- PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
- PGSQL_TRACE_REGRESS_MODE to have a more verbose and observable
output to check possible regressions.

Close GH-11041
2023-05-05 11:05:03 +01:00
Bob Weinand
05bd1423ee Fix GH-11189: Exceeding memory limit in zend_hash_do_resize leaves the array in an invalid state
There are more places in zend_hash.c where the resize happened after some values on the HashTable struct were set.
I reordered them all, but writing a test for these would rely on the particular amount of bytes allocated at given points in time.
2023-05-05 12:04:40 +02:00
David CARLIER
84c185c8ba ext/pgsql: pg_cancel_query internal update.
Removing (obsolete) PGrequestCancel usage in favor of the thread-safe
 PQcancel/PQfreeCancel pair.

Close GH-11081
2023-05-05 10:58:48 +01:00
Niels Dossche
a65cdd97a1 Implement NEON-accelerated version of BLOCKCONV for lowercasing and uppercasing strings (#11161)
Since lowercasing and uppercasing is a common operation for both
internal purposes and userland purposes, it makes sense to implement a
NEON accelerated version for this.
2023-05-04 19:51:02 +02:00
nielsdos
f6c0c60ef6 Fix GH-11104: STDIN/STDOUT/STDERR is not available for CLI without a script
I found no reason why this is done this way.
Of course this will allow users to do stupid stuff like
`fclose(STDOUT);` etc. but if they type in that code they clearly know
what they're doing...

Close GH-11169.
2023-05-03 19:54:21 +02:00
nielsdos
001e278549 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
  Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
  Fix GH-9068: Conditional jump or move depends on uninitialised value(s)
2023-05-03 19:49:02 +02:00
nielsdos
ab3f584a25 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
  Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
  Fix GH-9068: Conditional jump or move depends on uninitialised value(s)
2023-05-03 19:46:51 +02:00
nielsdos
81e50b4ee3 Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
Dynamic property case in zend_get_property_info() can return NULL for
prop info. This was not handled.

Closes GH-11182.
2023-05-03 19:42:04 +02:00
nielsdos
d75c1d00a9 Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
A negative value like -1 may overflow and cause incorrect results in the
timeout variable, which causes an immediate timeout. As this is caused
by undefined behaviour the exact behaviour depends on the compiler, its
version, and the platform.

A large overflow is also possible, if an extremely large timeout value
is passed we also set an indefinite timeout. This is because the timeout
value is at least a 64-bit number and waiting for UINT64_MAX/1000000
seconds is waiting about 584K years.

Closes GH-11183.
2023-05-03 19:40:52 +02:00
nielsdos
4ca8daf3ed Fix GH-9068: Conditional jump or move depends on uninitialised value(s)
This patch preserves the scratch registers of the SysV x86-64 ABI by storing
them to the stack and restoring them later. We need to do this to prevent the
registers of the caller from being corrupted. The reason these get corrupted
is because the compiler is unaware of the Valgrind replacement function and
thus makes assumptions about the original function regarding registers which
are not true for the replacement function.

For implementation I used a GCC and Clang attribute. A more general
approach would be to use inline assembly but that's also less portable
and quite hacky. This attributes is supported since GCC 7.x, but the
target option is only supported since 11.x. For Clang the target option
does not matter.

Closes GH-10221.
2023-05-03 19:39:05 +02:00
Ilija Tovilo
ef6bbaa1ec Downgrade to Ubuntu 20.04 for ASAN nightly for now
See https://github.com/actions/runner-images/issues/6709.
2023-05-03 19:13:32 +02:00
Nils
36559fb264 Remove unused macro PHP_FNV1_32A_INIT and PHP_FNV1A_64_INIT (#11114) 2023-05-03 18:46:31 +02:00
Ilija Tovilo
4e6025a641 Merge branch 'PHP-8.2'
* PHP-8.2:
  Add retry mechanism in run-tests.php
2023-05-03 13:51:31 +02:00
Ilija Tovilo
81b2d2ee45 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add retry mechanism in run-tests.php
2023-05-03 13:50:04 +02:00
Ilija Tovilo
11597d18d6 Add retry mechanism in run-tests.php
We have lots of spurious failures in CI, many of them with the "all" CONFLICT.
We're limiting the retrying to specific error messages. In the future we may
also provide a FLAKY section to retry specific tests.

Closes GH-10892
2023-05-03 13:47:13 +02:00
Ilija Tovilo
d82e96cc09 [skip ci] Link technical resources in CONTRIBUTING.md
Co-authored-by: KapitanOczywisty

Closes GH-11155
2023-05-03 12:43:35 +02:00
nielsdos
41cda46b70 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix too wide OR and AND range inference
2023-05-02 20:20:15 +02:00
nielsdos
e1fc246444 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix too wide OR and AND range inference
2023-05-02 20:18:05 +02:00
nielsdos
fbf5216ca0 Fix too wide OR and AND range inference
There is a typo which causes the AND and OR range inference to infer a
wider range than necessary. Fix this typo. There are many ranges for
which the inference is too wide, I just picked one for AND and one for
OR that I found through symbolic execution.

In this example test, the previous range inferred for test_or was [-27..-1]
instead of [-20..-1].
And the previous range inferred for test_and was [-32..-25]
instead of [-28..-25].

Closes GH-11170.
2023-05-02 20:08:59 +02:00
Dmitry Stogov
56d1cc7842 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed GH-11127 (JIT fault)
2023-05-02 20:33:34 +03:00
Dmitry Stogov
c155949905 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-11127 (JIT fault)
2023-05-02 20:33:19 +03:00
Dmitry Stogov
ed0b593c11 Fixed GH-11127 (JIT fault)
* Fixed GH-11127 (JIT fault)

* Added test

* Add new line
2023-05-02 20:32:48 +03:00