Commit Graph

1606 Commits

Author SHA1 Message Date
Niels Dossche
db5e8ae6cf Implement DOMElement::toggleAttribute()
ref: https://dom.spec.whatwg.org/#dom-element-toggleattribute

Closes GH-11696.
2023-07-17 20:06:49 +02:00
Niels Dossche
a73f38f407
Implement DOMElement::insertAdjacent{Element,Text} (#11700)
* Implement DOMElement::insertAdjacent{Element,Text}

ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement
ref: https://dom.spec.whatwg.org/#dom-element-insertadjacenttext

Closes GH-11700.
2023-07-17 17:42:47 +02:00
George Peter Banyard
d8696f9216
[RFC] Path to Saner Increment/Decrement operators (#10358)
* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_increment() function

* Add str_decrement() function

RFC: https://wiki.php.net/rfc/saner-inc-dec-operators

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2023-07-17 15:51:24 +01:00
Niels Dossche
2f318cfb06 Implement DOMNode::isEqualNode()
Since we still support obsoleted nodes in our implementation, this uses
the old spec to match the old nodes; and this uses the new spec for
nodes still defined in the living spec.
When unclear, the behaviour was cross-verified with Firefox.

References:
https://dom.spec.whatwg.org/#dom-node-isequalnode (for everything still in the living spec)
https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-Node3-isEqualNode (for old nodes removed from the living spec)

Closes GH-11690.
2023-07-17 15:29:36 +02:00
Niels Dossche
d04f48b6ac Implement DOMNode::parentElement and DOMNameSpaceNode::parentElement
ref: https://dom.spec.whatwg.org/#parent-element

Closes GH-11679.
2023-07-17 13:15:31 +02:00
Niels Dossche
d38cc9b9b6 Implement DOMNode::isConnected and DOMNameSpaceNode::isConnected
ref: https://dom.spec.whatwg.org/#dom-node-isconnected

Closes GH-11677.
2023-07-17 13:14:13 +02:00
Arnaud Le Blanc
e413419e33 [ci skip] UPGRADING / NEWS 2023-07-16 13:42:35 +02:00
Arnaud Le Blanc
d0731934b7
Expose time spent collecting cycles in gc_status() (#11523) 2023-07-16 12:34:28 +02:00
Joshua Behrens
08b57772b0
Warn when fpm socket was not registered on the expected path
This might happen if the UDS length limit is exceeded.

Co-authored-by: Jakub Zelenka <bukka@php.net>

Closes GH-11066
2023-07-15 14:21:58 +01:00
Niels Dossche
72e2e25066 Implement DOMElement::id
ref: https://dom.spec.whatwg.org/#dom-element-id

Closes GH-11701.
2023-07-14 14:37:11 +02:00
Niels Dossche
6560c9bf8e Implement DOMParentNode::replaceChildren()
ref: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
2023-07-14 14:34:29 +02:00
Niels Dossche
b24b3510f9 Implement DOMElement::className
ref: https://dom.spec.whatwg.org/#dom-element-classname

Closes GH-11691.
2023-07-13 19:05:09 +02:00
George Peter Banyard
3d4ff5ae22
RFC: Deprecate remains of string evaluated code assertions (#11671)
Link: https://wiki.php.net/rfc/assert-string-eval-cleanup
2023-07-13 15:45:32 +01:00
Niels Dossche
d17069e191 Implement DOMNode::getRootNode()
ref: https://dom.spec.whatwg.org/#dom-node-getrootnode

Closes GH-11693.
2023-07-13 16:27:28 +02:00
Niels Dossche
10d7e8dc3a Implement DOMElement::getAttributeNames()
ref: https://dom.spec.whatwg.org/#dom-element-getattributenames
2023-07-13 16:18:10 +02:00
Ilija Tovilo
d9db446065
Fix iface const visibility variance check 2023-07-13 10:52:58 +02:00
Niels Dossche
ea794e9cde Implement DOMNode::contains()
ref: https://dom.spec.whatwg.org/#dom-node-contains
2023-07-12 19:29:07 +02:00
Tim Düsterhus
c2cc1dbc85
[ci skip] NEWS / UPGRADING for ldap_connect with 2 arguments deprecation
see 69a8b63ecf
2023-07-11 17:34:38 +02:00
Tim Düsterhus
b3553159a7
[ci skip] Fix UPGRADING section for the mt_srand() default
This is an existing function and thus belongs into section 5, not section 6.
2023-07-10 19:10:41 +02:00
Marc Bennewitz
e85fb0902c
number_format() Support rounding negative places
Closes GH-11487
2023-07-09 14:05:32 +01:00
Arnaud Le Blanc
627a7e4f49 [ci skip] UPGRADING
See GH-9104
2023-07-08 22:52:58 +02:00
Niels Dossche
49864198cc [ci skip] NEWS and UPGRADING
Closes GH-11577.
2023-07-07 18:08:20 +02:00
Tim Düsterhus
61251093ab
Deprecate MT_RAND_PHP (#11560)
see https://wiki.php.net/rfc/deprecations_php_8_3#mt_rand_php
2023-07-07 12:16:48 +02:00
Tim Düsterhus
3d0cb90a1d
[ci skip] Fix ordering in deprecation sections in UPGRADING 2023-07-07 12:14:39 +02:00
Niels Dossche
f16b34f1d0 Implement GH-10024: support linting multiple files at once using php -l
This is supported in both the CLI and CGI modes. For CLI this required
little changes.

For CGI, the tricky part was that the options parsing happens inside the
loop. This means that options passed after the -l flag were previously
simply ignored. As we now re-enter the loop we would parse the options
again, and if they are handled but don't set the script name, then CGI
will think you want to read from standard in. To keep the same "don't
parse options" behaviour I simply wrapped the options handling inside an
if.

Closes GH-10024.
Closes GH-10710.
2023-07-05 15:20:36 +02:00
Niels Dossche
c585c0c0d4 [ci skip] NEWS and UPGRADING 2023-07-03 21:34:52 +02:00
BohwaZ
ddd9a08f56
[RFC] Transition SQLite3 to exceptions (#11058)
* Deprecate warnings in SQLite3, change returned exception class to SQLite3Exception

RFC: https://wiki.php.net/rfc/sqlite3_exceptions

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2023-07-03 14:30:52 +01:00
Tim Düsterhus
49ef6e209d
RFC: Add #[Override] attribute (#9836)
* Add #[Override] attribute

* Move #[\Override] tests into Zend/tests/attributes/override/

* Check `check_only` before removing `ZEND_ACC_OVERRIDE`

* NEWS/UPGRADING for #[\Override]
2023-06-29 20:23:53 +02:00
Remi Collet
b406f7c67a
zip extension version 1.22.1
- add ZipArchive::FL_OPEN_FILE_NOW to open the file when added
  instead of waiting for archive to be closed
2023-06-29 15:21:15 +02:00
Remi Collet
a2f75eb56c
[ci skip] ZipArchive::FL_RECOMPRESS constant is deprecated (doc) 2023-06-28 14:44:33 +02:00
Niels Dossche
f37884215c [ci skip] UPGRADING 2023-06-27 18:04:11 +02:00
Remi Collet
ddb6cadb4c
NEWS and UPGRADING for zip 1.22.0 2023-06-26 16:43:59 +02:00
hanshenrik
3b0e61956e
fix file() flags error-check
the old flag check was flawed and would miss some flags, for example:
file(__FILE__, FILE_APPEND);
is invalid, but the old flags error check would miss it: https://3v4l.org/b2W9u

Closes GH-11483
2023-06-23 11:06:24 +02:00
Remi Collet
21aaf3321f
check PQsetErrorContextVisibility availability (libpq >= 9.6) 2023-06-21 08:47:59 +02:00
Niels Dossche
68591632b2
[RFC] Implement mb_str_pad() (#11284)
Closes GH-10203.
2023-06-20 21:22:04 +02:00
nielsdos
ad5ee8a2b7 Revert changes to DOMAttr::$value and DOMAttr::$nodeValue expansion
Closes GH-11469.
2023-06-19 19:52:28 +02:00
George Peter Banyard
798c40a739
[RFC] Define proper semantics for range() function (#10826)
RFC: https://wiki.php.net/rfc/proper-range-semantics
2023-06-19 14:25:26 +01:00
David CARLIER
b0d8c10fd9 ext/gd: imagerotate removes ignore_transparent argument.
seems to be a relic of PHP 5 but no longer makes sense in regard of gdImageRotateInterpolated.

Close GH-11426
2023-06-19 12:32:08 +01:00
Ilija Tovilo
b3e33be443
Forward shutdown exceptions to user error handlers
Fixes GH-10695
Closes GH-110905
2023-06-15 17:11:22 +02:00
David CARLIER
dd8514a0bd ext/pgsql: adding pg_set_error_context_visibility.
another level of context for pg_last_error/pg_result_error() to include
or not the context in those. PQSHOW_CONTEXT_ERRORS being the default.

Close GH-11395
2023-06-13 18:07:39 +01:00
Niels Dossche
d22d0e26dc Implement GH-8641: STREAM_NOTIFY_COMPLETED over HTTP never emitted
This adds support for the completed event. Since the read handler could
be entered twice towards the end of the stream we remember what the eof
flag was before reading so we can emit the completed event when the flag
changes to true.

Closes GH-10505.
2023-06-10 19:47:36 +02:00
Niels Dossche
79d024ac0e
Allow final modifier when using a method from a trait (#11394)
Fixes GH-11388.

Following https://wiki.php.net/rfc/horizontalreuse which introduced traits,
this should be allowed.
The implementation was refactored in 3f8c729. That commit is the first time
the "final" check appears AFAICT, but no reason was given for why. That
commit seems to have landed in 5.4.11 and the NEWS for that version doesn't
seem to mention something relevant to the behaviour change.
This patch removes the restriction of the final modifier.

Closes GH-11394.
2023-06-07 23:53:21 +02:00
Tim Starling
0cc028c374 Changelog notes for DOMAttr value and nodeValue properties 2023-06-05 20:12:28 +02:00
Niels Dossche
61e1f8aaeb Let closure created from magic method accept named parameters
Implements GH-11348.

Closes GH-11364.
2023-06-05 20:03:09 +02:00
David CARLIER
16a63d7b07 ext/pgsql: php_pgsql_convert converts E_NOTICE to TypeError/ValueError exceptions.
Close GH-11238
2023-06-05 15:31:39 +01:00
Ilija Tovilo
0b1d750d91
Allow arbitrary expressions in static variable initializer
Closes GH-9301
2023-05-24 20:17:31 +02: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
f31d253849 ext/pgsql adding PGSQL_ERRORS_SQLSTATE constant support.
Close GH-11181
2023-05-05 15:08:27 +01:00
Cédric Anne
c02348cf9d
Make SERVER_SOFTWARE compliant with RFC3875 (#11093) 2023-05-05 12:43:34 +01: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
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
bbe42a5ccd [skip ci] UPGRADING highligh last intl deprecation difference 2023-04-29 11:44:33 +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
David CARLIER
976d7ed4c6 ext/intl: deprecate U_MULTIPLE_DECIMAL_SEPERATORS constant
Close GH-10980
2023-04-23 10:37:55 +01:00
Máté Kocsis
414f71a902
Typed class constants (#10444)
RFC: https://wiki.php.net/rfc/typed_class_constants

Co-Authored-By: Ben <7127204+moliata@users.noreply.github.com>
Co-Authored-By: Bob Weinand <3154871+bwoebi@users.noreply.github.com>
Co-Authored-By: Ilija Tovilo <ilija.tovilo@me.com>
2023-04-16 22:20:26 +02:00
Alex Dowad
a62d192ede Add additional note on mb_encode_mimeheader in UPGRADING 2023-04-10 19:43:40 +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
Alex Dowad
d64c7184d4 Remove unneeded occurrences of my name in UPGRADING
In NEWS, each 'news item' is suffixed with the name of the developer
who implemented the change. When adding entries to UPGRADING, I used
the same format as NEWS, without thinking about it much. However, it
has come to my attention that the standard format for entries in
UPGRADING does not include the developer's name.
2023-04-10 19:35:35 +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
Máté Kocsis
0a169cbd5b
Add forgotten upgrading note for the Readonly amendments RFC 2023-04-03 22:07:36 +02:00
David CARLIER
717f460fa4
ext/posix: posix_eaccess little update and forgotten UPGRADING entry. (#10965) 2023-03-29 20:08:42 +01: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
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
David CARLIER
feb82d91b9
pgsql_insert fix unit tests (#10860) 2023-03-15 22:57:25 +00:00
David Carlier
90a39fd52c ext/mysqi: mysqli_poll raises a ValueError on absent 1st and 2ng arguments. 2023-03-15 17:49:31 +00: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
George Peter Banyard
67b5e6b819
[skip ci] Update UPGRADING for saner array_(sum|product)() RFC 2023-03-07 15:49:00 +00: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
othercorey
e1967ca9ed
Change DOMCharacterData::appendData return type to true (#10690) 2023-02-25 21:42:10 +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
Niels Dossche
821fc55a68
Implement GH-9826: Make class_alias() work with internal classes (#10483)
We can't increase the refcount of internal classes during request time.
To work around this problem we simply don't refcount aliases anymore and
add a check in the destruction to skip aliases entirely.
There were also some checks which checked for an alias implicitly by
comparing the refcount, these have been replaced by checking the type of
the zval instead.
2023-02-22 11:47:32 +01:00
George Peter Banyard
1e769bd1bf
[skip ci] Add FFI BC to UPGRADING
Follow-up on commit 851e4623f5
2023-02-20 13:52:30 +00:00
Niels Dossche
e52684ea8a
Fix GH-10377: Unable to have an anonymous readonly class
This fixes the oversight that an anonymous class should be able to be
readonly. Other identifiers such as final and abstract do not make
sense. As we still want nice errors for when users try to use these
modifiers, or use multiple modifiers, we introduce a new function
zend_add_anonymous_class_modifier that will perform verification for
anonymous class modifiers, just like zend_add_class_modifier does for
non-anonymous classes.

Closes GH-10381
2023-02-20 13:32:26 +01:00
Cristian Rodríguez
5e617d0b4d
proc_open: reject array with empty command name (#10559) 2023-02-18 18:48:11 +00:00
David Carlier
19a7281efa sockets add SO_RERROR/SO_ZEROIZE/SO_SPLICE net/openbsd's constants.
Closes GH-10563.
2023-02-12 21:55:55 +00:00
David Carlier
908d954de0 sockets updlite protocol support, with checksum coverage settings.
Close GH-10468
2023-01-29 18:19:54 +00:00
Ilija Tovilo
02bd52b5a8
Implement dynamic class const fetch
https://wiki.php.net/rfc/dynamic_class_constant_fetch

Closes GH-9793
2023-01-26 16:46:34 +01:00
Máté Kocsis
016160800c
Fix GH-10259 ReflectionClass::getStaticProperties doesn't need null return type (#10418) 2023-01-24 22:26:52 +01:00
Tim Düsterhus
c59e0750af
password: Use php_random_bytes_throw in php_password_make_salt (#10393)
The CSPRNG failing should be rare nowadays, but it *might* happen and without
this patch it's hard for the user to find out why the salt generation failed:
The error message is not actionable.

This patch will automatically set the CSPRNG exception to the `$previous`
exception of the ValueError that is thrown, allowing the developer to determine
the cause of the salt generation failure.

Before:

    Fatal error: Uncaught ValueError: Unable to generate salt in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}
      thrown in php-src/test3.php on line 3

After:

    Fatal error: Uncaught Random\RandomException: Cannot open /dev/urandom: No such file or directory in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}

    Next ValueError: Unable to generate salt in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}
      thrown in php-src/test3.php on line 3
2023-01-23 18:35:16 +01:00
David Carlier
b60761ab97 [ci skip] UPGRADING 2023-01-23 12:16:25 +00:00
David Carlier
256a34ed15 strtok warns in case the string to split was not set.
Close GH-10016.
2023-01-23 12:13:49 +00:00
David Carlier
f8f7fd2db1 sockets add AF_DIVERT constant.
Allow to bind a socket to a divert port without being concerned
by its address. for ipfw filter purpose (SO_USER_COOKIE constant).
FreeBSD only.

Close GH-10415.
2023-01-22 22:48:45 +00:00
Máté Kocsis
1f05d6ef80
Fix GH-10292 make the default value of the first parame of srand() and mt_srand() nullable (#10380)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2023-01-20 23:35:08 +01:00
Arnaud Le Blanc
db6840bda4 [ci skip] UPGRADING
GH-10149
2023-01-20 17:10:52 +01:00
David Carlier
9198e8894b socket DF flag on UDP socket via IP_MTU_DISCOVER on Linux and IP_DONTFRAGMENT on FreeBSD for path MTU discovery purpose.
idea proposal via ml :
https://marc.info/?l=php-internals&m=167329288509393&w=2

Close GH-10282
2023-01-12 22:22:30 +00:00
David Carlier
55d19eee49 posix adding posix_fpathconf.
follow-up on GH-10238 but with the file descriptor flavor.

Close GH-10253
2023-01-12 22:15:31 +00:00
Alex Dowad
39b46a5398 Implement Unicode conditional casing rules for Greek letter sigma
The capital Greek letter sigma (Σ) should be lowercased as σ except
when it appears at the end of a word; in that case, it should be
lowercased as the special form ς.

This rule is included in the Unicode data file SpecialCasing.txt.
The condition for applying the rule is called "Final_Sigma" and is
defined in Unicode technical report 21. The rule is:

• For the special casing form to apply, the capital letter sigma must
  be preceded by 0 or more "case-ignorable" characters, preceded by
  at least 1 "cased" character.
• Further, capital sigma must NOT be followed by 0 or more
  case-ignorable characters and then at least 1 cased character.

"Case-ignorable" characters include certain punctuation marks, like
the apostrophe, as well as various accent marks. There are actually
close to 500 different case-ignorable characters, including accent marks
from Cyrillic, Hebrew, Armenian, Arabic, Syriac, Bengali, Gujarati,
Telugu, Tibetan, and many other alphabets. This category also includes
zero-width spaces, codepoints which indicate RTL/LTR text direction,
certain musical symbols, etc.

Since the rule involves scanning over "0 or more" of such
case-ignorable characters, it may be necessary to scan arbitrarily far
to the left and right of capital sigma to determine whether the special
lowercase form should be used or not. However, since we are trying to
be both memory-efficient and CPU-efficient, this implementation limits
how far to the left we will scan. Generally, we scan up to 63 characters
to the left looking for a "cased" character, but not more.

When scanning to the right, we go up to the end of the string if
necessary, even if it means scanning over thousands of characters.

Anyways, it is almost impossible to imagine that natural text will
include "words" with more than 63 successive apostrophes (for example)
followed by a capital sigma.

Closes GH-8096.
2023-01-12 17:41:11 +02:00
David Carlier
69d49e4dd7 posix adding posix_pathconf.
to get configuration variables from a directory/file.
Closes GH-10238.
2023-01-06 14:59:02 +00:00
George Peter Banyard
5c64cf58f7 [ci skip] Add UPGRADING entry for posix changes 2023-01-04 20:00:05 +00:00
David Carlier
9c2572565a sockets adding TCP_QUICKACK constant.
having tigher control on ACK delays, difference is the setting
is `volatile` as it can be turned off by the kernel if not set
 explicitally set otherwise on the socket.

Closes GH-10145.
2022-12-22 14:50:33 +00:00
Arnaud Le Blanc
027add9e1b [ci skip] UPGRADING 2022-12-16 18:14:22 +01:00
Tim Düsterhus
f9a1a90380
Add Randomizer::nextFloat() and Randomizer::getFloat() (#9679)
* random: Add Randomizer::nextFloat()

* random: Check that doubles are IEEE-754 in Randomizer::nextFloat()

* random: Add Randomizer::nextFloat() tests

* random: Add Randomizer::getFloat() implementing the y-section algorithm

The algorithm is published in:

Drawing Random Floating-Point Numbers from an Interval. Frédéric
Goualard, ACM Trans. Model. Comput. Simul., 32:3, 2022.
https://doi.org/10.1145/3503512

* random: Implement getFloat_gamma() optimization

see https://github.com/php/php-src/pull/9679/files#r994668327

* random: Add Random\IntervalBoundary

* random: Split the implementation of γ-section into its own file

* random: Add tests for Randomizer::getFloat()

* random: Fix γ-section for 32-bit systems

* random: Replace check for __STDC_IEC_559__ by compile-time check for DBL_MANT_DIG

* random: Drop nextFloat_spacing.phpt

* random: Optimize Randomizer::getFloat() implementation

* random: Reject non-finite parameters in Randomizer::getFloat()

* random: Add NEWS/UPGRADING for Randomizer’s float functionality
2022-12-14 17:48:47 +01:00
Tim Düsterhus
16ce751f39
[ci skip] Add json_validate() RFC link to UPGRADING 2022-12-09 17:55:32 +01:00
Joshua Rüsweg
ac3ecd03af
Add Randomizer::getBytesFromString() method (#9664)
* Add `Randomizer::getBytesFromAlphabet()` method

* Rename `getBytesFromAlphabet` to `getBytesFromString`

* [ci skip] Add NEWS/UPGRADING for Randomizer::getBytesFromString()

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2022-12-09 17:39:13 +01:00
Tim Düsterhus
dd8de1e726
Promote unserialize() notices to warning (#9629)
* Unserialize: Migrate "Unexpected end of serialized data" to E_WARNING

* Unserialize: Migrate "Error at offset %d of %d bytes" to E_WARNING

* Unserialize: Migrate "%s is returned from __sleep() multiple times" to E_WARNING

* Add NEWS for “Promote unserialize() notices to warning”
2022-11-15 19:36:38 +01:00
David Carlier
e0e347b4a8 Fix GH-9923: Add the SIGINFO constant in pcntl for system supporting it.
Closes #9938
2022-11-12 19:37:32 +00:00
David CARLIER
4c4e72f149 socket add socket_atmark support.
checks whether the socket belongs to the out-of-band mark, thus allows to be
 processed accordingly (using the MSG_OOB flag on send/recv).

Closes #9846.
2022-10-31 16:38:18 +00:00
Ilija Tovilo
d10a04b391
Allow specifying resource in posix_getrlimit() for single result
Closes GH-9790
2022-10-27 10:46:09 +02:00
Jakub Zelenka
18fe337bae
Fix bug #51056: fread() on blocking stream will block even if data is available
This is applied only on socket connection which already returns
immediately if there is no data in the buffer.
2022-10-16 12:17:47 +01:00
Arnaud Le Blanc
69eb38b460 [ci skip] UPGRADING 2022-10-14 12:25:17 +02:00
Tyson Andre
68301b14b4 [skip ci] Add docs for json_validate in UPGRADING* 2022-10-08 09:52:19 -04:00
George Peter Banyard
cc0bd85e85
Update UPGRADING with gc_status() changes 2022-10-04 13:56:31 +01:00
David Carlier
615b8006c4 socket module add SO_ATTACH_REUSEPORT_CPBF for Linux.
to be used in conjunction with SO_REUSPORT, giving a greater control
over how we bind a socket instead of the round robin workflow, we do
 instead attach to the processor id as :
- we assign the processor_id to A in the BPF filter.
- then returns A.

in other words, a more modern version of SO_INCOMING_CPU (ie can have a per
 worker notion we do not use here).
Closes #8062
2022-09-29 23:32:39 +01:00
Tim Düsterhus
14f22e9294
[ci skip] Fix formatting in UPGRADING
- Remove `k` typo that was accidentally added in a headline separator.
- Remove premature hard break after very short line length.
- Remove dots at the end of constant lists (not used in 8.2).
2022-09-04 21:01:28 +02:00
David Carlier
25311214e7 [ci skip] UPGRADING striping name. 2022-09-04 19:54:16 +01:00
David Carlier
6d5770c250 [ci skip] NEWS UPGRADING 2022-09-04 19:52:21 +01:00
Pierrick Charron
327c95237c
Prepare for PHP 8.3 2022-08-30 11:17:15 -04:00
Christoph M. Becker
853181a14d
Add NEWS and UPGRADING entries for GH-9296 2022-08-30 16:59:39 +02:00
Tim Starling
11796229f2
Add libxml_get_external_entity_loader()
Add libxml_get_external_entity_loader(), which returns the currently
installed external entity loader, i.e. the value which was passed to
libxml_set_external_entity_loader() or null if no loader was installed
and the default entity loader will be used.

This allows libraries to save and restore the loader, controlling entity
expansion without interfering with the rest of the application.

Add macro Z_PARAM_FUNC_OR_NULL_WITH_ZVAL(). This allows us to get the
zval for a callable parameter without duplicating callable argument
parsing.

The saved zval keeps the object needed for fcc/fci alive, simplifying
memory management.

Fixes #76763.
2022-08-28 12:47:20 +01:00
Jakub Zelenka
35e2a25d83
Add openssl_cipher_key_length function
This function works in exactly the same way as openssl_cipher_iv_length
but for a key length. This is especially useful to make sure that the
right key length is provided to openssl_encrypt and openssl_decrypt.

In addtion the change also updates implementation of
openssl_cipher_iv_length and adds a test for it.
2022-08-28 12:27:16 +01:00
Jakub Zelenka
39b2380c34
[ci skip] Add note about chacha20-poly1305 additon to UPGRADING 2022-08-28 12:26:37 +01:00
George Peter Banyard
66aed3a86f SameSite session cookie prop should behave like other INI settings
It should warn if the INI setting is changed after headers are sent or a session is not active
2022-08-22 16:09:46 +01:00
sji
038c451c22
[ci skip] NEWS and UPGRADING for constants in traits (#9251)
see GH-8888
2022-08-04 23:18:50 +02:00
Tim Düsterhus
3331832b04
Add ext/random Exception hierarchy (#9220)
* Add Random\Random{Error,Exception} and Random\BrokenRandomEngineError

* Throw BrokenRandomEngineError

* Throw RandomException on seeding failure

* Throw RandomException when CSPRNG fails

* Remove unused include from ext/random/engine_combinedlcg.c

* Remove unused include from ext/random/engine_secure.c

* Remove unused include from ext/random/random.c

* [ci skip] Add ext/random Exception hierarchy to NEWS

* [ci skip] Add the change of Exception for random_(int|bytes) to UPGRADING
2022-08-02 20:04:28 +02:00
Jakub Zelenka
e5ab9f45d5
Fix bug #65489: glob() basedir check is inconsistent
This removes the inconsistent and incorrectly working open basedir check
on pattern in glob. It means that an empty array will be returned even
if the whole pattern is outside the open basedir restriction.
2022-08-02 18:36:29 +01:00
Jakub Zelenka
1a9e6895f1
Fix #65069: GlobIterator incorrect handling of open_basedir check
This PR changes the glob stream wrapper so it impacts "glob://"
streamsas well. The idea is to do a check for each found path instead
of the pattern which was not working correctly.
2022-07-28 11:42:42 +01:00
Martin Herndl
229b189293
[ci skip] Fix str_split NEWS and UPGRADE note
Closes GH-9123.
2022-07-25 13:45:01 +02:00
George Peter Banyard
3c372901bd Add support to pass driver flags to DBA handlers
Currently only LMDB with DBA_LMDB_USE_SUB_DIR/DBA_LMDB_NO_SUB_DIR are supported
2022-07-23 18:38:27 +01:00
Tim Düsterhus
065e284f8e [ci skip] Link the random extension RFCs in UPGRADING
see 4d8dd8d258
2022-07-19 17:44:22 +02:00
Tim Düsterhus
7ae7df5b46
RFC: Make the iterator_*() family accept all iterables (#8819)
https://wiki.php.net/rfc/iterator_xyz_accept_array
2022-07-19 16:46:32 +02:00
dixyes
745cf34ffc
Port standard/crc32 for windows arm64
We also add arm64 support for php_get_windows_cpu().

Closes GH-7703.
2022-07-19 13:23:44 +02:00
Kamil Tekiela
079773c291
Merge branch 'IS_MARIADB'
* IS_MARIADB:
  Deprecate MYSQLI_IS_MARIADB
2022-07-19 11:21:26 +01:00
Kamil Tekiela
5a69cb6fa1
Deprecate MYSQLI_IS_MARIADB
Closes GH-8919
2022-07-19 11:19:41 +01:00
Go Kudo
4d8dd8d258
Implement Random Extension
https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement
2022-07-19 10:27:38 +01:00
Ilija Tovilo
7aadbcb8f4
GH-8344 Fetch properties of enums in const expressions 2022-07-18 23:52:28 +02:00
root
d8fc05c05e
Add FILTER_FLAG_GLOBAL_RANGE to filter Global IPs as per RFC 6890 2022-07-18 17:56:05 +01:00
Mikhail Galanin
ffdf25a270
Add "error_log_mode" setting 2022-07-18 15:41:28 +01:00
Jakub Zelenka
0a4a55fd44
Allow to not close stream on rscr dtor in php cli sapi 2022-07-18 10:58:50 +01:00
Tim Düsterhus
332ac8ec25
[ci skip] Add DNF types to UPRADING (#9031)
see #8725
2022-07-17 12:43:55 +01:00
Rowan Tommins
af15923bc3
Extend deprecation notices to is_callable($foo) and callable $foo
Implements https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices
so that uses of "self" and "parent" in is_callable() and callable
type constraints now raise a deprecation notice, independent of the
one raised when and if the callable is actually invoked.

A new flag is added to the existing check_flags parameter of
zend_is_callable / zend_is_callable_ex, for use in internal calls
that would otherwise repeat the notice multiple times. In particular,
arguments to internal function calls are checked first based on
arginfo, and then again during ZPP, so the former suppresses the
deprecation notice.

Some existing tests which raised this deprecation have been updated
to avoid the syntax, but the existing version retained for maximum
regression coverage until it is made an error.

With thanks to Juliette Reinders Folmer for the RFC and initial
investigation.

Closes GH-8823.
2022-07-14 17:07:42 +02:00
Christoph M. Becker
56804e3221
Fix GH-8750: Can not create VT_ERROR variant type
We add support for creating `VT_ERROR` variants via `__construct()`,
and allow casting to int via `variant_cast()` and `variant_set_type()`.
We do not, however, allow type conversion by other means, to avoid
otherwise easily introduced type confusion.  VB(A) also only allows
explicit type conversion.

We also introduce `DISP_E_PARAMNOTFOUND` which might be the most
important `scode` for this purpose, since this allows to skip optional
parameters in method calls.

Closes GH-8886.
2022-07-12 16:43:14 +02:00
David Carlier
185d604d56 NEWS/UPGRADING changes 2022-07-10 21:30:08 +01:00
Arnaud Le Blanc
d217a669fc [ci skip] NEWS 2022-07-10 15:18:51 +02:00
Michael Voříšek
e80925445c Fix GH-8924 str_split of empty string must return empty array
Closes #8945.
2022-07-08 15:49:45 +01:00
Kamil Tekiela
012abcdb52
Update UPGRADING 2022-07-06 12:28:54 +01:00
Sebastian Bergmann
eb5b12c225
[ci skip] Fix typo 2022-07-03 07:16:53 +02:00
David Carlier
fdc09e302a Fix GH-8907: Document forgotten API changes.
binary safe string comparisons and recent socket option addition.

Closes #8910.
2022-07-02 20:42:39 +01:00
Remi Collet
63c7418b91
[ci skip] NEWS and UPGRADING 2022-06-28 15:19:56 +02:00
Ayesh Karunaratne
526af6ea67
[ci skip] Add true type support to UPGRADING file
Closes GH-8826.
2022-06-19 12:28:35 +02:00
tobil4sk
5bb3e233db
Implement #77726: Allow null character in regex patterns
In 8b3c1a3, this was disallowed to fix #55856, which was a security
issue caused by the /e modifier. The fix that was made was the
"Easier fix" as described in the original report.

With this fix, pattern strings are no longer treated as null terminated,
so null characters can be placed inside and matched against with regex
patterns without security problems, so there is no longer a reason to
give the error. Allowing this is consistent with the behaviour of many
other languages, including JavaScript, and thanks to PCRE2[0], it does
not require manually escaping null characters. Now that we can avoid the
error here without the cost of escaping characters, there is really no
need anymore to stray here from the conventional behaviour.

Currently, null characters are still disallowed before the first
delimiter and in the options section at the end of a regex string, but
these error messages have been updated.

[0] Since PCRE2, pattern strings no longer have to be null terminated,
and raw null characters match as normal.

Closes GH-8114.
2022-06-17 19:30:44 +02:00
Arnaud Le Blanc
efc8f0ebf8
Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)
Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number parsing.
They also check for a 'K', 'M', or 'G' at the end of the string,
and multiply the parsed value out accordingly.

Unfortunately, they ignore any other non-numerics between the
numeric component and the last character in the string.
This means that numbers such as the following are both valid
and non-intuitive in their final output.

* "123KMG" is interpreted as "123G" -> 132070244352
* "123G " is interpreted as "123 " -> 123
* "123GB" is interpreted as "123B" -> 123
* "123 I like tacos." is also interpreted as "123." -> 123

Currently, in php-src these functions are used only for parsing ini values.

In this change we deprecate zend_atol(), zend_atoi(), and introduce a new
function with the same behavior, but with the ability to report invalid inputs
to the caller. The function's name also makes the behavior less unexpected:
zend_ini_parse_quantity().

Co-authored-by: Sara Golemon <pollita@php.net>
2022-06-17 14:12:53 +02:00
Pierrick Charron
b9af4335e3
Add new curl_upkeep() function 2022-06-13 18:15:21 -04:00
Pierrick Charron
cec20f615d
Expose new constants from libcurl 7.62 to 7.80 2022-06-13 18:15:21 -04:00
Rowan Tommins
d9f3ca705c
Add deprecation notices to utf8_encode and utf8_decode
Implements initial stage of accepted RFC to remove them:
https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode

Tests relating to SOAP and htmlspecialchars seem to have been
using this entirely unnecessarily, so have been fixed.

Closes GH-8726.
2022-06-12 13:37:23 +02:00
David CARLIER
6b02cabc8a Add SO_SETFIB FreeBSD socket option constant.
Aims to set the route table.
Closes #8742.
2022-06-11 13:03:21 +01:00
George Peter Banyard
dbf1cafd77
Remove internal usage of SplFileInfo::_bad_state_ex() method (#8318)
* Use standard VM handling instead
 * Deprecate the method as it is now useless
2022-06-09 13:24:58 +01:00
David Carlier
d677cc13ce Add SO_BPF_EXTENSIONS flag to socket.
Returns the supported bpf extensions from the kernel. Linux only.
Closes GH-8713.
2022-06-08 05:14:57 +01:00
George Peter Banyard
80fda5ff9e [skip ci] Update UPGRADING in regards to iterable compile time alias 2022-06-07 13:48:47 +01:00
David Carlier
6fe7ff95d9 Implements ancillary data on NetBSD.
With the couple LOCAL_CREDS/SCM_CREDS, in this system we get all the
infos needed (included the process id).
Closes GH-8700.
2022-06-06 23:06:01 +01:00
David CARLIER
f813520b50
Implements socket ancillary data on FreeBSD. (#7708)
using LOCAL_CREDS_PERSISTENT/SCM_CREDS2 instead so we also get the send process id.
2022-06-02 14:08:03 +01:00
Kamil Tekiela
2d1a320ba9
UPGRADING for libmysql change 2022-05-30 16:22:48 +01:00
Máté Kocsis
1d168a448b
Add upgrading entry for DatePeriod property changes
[skip ci]
2022-05-28 08:50:03 +02:00
Calvin Buckley
2920a26636
Quote when adding to connection string in (PDO_)ODBC
Because the UID= and PWD= values are appended to the SQLDriverConnect
case when credentials are passed, we have to append them to the string
in case users are relying on this behaviour. However, they must be
quoted, or the arguments will be invalid (or possibly more injected).
This means users had to quote arguments or append credentials to the raw
connection string themselves.

It seems that ODBC quoting rules are consistent enough (and that
Microsoft trusts them enough to encode into the .NET BCL) that we can
actually check if the string is already quoted (in case a user is
already quoting because of this not being fixed), and if not, apply the
appropriate ODBC quoting rules.

This is because the code exists in main/, and are shared between
both ODBC extensions, so it doesn't make sense for it to only exist
in one or the other. There may be a better spot for it.

Closes GH-8307.
2022-05-27 16:56:44 +02:00
Arnaud Le Blanc
059474a846 [ci skip] NEWS, UPGRADING 2022-05-27 14:08:22 +02:00
Máté Kocsis
df77fee28d
Add upgrading entry for ext/tidy property changes
[skip ci]
2022-05-26 08:32:06 +02:00
Máté Kocsis
54de945b87
Added a few missing punctuation marks in UPGRADING 2022-05-23 09:51:43 +02:00
Máté Kocsis
7ec2950d79
Add upgrading entry for readonly classes 2022-05-23 09:48:41 +02:00
David CARLIER
016ac7c132
[skip ci] UPGRADING note update, follow-up #8411 (#8598) 2022-05-21 12:12:09 +02:00
Christoph M. Becker
33fc9e5a77
Build ext/zip as shared library by default on Windows
This allows users to use PECL/zip, which is well maintained and often
brings new features which are not yet available in ext/zip, as drop-in
replacement for the official Windows php-src builds.

Closes GH-8549.
2022-05-20 14:31:32 +02:00
David Carlier
1f4830f21a
Add TCP_NOTSENT_LOWAT socket option
Can be used to limit the amount of unsent data per socket.

Closes GH-8559.
2022-05-16 16:01:38 +02:00
David Carlier
10921525e6
Add CURLOPT_MAXFILESIZE_LARGE option
Like other *LARGE options, it takes a 64 bit value.

Closes GH-8557.
2022-05-16 11:01:28 +02:00
Máté Kocsis
8b991b4ae4
Add static return type for DateTime*::createFrom*() when possible
Fix GH-8544
2022-05-13 12:13:48 +02:00
Ollie Read
f590782b60
Add ReflectionMethod::hasPrototype method
Closes GH-8487.
2022-05-09 16:48:54 +02:00
Nicolas Grekas
be11bcb0b1
Add ReflectionFunction::isAnonymous()
Closes GH-8499.
2022-05-09 12:56:10 +02:00
Ilija Tovilo
4556f9db5a
[skip ci] Fix alternative string interpolation suggestion in UPGRADING 2022-05-05 17:49:20 +02:00
Ilija Tovilo
9a90bd7054
Deprecate ${} string interpolation
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-05-05 10:14:56 +02:00
David Carlier
7a45dcfe2e
Introduce CURLOPT_XFERINFOFUNCTION
`CURLOPT_XFERINFOFUNCTION` is available as of cURL 7.32.0, and
supersedes `CURLOPT_PROGRESSFUNCTION` which is still supported by
latest cURL, though.

Closes GH-7823.
2022-04-22 18:09:06 +02:00
George Peter Banyard
7061c40f43
[skip-ci] update UPGRADING 2022-04-20 17:43:10 +01:00
bohwaz
2973b9f02a
Allow user to change SQLITE_DEFENSIVE if needed
Closes GH-8200.
2022-04-11 17:08:48 +02:00
George Peter Banyard
3931d726c4
Add missing ZPP checks in SPL Directory (#8325)
Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
2022-04-08 17:58:10 +01:00
Ilija Tovilo
cdf7240f75
[skip ci] Remove superfluous backslash in UPGRADING 2022-04-08 11:00:28 +02:00
Tim Düsterhus
9085197734
Implement the "Redacting parameters in back traces" RFC
https://wiki.php.net/rfc/redact_parameters_in_back_traces
2022-04-08 10:36:16 +02:00
Paragon Initiative Enterprises
afd8f84c1a
Add sodium_crypto_stream_xchacha20_xor_ic()
There are many use-cases where a PHP user is currently using sodium_compat's implementation of this low-level XChaCha20 API. For example, multi-part message processing (in low-memory settings) for a ciphertext that was encrypted with XChaCha20-Poly1305 (rather than the secretstream API).

Adding this function to ext/sodium offers better performance and lowers users' memory usage with the polyfill, and ensures that users coming from other languages that provide libsodium bindings have a more consistent experience with our bindings. This is a win-win.

This patch follows the libsodium precedent of adding functions instead of optional parameters to existing functions. The parameter order is also consistent with the C API.

https://doc.libsodium.org/advanced/stream_ciphers/xchacha20#usage

Closes GH-8276.
2022-04-04 15:43:42 +02:00
Patrick Allaert
67440096c5
Added: [zend_]memory_reset_peak_usage() (#8151) 2022-03-04 13:24:08 +01:00
Christoph M. Becker
f06ac9a486
Fix GH-7939: Cannot unserialize IntlTimeZone objects
As it is now, `IntlTimeZone`, `IntlCalendar` and `IntlDateFormatter`
and some other intl class instances can be serialized, but the
representation is meaningless, and unserialization yields uninitialized/
unusable objects.  To prevent users from noticing this too late, we deny
serialization of such objects in the first place.

Closes GH-7945.
2022-02-17 15:06:29 +01:00
David Carlier
3414ae6c0c
sockets: add SO_INCOMING_CPU constant
get/set the cpu attached to a socket, no special treatment needed,
it is simply an integer.

Closes GH-7753.
2021-12-20 14:58:09 +01:00
Christoph M. Becker
30a3280df7
Oracle Client 10g is no longer supported
Thus, we drop respective config option for Windows.
2021-12-15 22:09:58 +01:00
Yannis Guyon
38460c2c94
Implement php_handle_avif() using libavifinfo
See #80828 and the internals@ mailing list discussion at
https://externals.io/message/116543

Use libavifinfo's AvifInfoGetFeaturesStream() in php_handle_avif() to
get the width, height, bit depth and channel count from an AVIF
payload. Implement stream reading/skipping functions and data struct.
Use libavifinfo's AvifInfoIdentifyStream() in php_is_image_avif().

Update the expected features read from "test1pix.avif" in
getimagesize.phpt.

Closes GH-7711.
2021-12-15 20:27:40 +01:00
Tim Starling
8eee0d6130
Make strtolower() and strtoupper() do ASCII case conversion (#7506)
Implement RFC https://wiki.php.net/rfc/strtolower-ascii
2021-12-15 08:38:35 -05:00
Christopher Jones
93f6af6913
It's past time to drop linking support for Oracle Client 10g 2021-12-12 13:58:04 +11:00
Christopher Jones
ac91b83ceb
Add oci_set_prefetch_lob() 2021-12-11 21:38:08 +11:00
Nikita Popov
902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Christopher Jones
9cd7f41fac
Add oci8.prefetch_lob_size 2021-11-12 17:59:22 +11:00
George Peter Banyard
7db32add9b
Refactor dba_(p)open() to be more sensible (#7610)
Actually use ZPP
Throw ValueErrors for invalid values
Use dedicated struc members for file permission and map size instead of a zval stack
2021-11-06 23:09:40 +00:00
DmitryMaksimov
2b32cafd88
Use neutral language instead of default on Windows
Most notably, this affects some Windows specific error messages, which
are no longer in the default language of the system, to better match
error messages provided by PHP which are not localized anyway.

This also affects the com_dotnet extension, where it could fix some
DCOM related issues.  Furthermore, the constant `LOCALE_NEUTRAL` is
added, which can be used for `variant_cmp()`.

Closes GH-7613.
2021-11-03 19:39:20 +01:00
Felipe Pena
e089a50f53 Add support for PCRE n modifier
Add support for /n (NO_AUTO_CAPTURE) modifier, which makes simple
`(xyz)` groups non-capturing.

Closes GH-7583.
2021-11-03 15:17:54 +01:00
Alex Dowad
9308974f8c Deprecate use of mbstring to convert text to Base64/QPrint/HTML entities/etc
The purpose of mbstring is for working with Unicode and legacy text
encodings; but Base64, QPrint, etc. are not text encodings and don't
really belong in mbstring. PHP already contains separate implementations
of Base64, QPrint, and HTML entities. It will be better to eventually
remove these non-encodings from mbstring.

Regarding HTML entities... there is a bit more to say. mbstring's
implementation of HTML entities is different from the other built-in
implementation (htmlspecialchars and htmlentities). Those functions
convert <, >, and & to HTML entities, but mbstring does not.

It appears that the original author of mbstring intended for something
to be done with <, >, and &. He used a table to identify which
characters should be converted to HTML entities, and </>/& all have a
special value in that table. However, nothing ever checks for that
special value, so the characters are passed through unconverted.

This seems like a very useless implementation of HTML entities. The most
important characters which need to be expressed as entities in HTML
documents are those three!
2021-11-01 11:23:21 +02:00
Sergey Panteleev
5e7e654514
Fix a method name ZipArchive::clearError typo
Closes GH-7616.
2021-10-27 13:02:10 +02:00
George Peter Banyard
e56c506020
Refactor DBA
Use proper ZPP union types
Use standard function signature semantics for dba_fetch()
Re-ordering of checks
2021-10-23 12:04:23 +01:00
Nikita Popov
ee510eed68 Deprecate partially supported callables
This deprecates all callables that are accepted by
call_user_func($callable) but not by $callable(). In particular:

    "self::method"
    "parent::method"
    "static::method"
    ["self", "method"]
    ["parent", "method"]
    ["static", "method"]
    ["Foo", "Bar::method"]
    [new Foo, "Bar::method"]

RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables

Closes GH-7446.
2021-10-22 10:15:24 +02:00
Ayesh Karunaratne
d23e36da81 Add CURLINFO_EFFECTIVE_METHOD
Since Curl 7.72.0, it supports a new parameter
called `CURLINFO_EFFECTIVE_METHOD`, which returns the effect method
in HTTP(s) requests. This is similar to `CURLINFO_EFFECTIVE_URL`.

 - https://curl.se/libcurl/c/CURLINFO_EFFECTIVE_METHOD.html

This adds support for CURLINFO_EFFECTIVE_URL if ext/curl is built
with libcurl >= 7.72.0 (0x074800).

Closes GH-7595.
2021-10-21 10:33:40 +02:00
Remi Collet
e9b96ae5da
Add ZipArchive::clearError, getStreamIndex and getStreamName methods
public function clearError(): void {}
    public function getStreamIndex(int $index, int $flags = 0) {}
    public function getStreamName(string $name, int $flags = 0) {}

ZipArchive::getStream is kept for BC

See https://github.com/pierrejoye/php_zip/issues/20
2021-10-11 15:39:35 +02:00
Nikita Popov
9d8f97d58d Revert "Fix DATE_FORMAT_COOKIE definition"
This reverts commit ac34648cf6.

As pointed out on GH-6783, the new format doesn't match any of
the specified formats. Previously the constant generated

    Thursday, 14-Jul-2005 22:30:41 BST

which is obsolete. Now it generates

    Thu, 14-Jul-2005 22:30:41 BST

which is not specified at all. The correct version would be:

    Thu, 14 Jul 2005 22:30:41 BST

Reverting the change for now.
2021-09-29 09:26:40 +02:00
Mahmood Dhia
ac34648cf6 Fix DATE_FORMAT_COOKIE definition
In all of http://curl.haxx.se/rfc/cookie_spec.html,
https://docs.microsoft.com/de-de/windows/win32/wininet/http-cookies
and https://tools.ietf.org/html/rfc7234#section-5.3 the cookie
datetime is specified as Mon, DD-Mon-YYYY HH:MM:SS GMT. However,
the current definition returns Monday, DD-Mon-YYY HH:MM:SS GMT.
Therefore, the "l" in "l, d-M-Y H:i:s T" must be changed to "D".

Closes GH-6783.
2021-09-23 16:01:04 +02:00
Patrick Allaert
1c33ddb5e5
Prepare for PHP 8.2 2021-08-31 19:13:49 +02:00
Nikita Popov
a968055b77 Add UPGRADING for ini parser changes
Missed the "git add" once again...

[ci skip]
2021-08-31 10:09:34 +02:00
Nikita Popov
7b34db0659 Switch default PKCS7/CMS cipher to AES-128-CBC
Switch default cipher for openssl_pkcs7_encrypt() and
openssl_cms_encrypt() from RC2-40 to AES-128-CBC.

The RC2-40 cipher is considered insecure and is not loaded by
default in OpenSSL 3, which means that these functions will
always fail with default arguments.

As the used algorithm is embedded in the result (which makes this
different from the openssl_encrypt() case) changing the default
algorithm should be safe.

Closes GH-7357.
2021-08-16 12:31:48 +02:00
Ben Morss
eb6c9eb936
Lossless conversion for webp
Propagating lossless conversion from libgd to our bundled gd.
Changing "quantization" to "quality" as in libgd.
Adding test.

IMG_WEBP_LOSSLESS is only defined, if lossless WebP encoding is
supported by the libgd used.

Closes GH-7348.
2021-08-12 23:19:13 +02:00
Remi Collet
1100a079ed
NEWS 2021-08-11 14:21:18 +02:00
Remi Collet
5d57d9073c
NEWS 2021-08-11 13:04:23 +02:00
Nikita Popov
f2d3e75933 Do not special case export of EC keys
All other private keys are exported in PKCS#8 format, while EC
keys use traditional format. Switch them to use PKCS#8 format as
well.

As the OpenSSL docs say:

> PEM_write_bio_PrivateKey_traditional() writes out a private key
> in the "traditional" format with a simple private key marker and
> should only be used for compatibility with legacy programs.
2021-08-06 11:25:44 +02:00
Christoph M. Becker
ff8e04ac30
[ci skip] UPGRADING: oci8.old_oci_close_semantics has been deprecated 2021-07-25 14:51:15 +02:00
Nikita Popov
6780aaa532 Implement readonly properties
Add support for readonly properties, for which only a single
initializing assignment from the declaring scope is allowed.

RFC: https://wiki.php.net/rfc/readonly_properties_v2

Closes GH-7089.
2021-07-20 12:05:46 +02:00
Kamil Tekiela
052af90b86 Deprecate autovivification on false
Deprecate automatically converting "false" into an empty array
on write operands. Autovivification continues to be supported
for "null" values, as well as undefined/uninitialized values.

RFC: https://wiki.php.net/rfc/autovivification_false

Closes GH-7131.

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 14:49:37 +02:00
George Peter Banyard
453a5163ce [skip-ci] Fixup UPGRADING documents
Some entries were in the wrong section/wrong document.
2021-07-17 23:27:26 +02:00
Nikita Popov
edb6b375dd Don't return bool from Phar::offsetUnset()
This violates the ArrayAccess interface. Use offsetExists() to
check if an entry exists.
2021-07-16 16:39:27 +02:00
Nikita Popov
172f84bfe4 Add UPGRADING entry for socket options
[ci skip]
2021-07-16 12:21:21 +02:00
George Peter Banyard
0ba155cd57 Make syslog() binary safe
Closes GH-7245

Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2021-07-15 19:08:26 +02:00
Nikita Popov
53aed48e5d Allow objects in define()
This was separately discussed in https://externals.io/message/114863,
but also necessary for consistency now that
https://wiki.php.net/rfc/new_in_initializers has landed.

Closes GH-7149.
2021-07-15 10:09:56 +02:00
Joe Watkins
d0b09a7be4 Add first-class callables
Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
2021-07-14 14:37:25 +02:00
Christoph M. Becker
e1285c4aa5
Deprecate $num_points parameter of image(open|filled)polygon
Cf. <https://wiki.php.net/rfc/deprecations_php_8_1#num_points_parameter_of_image_open_filled_polygon>.

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
Co-authored-by: George Peter Banyard <7906688+Girgias@users.noreply.github.com>

Closes GH-6789.
2021-07-14 10:56:24 +02:00
Nikita Popov
4b3615a33f Deprecate strftime() and gmstrftime()
These are deprecated in favor of date()/DateTime::format() (for
locale-indendent formatting) and IntlDateFormatter::format()
(for locale-dependent formatting).

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:38:43 +02:00
Nikita Popov
9491694903 Deprecate SoapClient ssl_method option
Instead use ssl stream context options instead. The direct
equivalent would be crypto_method, but min_proto_version /
max_proto_version are recommended instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-14 09:36:26 +02:00
Nikita Popov
52d3d0d8d7 Add limited support for new in initializers
Add support for new expressions inside parameter default values,
static variable initializers, global constant initializers and
attribute arguments.

RFC: https://wiki.php.net/rfc/new_in_initializers

Closes GH-7153.
2021-07-13 14:03:20 +02:00
Nikita Popov
aa733e8ac8 Deprecate filter.default
There's a subtlety here regarding filter.default_flags. The RFC
stated that no separate deprecation warning will be emitted for
it, on the premise that it is only meaningful if filter.default
is set. However, it turns out that even FILTER_UNSAFE_RAW (which
is the "no-op filter") can be combined with stripping flags.
However, this is compensated by the fact that this doesn't actually
work when setting filter.default=unsafe_raw and non-default
filter.default_flags -- the flags are simply ignored in that case.
So everything works out in the end.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-12 09:33:08 +02:00
George Peter Banyard
1f42777927 Deprecate using the implicit default PgSQL connection
The DB connection should be provided in all cases as the first argument.
The overloaded function signatures will be removed in the future.
Warn about this change.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 23:12:37 +02:00
Nikita Popov
a80360dbed Deprecate direct access to static trait members
Static trait members may only be accessed through a class in which
the trait is used, not directly on the trait.

A complication here is that we should not store static
methods/properties for which a deprecation is triggered in a
cache slot. As the check for this is simple and cheap, I'm handling
this in the cache slot population code in the VM. The alternative
would be to pass the cache slot down into the fetching code.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 14:12:28 +02:00
Nikita Popov
08069165aa Deprecate ctype_*() on non-string arguments
Non-string arguments will be interpreted as strings in the future.
Warn about the upcoming behavior change.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 12:00:35 +02:00
Nikita Popov
232aa34b9f Deprecate auto_detect_line_endings
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 10:05:57 +02:00
Nikita Popov
bed7139375 Deprecate strptime()
Use date_parse_from_format() or IntlDateFormatter::parse() instead.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-09 10:03:45 +02:00
Nikita Popov
2bc23cc6e3 Deprecate imap NIL constant
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:48:16 +02:00
Nikita Popov
f0b190c32d Deprecate return by ref from void function
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:47:37 +02:00
Nikita Popov
bf94010b4b Deprecate FILTER_SANITIZE_STRING/STRIPPED
Deprecate the FILTER_SANITIZE_STRING and FILTER_SANITIZE_STRIPPED
filters.

This is part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:46:59 +02:00
Nikita Popov
1c07b11b1c Deprecate odbc_result_all()
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:46:08 +02:00
Nikita Popov
625b89af2f Deprecate mysqli::init()
In favor of parent::__construct().

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 16:45:05 +02:00
Nikita Popov
bf0c1ce1a0 Deprecate mhash
Deprecate mhash(), mhash_keygen_s2k(), mhash_count(),
mhash_get_block_size() and mhash_get_hash_name() in favor of the
normal hash_*() functions.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
1c50784ae7 Deprecate IntlCalendar::roll() with bool argument
Pass 1 instead of true and -1 instead of false.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
92f6e21523 Deprecate FILE_BINARY and FILE_TEXT constants
These constants have no effect.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:51 +02:00
Nikita Popov
639015845f Deprecate calling mb_check_encoding() without argument
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:34:49 +02:00
Nikita Popov
dcc8463ae5 Deprecate IAP functions on objects
Deprecate use of key(), current(), next(), prev(), reset() and
end() on objects. Cast the object to array first.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:28:33 +02:00
Nikita Popov
5bb83b3778 Deprecate date_sunrise() and date_sunset()
date_sunrise() and date_sunset() are deprecated in favor of
date_sun_info().

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
2021-07-08 15:27:08 +02:00
Marco Pivetta
6e16e1daa9 Make ReflectionProperty/Method always accessible
With this patch, it is no longer required to call
`ReflectionProperty#setAccessible()` or
`ReflectionMethod#setAccessible()` with `true`.

If a userland consumer already got to the point of accessing
object/class information via reflection, it makes little sense
for `ext/reflection` to disallow accessing `private`/`protected`
symbols by default.

After this patch, calling `ReflectionProperty#setAccessible(true)`
or `ReflectionMethod#setAccessible(true)` on newly instantiated
`ReflectionProperty` or `ReflectionMethod` respectively will have
no effect.

RFC: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op

Closes GH-5412.
2021-07-08 10:55:38 +02:00
Máté Kocsis
a5360e80c2
Add support for final class constants
RFC: https://wiki.php.net/rfc/final_class_const

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-06 21:42:38 +02:00
George Peter Banyard
069a9fa5e4
Pure Intersection types (#6799)
Implement pure intersection types RFC

RFC: https://wiki.php.net/rfc/pure-intersection-types

Co-authored-by: Nikita Popov <nikic@php.net>
Co-authored-by: Ilija Tovilo <ilutov@php.net>
2021-07-05 14:11:03 +02:00
Cameron Porter
b11785c5e4 Fixed bug #81085: Add version 7.71.0 blob options.
Adds support for the following options beginning with version 7.71.0:

    CURLOPT_ISSUERCERT_BLOB
    CURLOPT_PROXY_ISSUERCERT
    CURLOPT_PROXY_ISSUERCERT_BLOB
    CURLOPT_PROXY_SSLCERT_BLOB
    CURLOPT_PROXY_SSLKEY_BLOB
    CURLOPT_SSLCERT_BLOB
    CURLOPT_SSLKEY_BLOB

Closes GH-7194.
2021-06-28 09:54:45 +02:00
Juliette
fb70194850
UPGRADING: update information re: return type for internal methods (#7182)
As discussed in 7051.
2021-06-22 08:33:55 +02:00
Joe Watkins
ed88daecf4
missing news/upgrading entry 2021-06-18 11:25:36 +02:00
Nikita Popov
deb7955bf4 Fix #81150 Add UPGRADING note for float to int deprecation
[ci skip]
2021-06-17 09:52:44 +02:00
Nikita Popov
1c08f8a48a Allow named args after unpack
Currently, argument unpacking and named arguments cannot be mixed
at all. This relaxes the restriction to allow
foo(...$args, named: $arg). The variant foo(named: $arg, ...$args)
is still forbidden, because we can't ensure that positional
parameters come before named parameters in that case (without more
intrusive changes). Effectively this just enforces a required style,
as the order of unpack and named args doesn't matter for the cases
where both could be well-defined.

ML discussion: https://externals.io/message/114589

Closes GH-7009.
2021-06-14 10:32:36 +02:00
Nikita Popov
805471e86b Fix bug #81112: Implement JsonSerializable for SplFixedArray
This returns an array for SplFixedArray JSON encoding, which
is more appropriate than an object with integer string keys.

Closes GH-7117.
2021-06-14 10:07:45 +02:00
Joe Watkins
16d499ac55
Merge branch 'phpdbg-no-remote'
* phpdbg-no-remote:
  The remote functionality is not being used. It significantly complicates current code and makes it harder to add new features.

  This commit drops all remote related functionality.
2021-06-13 22:11:29 +02:00
deltragon
ae9f6e7a8f
Add IntlDatePatternGenerator (#6771)
Add IntlDatePatternGenerator class per RFC https://wiki.php.net/rfc/intldatetimepatterngenerator.
2021-06-10 12:36:38 +02:00