Skip to content

PHP 8.0+ does no longer accept a comment in the whitespace between ampersand and argument in function signature #10083

Closed
@olleharstedt

Description

@olleharstedt

Description

The following code:

<?php

function foo(
array
#if __PHP__
&
#endif
$bodies
)
{
}

Resulted in this output:

    Parse error: syntax error, unexpected variable "$bodies" in /in/aq2rT on line 8

    Process exited with code 255.

But I expected this output instead:

<Empty, should compile without syntax error as in PHP 7.4

PHP Version

PHP 8.1 and above, works fine in PHP 7.4

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions