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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bugs dot php dot net_nospam at adviesenzo dot nl
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 16:01:29 2024 UTC