Commit Graph

14357 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
ColinHDev
e2f477c2cb
Fix negative indices on empty array not affecting next chosen index
Changed the value of nNextFreeElement in _zend_empty_array from 0 to
ZEND_LONG_MIN.

Fixes GH-11154
Closes GH-11157
2023-05-02 12:05:48 +02:00
Tim Düsterhus
bf727cf5e2
RFC: Make unserialize() emit a warning for trailing bytes (#9630) 2023-05-01 19:06:40 +02:00
David CARLIER
6a9061e0af Fix GH-9344: pgsql pipeline mode proposal.
Adding pg_enter_pipeline_mode, pg_exit_pipeline_mode,
pg_pipeline_sync and pg_pipeline_status.

Close GH-10868
2023-04-28 20:53:11 +01:00
David Carlier
7b4b40f06f ext/sockets: addig Linux's IP_BIND_ADDRESS_NO_PORT.
Delay ephemeral port number attribution at connect time rather
than at bind's one.

Close GH-11119.
2023-04-26 19:26:29 +01:00
Ilija Tovilo
86ffde3c38
Improve ini number handling with INI_SCANNER_TYPED
Fixes GH-11010
Closes GH-11014
2023-04-11 18:54:11 +02:00
Alex Dowad
aa51871adc Add more details to NEWS on mb_detect_encoding; also include in UPGRADING 2023-04-10 19:43:05 +02:00
David CARLIER
6c532df705 ext/sockets adding FreeBSD's SO_REUSEPORT_LB constant.
SO_REUSEPORT_LB is, in fact, closer to the classical Linux's SO_REUSEPORT.

Close GH-11038
2023-04-08 17:35:10 +01:00
Ilija Tovilo
9a250cc9d6
Add separate static property through trait if parent already declares it
Fixes GH-10935
Closes GH-10937
2023-04-06 14:27:24 +02:00
Ilija Tovilo
b2c5acbb01
[skip ci] Add NEWS entry for GH-10168 and GH-10582 2023-04-05 11:24:06 +02:00
David CARLIER
2da299703a ext/intl IntlChar::enumCharNames changes the signature to void.
Close GH-10904
2023-03-28 18:07:35 +01:00
David Carlier
7623bf0b06 ext/intl: breakiterator::setText returns false on failure.
Close GH-10820
2023-03-28 13:29:09 +01:00
David CARLIER
2b354318d9 ext/posix: proposing posix_eaccess. unlike access, it is not standard but available in enough platforms ; on linux it's euidaccess in reality eaccess being 'just' an alias. key difference is eaccess checks the effective user id instead.
Close GH-10917
2023-03-27 22:32:16 +01:00
Niels Dossche
6ec69d727a
Improve the warning message for unpack() in case not enough values were provided (#10949) 2023-03-27 00:04:42 +02:00
Ilija Tovilo
61e98bf35e
Disallow parent dir components (..) in open_basedir() at runtime
Fix GH-10469
Closes GH-10913
2023-03-25 18:02:20 +01:00
Alex Dowad
bf64342d30 Update NEWS and UPGRADING to reflect changes in 0ce755be26 2023-03-24 22:00:19 +02:00
Su, Tao
edae24313d
Fix GH-10755: Memory leak in phar_rename_archive()
In phar_renmae_archive() context, added one reference but immediately
destroyed another, so do not need to increase refcount. With removal of
refcount++ line, PHP/Zend no longer reports memory leak.
Updated bug69958.phpt test file accordingly.

Closes GH-10856
2023-03-20 13:27:33 +01:00
David Carlier
974a3d8441 ext/mysqli/pgsql: mysqli_fetch_object/pgsql_fetch_object raises ValueError on constructor args error.
Closes GH-10832.
2023-03-13 19:54:49 +00:00
Kévin Dunglas
f0495855a3
feat: enable Zend Max Execution Timers by default in 8.3 (#10778) 2023-03-10 16:22:42 +01:00
David Carlier
45677081fa ext/intl: dateformatter settimezone changes on success, returning true like setcalendar.
Closes GH-10790
2023-03-09 21:45:26 +00:00
Ilija Tovilo
9f591c9bf6
Revert "Throw on negative setcookie expiration timestamp"
This reverts commit 82dfd93b9d.
2023-03-06 16:32:46 +01:00
Ilija Tovilo
82dfd93b9d
Throw on negative setcookie expiration timestamp
Fixes GH-10765
2023-03-06 14:01:17 +01:00
David Carlier
02ec4c5071 Fix GH-10727: Spoofchecker constant updates.
- Adding MIXED_NUMBERS from ICU 58.
- Adding HIDDEN_OVERLAY from ICU 62.

Closes GH-10730.
2023-02-28 12:27:38 +00:00
David CARLIER
fbaa2eb059 ext/sockets: add TCP_REPAIR to silently close a connection.
Closes GH-10724.
2023-02-27 22:56:06 +00:00
Ilija Tovilo
b14785ca85
Merge branch 'PHP-8.2'
* PHP-8.2:
  [skip ci] Add github reference to bug fix in NEWS
2023-02-24 20:46:11 +01:00
Ilija Tovilo
c9bd540bac
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Add github reference to bug fix in NEWS
2023-02-24 20:45:31 +01:00
Ilija Tovilo
7d2b01eea7
[skip ci] Add github reference to bug fix in NEWS 2023-02-24 20:44:47 +01:00
Ilija Tovilo
3a602d235c
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed.
2023-02-24 20:42:00 +01:00
Ilija Tovilo
9b10b65e2b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed.
2023-02-24 20:41:40 +01:00
Niels Dossche
b9a5bfc355
Fix GH-10570: Assertion `(key)->h != 0 && "Hash must be known"' failed.
Fixes GH-10570, see GH-10570 for analysis.

Closes GH-10572
2023-02-24 20:40:29 +01:00
David Carlier
9cac68d678 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-24 17:03:00 +00:00
nielsdos
8959ff39d8 Fix incorrect type for return value of zend_update_static_property_ex()
zend_update_static_property_ex() returns a zend_result, but the return
value is stored here in a bool. A bool is unsigned on my system, so in
case zend_update_static_property_ex() returns FAILURE (== -1) this gets
converted to 1 instead. This is not a valid zend_result value. This
means that (transitive) callers could mistakingly think the function
succeeded while it did in fact not succeed. Fix it by changing the type
to zend_result.

Closes GH-10691.
2023-02-24 17:02:32 +00:00
George Peter Banyard
512abc23a4
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed bug GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback
  Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
2023-02-24 14:33:28 +00:00
Pierrick Charron
91db3a1b85
Fixed bug GH-10270 Unable to return CURL_READFUNC_PAUSE in readfunc callback
Closes GH-10607

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-02-24 14:32:23 +00:00
George Peter Banyard
5f357f341d
Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
We need to use the proper ZPP qualifier for zend_string

Closes GH-10677
2023-02-24 14:31:23 +00:00
Max Kellermann
e9c8621632 ext/opcache/zend_shared_alloc: use memfd for locking if available
A memfd is a virtual file that has no reachable path, therefore does
not clobber any filesystem.  It is deleted automatically as soon as
the last handle gets closed.  The feature is available since Linux
kernel 3.17.

Closes GH-10589.
2023-02-23 22:34:35 +00:00
Ilija Tovilo
ab99072608
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix segfault when using ReflectionFiber (fixes #10439)
2023-02-23 23:28:31 +01:00
Ilija Tovilo
f1818d726f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault when using ReflectionFiber (fixes #10439)
2023-02-23 23:27:55 +01:00
Daniil Gentili
8d1c0a1403
Fix segfault when using ReflectionFiber (fixes #10439)
Closes GH-10478
2023-02-23 23:20:27 +01:00
David Carlier
bb2177e248 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-23 18:48:25 +00:00
Niels Dossche
c510083c8c Fix incorrect string length for output_handler in zlib ini code
The length of "output_handler" is supposed to be passed, but as sizeof
is used, the resulting number includes the NUL character, so the length
is off-by-one. Subtract one to pass the correct length.

Closes GH-10667.
2023-02-23 18:47:26 +00:00
Alex Dowad
8995f60258 mb_decode_mimeheader obeys RFC 2047 regarding underscores and QPrint encoding 2023-02-22 23:19:57 +02:00
Niels Dossche
25d6c932ef
Fix GH-10239: proc_close after proc_get_status always returns -1
The waitpid function only works once when a process is exited.
Cache the result so subsequent status reads succeed.

Closes GH-10250
2023-02-22 12:05:33 +01:00