Bug #80334 [Ver->Csd]: assert() vs named parameters - confusing error

From: Date: Mon, 09 Nov 2020 09:19:55 +0000
Subject: Bug #80334 [Ver->Csd]: assert() vs named parameters - confusing error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230215@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80334&edit=1

 ID:                 80334
 Updated by:         nikic@php.net
 Reported by:        bugs dot php dot net_nospam at adviesenzo dot nl
 Summary:            assert() vs named parameters - confusing error
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            *General Issues
 Operating System:   N/A
 PHP Version:        8.0.0RC3
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6fb3d92525d28f0b617a53d05a6be74a3ef37fa5
Log: Fixed bug #80334


Previous Comments:
------------------------------------------------------------------------
[2020-11-09 09:02:49] nikic@php.net

The problem is that we're appending the generated message to the arguments, which doesn't
work for named args.

------------------------------------------------------------------------
[2020-11-07 22:30:45] bugs dot php dot net_nospam at adviesenzo dot nl

Description:
------------
The "Cannot use positional argument after named argument" exception is sometimes thrown in
situations where named parameters isn't supported.

Test script:
---------------
<?php
$null = null;

// https://3v4l.org/qgfV2
assert(assertion: is_null($null));

// https://3v4l.org/q8Oqq
$a = is_null($null);
assert(assertion: $a);

Expected result:
----------------
Either named parameters being supported (= no error).
Or named parameters not being supported and the code resulting in a parse error.

NOT an error referring to named arguments, while the language construct doesn't seem to support
it.

Actual result:
--------------
Fatal error: Cannot use positional argument after named argument in /in/qgfV2 on line 3


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80334&edit=1


Thread (4 messages)

« previous php.bugs (#230215) next »