Implemented in PHP 8.0

RFC Categories

    Shorter Attribute Syntax Change

    Author
    Derick Rethans
    Author
    Benjamin Eberlei
    Target
    8.0
    With the continued discussion over the currently selected attribute syntax @@ from the Shorter Attribute Syntax RFC we want to revisit the syntax choice once an...

    Are you okay with re-voting on the attribute syntax for PHP 8.0, again?

    Yes
    No
    Yes
    50 Votes (82%)
    No
    11 Votes (18%)

    New attribute syntax preference #1

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    9 Votes (14%)
    #[Attr]
    32 Votes (49%)
    @[Attr]
    13 Votes (20%)
    <<Attr>>
    6 Votes (9%)
    @:Attr
    1 Votes (2%)
    @{Attr}
    4 Votes (6%)

    New attribute syntax preference #2

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    4 Votes (6%)
    #[Attr]
    10 Votes (16%)
    @[Attr]
    7 Votes (11%)
    <<Attr>>
    16 Votes (26%)
    @:Attr
    4 Votes (6%)
    @{Attr}
    21 Votes (34%)

    New attribute syntax preference #3

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    0 Votes (0%)
    #[Attr]
    9 Votes (15%)
    @[Attr]
    28 Votes (47%)
    <<Attr>>
    6 Votes (10%)
    @:Attr
    4 Votes (7%)
    @{Attr}
    12 Votes (20%)

    New attribute syntax preference #4

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    5 Votes (9%)
    #[Attr]
    4 Votes (7%)
    @[Attr]
    8 Votes (14%)
    <<Attr>>
    22 Votes (39%)
    @:Attr
    6 Votes (11%)
    @{Attr}
    12 Votes (21%)

    New attribute syntax preference #5

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    20 Votes (38%)
    #[Attr]
    2 Votes (4%)
    @[Attr]
    2 Votes (4%)
    <<Attr>>
    3 Votes (6%)
    @:Attr
    19 Votes (36%)
    @{Attr}
    7 Votes (13%)

    New attribute syntax preference #6

    @@Attr
    #[Attr]
    @[Attr]
    <<Attr>>
    @:Attr
    @{Attr}
    @@Attr
    18 Votes (35%)
    #[Attr]
    5 Votes (10%)
    @[Attr]
    2 Votes (4%)
    <<Attr>>
    4 Votes (8%)
    @:Attr
    19 Votes (37%)
    @{Attr}
    3 Votes (6%)

    Don't automatically unserialize Phar metadata outside getMetadata()

    Author
    Target
    8.0
    In 2018, various vulnerabilities were found in php web frameworks due to the phar stream wrappers. A call such as file_exists("phar://...somepath.extension/file...

    Stop automatically unserializing Phar metadata outside direct getMetadata() calls

    Yes
    No
    Yes
    25 Votes (100%)
    No
    0 Votes (0%)

    Allow trailing comma in closure use lists

    Author
    Target
    8.0
    This RFC proposes to allow an optional trailing comma in closure use lists. This is already supported for argument and parameter lists.

    Allow trailing comma in closure use lists

    Yes
    No
    Yes
    49 Votes (100%)
    No
    0 Votes (0%)

    zend.exception_string_param_max_len: Configurable string length in getTraceAsString()

    Author
    Target
    8.0
    Since 2003, Throwable->getTraceAsString() and Throwable->__toString() have limited the length of string function arguments in stringified stack traces to 15 byt...

    Add a new ini setting zend.exception_string_param_max_len

    Yes
    No
    Yes
    36 Votes (95%)
    No
    2 Votes (5%)

    Informal poll: Interest in raising the default string parameter max length from 15 bytes in future RFCs

    Yes
    No
    Yes
    11 Votes (33%)
    No
    22 Votes (67%)

    Treat namespaced names as single token

    Author
    Target
    8.0
    PHP currently treats namespaced names like Foo\Bar as a sequence of identifiers and namespace separator tokens. This RFC proposes to treat namespaced names as a...

    Treat namespaced names as a single token?

    Yes
    No
    Yes
    38 Votes (90%)
    No
    4 Votes (10%)

    Shorter Attribute Syntax

    Author
    Theodore Brown
    Author
    Martin Schröder
    Target
    8.0
    We propose to use @@Attr or #[Attr] as the attribute syntax in PHP 8.0 instead of .

    Are you okay with re-voting on the attribute syntax for PHP 8.0?

    Yes
    No
    Yes
    50 Votes (86%)
    No
    8 Votes (14%)

    Attribute syntax choice #1

    @@
    #[]
    <<>>
    @@
    33 Votes (54%)
    #[]
    22 Votes (36%)
    <<>>
    6 Votes (10%)

    Attribute syntax choice #2

    @@
    #[]
    <<>>
    @@
    12 Votes (20%)
    #[]
    19 Votes (32%)
    <<>>
    28 Votes (47%)

    Attribute syntax choice #3

    @@
    #[]
    <<>>
    @@
    12 Votes (21%)
    #[]
    19 Votes (34%)
    <<>>
    25 Votes (45%)

    Nullsafe operator

    Author
    Target
    8.0
    This RFC proposes the new nullsafe operator ?-> with full short circuiting.

    Add nullsafe operator to the language?

    Yes
    No
    Yes
    56 Votes (97%)
    No
    2 Votes (3%)

    Match expression v2

    Author
    Target
    8.0

    Add match expressions to the language?

    Yes
    No
    Yes
    43 Votes (96%)
    No
    2 Votes (4%)

    Add CMS Support

    Author
    Eliot Lear
    Target
    8.0
    PHP has for some time incorporated support for PKCS#7 sign, verify, encrypt, decrypt, and read operations. Cryptographic Message Syntax (CMS) is a newer versi...

    Make sorting stable

    Author
    Target
    8.0
    Sorting functions in PHP are currently unstable, which means that the order of equal elements is not guaranteed. This RFC proposes to make all sorts in PHP stab...

    Make sorting in PHP stable?

    Yes
    No
    Yes
    45 Votes (100%)
    No
    0 Votes (0%)

    Unbundle ext/xmlrpc

    Author
    cmb
    Target
    8.0
    ext/xmlrpc relies on on libxmlrpc-epi, which is abandoned. Even worse, we are bundling a modified 0.51, while the latest version is 0.54.1. This is exacerbated ...

    Unbundle ext/xmlrpc

    Yes
    No
    Yes
    50 Votes (100%)
    No
    0 Votes (0%)

    Attribute Amendments

    Author
    Author
    Martin Schröder
    Target
    8.0
    This RFC discusses a few amendments to the original Attributes RFC that was accepted for PHP 8.

    Should PhpAttribute be renamed to Attribute?

    Yes
    No
    Yes
    51 Votes (100%)
    No
    0 Votes (0%)

    Should a secondary grouped syntax for attributes be introduced?

    Yes
    No
    Yes
    32 Votes (70%)
    No
    14 Votes (30%)

    Should attributes allow definition of target declarations?

    Yes
    No
    Yes
    38 Votes (90%)
    No
    4 Votes (10%)

    Should attributes allow definition of repeatability?

    Yes
    No
    Yes
    38 Votes (90%)
    No
    4 Votes (10%)

    Always available JSON extension

    Author
    Target
    8.0
    Currently, it's possible to disable the json extension with ./configure --disable-json. However, JSON is extremely useful to have because it's widely used for m...

    Make the JSON extension impossible to disable

    Yes
    No
    Yes
    56 Votes (100%)
    No
    0 Votes (0%)

    Remove inappropriate inheritance signature checks on private methods

    Author
    Target
    8.0
    Currently, a method with the same name as a parent's method, is still checked for some inheritance rules regardless of the parent's method visibility.

    Remove inappropriate inheritance signature checks on private methods

    Yes
    No
    Yes
    24 Votes (69%)
    No
    11 Votes (31%)

    Ensure correct signatures of magic methods

    Author
    Target
    8.0
    It is currently possible to write magic methods that have signatures that don't match the signature expected, such as __clone(): float or __isset(): Closure.

    Ensure correct signatures of magic methods

    Yes
    No
    Yes
    45 Votes (96%)
    No
    2 Votes (4%)

    non-capturing catches

    Author
    Max Semenik
    Target
    8.0
    Currently, PHP requires to capture the exception being caught to a variable:

    Accept this RFC?

    Yes
    No
    Yes
    48 Votes (98%)
    No
    1 Votes (2%)

    Stricter type checks for arithmetic/bitwise operators

    Author
    Target
    8.0
    This RFC proposes to throw a TypeError when an arithmetic or bitwise operator is applied to an array, resource or (non-overloaded) object. The behavior of scala...

    Add stricter type checks for arithmetic/bitwise operators?

    yes
    no
    yes
    57 Votes (100%)
    no
    0 Votes (0%)

    Change Default PDO Error Mode

    Author
    AllenJB
    Target
    8.0
    The current default error mode for PDO is silent. This means that when an SQL error occurs, no errors or warnings may be emitted and no exceptions thrown unless...

    Change the default PDO error handling mode to PDO::ERRMODE_EXCEPTION?

    Yes
    No
    Yes
    49 Votes (96%)
    No
    2 Votes (4%)

    Constructor Property Promotion

    Author
    Target
    8.0
    Currently, the definition of simple value objects requires a lot of boilerplate, because all properties need to be repeated at least four times. Consider the fo...

    Add support for declaring properties in the constructor signature?

    Yes
    No
    Yes
    46 Votes (82%)
    No
    10 Votes (18%)

    Allow trailing comma in parameter list

    Author
    Target
    8.0
    This RFC proposes to allow an optional trailing comma in parameter lists. This is already supported for argument lists.

    Allow trailing comma in parameter lists?

    Yes
    No
    Yes
    58 Votes (98%)
    No
    1 Votes (2%)

    Add str_starts_with() and str_ends_with() functions

    Author
    Will Hudgins
    Target
    8.0
    str_starts_with checks if a string begins with another string and returns a boolean value (true/false) whether it does. str_ends_with checks if a string ends w...

    Add str_starts_with and str_ends_with as described

    yes
    no
    yes
    51 Votes (93%)
    no
    4 Votes (7%)

    throw expression

    Author
    Target
    8.0
    Since in PHP throw is a statement it makes it impossible to throw exceptions in places where only expressions are allowed, like arrow functions, the coalesce op...

    Would you like to convert the throw statement into an expression?

    Yes
    No
    Yes
    46 Votes (94%)
    No
    3 Votes (6%)

    Locale-independent float to string cast

    Author
    Author
    Target
    8.0
    The string representation of floats in PHP depends on the current locale as the decimal separator varies between locales. This can lead to subtle bugs in certai...

    Make float to string casts always locale-independent?

    Yes
    No
    Yes
    42 Votes (98%)
    No
    1 Votes (2%)

    Should the debug_locale_sensitive_float_casts INI setting be added?

    Yes
    No
    Yes
    14 Votes (35%)
    No
    26 Votes (65%)

    Attributes v2

    Author
    Author
    Martin Schröder
    Target
    8.0
    This RFC proposes Attributes as a form of structured, syntactic metadata to declarations of classes, properties, functions, methods, parameters and constants. A...

    Accept PHP Attributes v2 into core?

    Yes
    No
    Yes
    51 Votes (98%)
    No
    1 Votes (2%)

    Which syntax to use for attributes?

    <<>>
    @:
    <<>>
    41 Votes (77%)
    @:
    12 Votes (23%)

    str_contains

    Author
    Philipp Tanlak
    Target
    8.0
    str_contains checks if a string is contained in another string and returns a boolean value (true/false) whether or not the string was found.

    Add str_contains as described

    Yes
    No
    Yes
    43 Votes (83%)
    No
    9 Votes (17%)

    get_debug_type

    Author
    Target
    8.0

    Add get_debug_type as described

    Yes
    No
    Yes
    42 Votes (93%)
    No
    3 Votes (7%)

    Object-based token_get_all() alternative

    Author
    Target
    8.0
    The token_get_all() function currently returns tokens either as a single-character string, or an array with a token ID, token text and line number. This RFC pro...

    Add object-based token_get_all() alternative?

    Yes
    No
    Yes
    47 Votes (100%)
    No
    0 Votes (0%)

    Validation for abstract trait methods

    Author
    Target
    8.0
    Traits can contain abstract methods, which are used to specify requirements the trait has on the using class. However, the signatures of these methods are curre...

    Validate abstract trait methods?

    Yes
    No
    Yes
    52 Votes (100%)
    No
    0 Votes (0%)

    Add Stringable interface

    Author
    Target
    8.0
    This RFC introduces a new Stringable interface that is automatically added to classes that implement the __toString() method.

    Adopt the Stringable interface as proposed in this RFC?

    Yes
    No
    Yes
    29 Votes (76%)
    No
    9 Votes (24%)

    Allow ::class on objects

    Author
    Target
    8.0
    The Foo\Bar::class syntax has been introduced in PHP 5.5 to allow fetching a class name as a string, in a way that respects context-dependent name resolution ru...

    Allow ::class on objects?

    Yes
    No
    Yes
    60 Votes (100%)
    No
    0 Votes (0%)

    Static return type

    Author
    Target
    8.0
    The static special class name in PHP refers to the class a method was actually called on, even if the method is inherited. This is known as late static binding ...

    Add static return type?

    Yes
    No
    Yes
    54 Votes (100%)
    No
    0 Votes (0%)

    Variable Syntax Tweaks

    Author
    Target
    8.0
    The Uniform Variable Syntax RFC resolved a number of inconsistencies in PHP's variable syntax. This RFC intends to address a small handful of cases that were ov...

    Implement syntax changes outlined above in PHP 8?

    Yes
    No
    Yes
    47 Votes (100%)
    No
    0 Votes (0%)

    Weak maps

    Author
    Target
    8.0
    Weak maps allow creating a map from objects to arbitrary values (similar to SplObjectStorage) without preventing the objects that are used as keys from being ga...

    Add WeakMap class in PHP 8.0?

    Yes
    No
    Yes
    25 Votes (100%)
    No
    0 Votes (0%)

    Implement new DOM Living Standard APIs in ext/dom

    Author
    Author
    Thomas Weinert
    Target
    8.0
    Working with XML (HTML) documents is a necessary task for many web applications and the dom extension implements a standardized API that was previously specifie...

    Accept changes to DOM API to add support for new methods added in WHATWG groups DOM living standard?

    Yes
    No
    Yes
    37 Votes (100%)
    No
    0 Votes (0%)

    Union Types 2.0

    Author
    Target
    8.0
    A union type accepts values of multiple different types, rather than a single one. PHP already supports two special union types:

    Add union types as proposed?

    Yes
    No
    Yes
    61 Votes (92%)
    No
    5 Votes (8%)

    Reclassifying engine warnings

    Author
    Target
    8.0
    While newly introduced error conditions in the engine typically use Error exceptions, we have many old error conditions that use inappropriate severity levels f...

    Change undefined variable severity to?

    Error exception
    Warning
    Keep Notice
    Error exception
    36 Votes (56%)
    Warning
    18 Votes (28%)
    Keep Notice
    10 Votes (16%)

    Change undefined array index severity to?

    Warning
    Keep Notice
    Warning
    42 Votes (67%)
    Keep Notice
    21 Votes (33%)

    Change division by zero severity to?

    DivisionByZeroError exception
    Keep Warning
    DivisionByZeroError exception
    52 Votes (87%)
    Keep Warning
    8 Votes (13%)

    Accept remaining classifications shown in the table above?

    Yes
    No
    Yes
    54 Votes (95%)
    No
    3 Votes (5%)

    Always generate fatal error for incompatible method signatures

    Author
    Target
    8.0
    Inheritance errors due to incompatible method signatures (LSP violations) currently either throw a fatal error or a warning depending on the cause of the error ...

    Always generate fatal error for incompatible method signatures in PHP 8?

    Yes
    No
    Yes
    39 Votes (93%)
    No
    3 Votes (7%)

    Saner string to number comparisons

    Author
    Target
    8.0
    Comparisons between strings and numbers using == and other non-strict comparison operators currently work by casting the string to a number, and subsequently pe...

    Change string to number comparison semantics as proposed?

    Yes
    No
    Yes
    44 Votes (98%)
    No
    1 Votes (2%)

    Consistent type errors for internal functions

    Author
    Target
    8.0
    For user-defined functions, passing a parameter of illegal type results in a TypeError. For internal functions, the behavior depends on multiple factors, but th...

    Make zpp failures always throw TypeError?

    Yes
    No
    Yes
    50 Votes (96%)
    No
    2 Votes (4%)

    JIT

    Author
    Author
    Target
    8.0
    It's no secret that the performance jump of PHP 7 was originally initiated by attempts to implement JIT for PHP. We started these efforts at Zend (mostly by Dmi...

    Include JIT into PHP 8?

    Yes
    No
    Yes
    50 Votes (96%)
    No
    2 Votes (4%)

    Include JIT into PHP 7.4 (experimental)?

    Yes
    No
    Yes
    18 Votes (33%)
    No
    36 Votes (67%)

    Arrays starting with a negative index

    Author
    Target
    8.0
    On the documentation for array_fill the start_index description mentions: If start_index is negative, the first index of the returned array will be start_index ...

    Arrays starting with a negative index for 8.0

    Yes
    No
    Yes
    17 Votes (89%)
    No
    2 Votes (11%)

    Deprecation notice for 7.3

    Yes
    No
    Yes
    8 Votes (36%)
    No
    14 Votes (64%)