php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80334 assert() vs named parameters - confusing error
Submitted: 2020-11-07 22:30 UTC Modified: 2020-11-09 09:02 UTC
From: bugs dot php dot net_nospam at adviesenzo dot nl Assigned:
Status: Closed Package: *General Issues
PHP Version: 8.0.0RC3 OS: N/A
Private report: No CVE-ID: None
 [2020-11-07 22:30 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-09 09:02 UTC] nikic@php.net
-Status: Open +Status: Verified
 [2020-11-09 09:02 UTC] 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-09 09:19 UTC] nikic@php.net
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
 [2020-11-09 09:19 UTC] nikic@php.net
-Status: Verified +Status: Closed
 [2020-11-09 13:47 UTC] bugs dot php dot net_nospam at adviesenzo dot nl
Thanks @nikic!
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jan 20 13:01:28 2021 UTC