php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74049 Unclear statement about vital difference between versions
Submitted: 2017-02-05 19:00 UTC Modified: 2017-03-31 08:20 UTC
From: teo8976 at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: teo8976 at gmail dot com
New email:
PHP Version: OS:

 

 [2017-02-05 19:00 UTC] teo8976 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/functions.anonymous
---

Regarding the "use" language construct:

"Closures may also inherit variables from the parent scope. Any such variables must be passed to the use language construct. From PHP 7.1, these variables MAY NOT INCLUDE superglobals, $this, or variables with the same name as a parameter"
(emphasys added)

What the heck does "MAY NOT" mean?? Either they include or they don't, or they do in some cases, in which case the docs MUST specify which ones are included and which one are not, in what cases and depending on what.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-05 20:18 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: Documentation problem +Package: Scripting Engine problem
 [2017-02-05 20:18 UTC] requinix@php.net
I'm not sure I understand what the problem is. You don't know what "may not" means?

It means these three examples
  function() use($_GET) { } - https://3v4l.org/hqpiD
  function() use($this) { } - https://3v4l.org/6Ten8
  function($foo) use($foo) { } - https://3v4l.org/LiPQ4
are not allowed.
 [2017-02-05 20:29 UTC] teo8976 at gmail dot com
-Status: Feedback +Status: Open
 [2017-02-05 20:29 UTC] teo8976 at gmail dot com
Oh, I see, "may not" as in "are not allowed to".

That's confusing, as "may not" usually means "may or may not", as in "you don't know whether they do or they don't".


It should read "cannot include", then.
 [2017-02-05 20:32 UTC] teo8976 at gmail dot com
By the way, it says "from PHP 7.1", but $this is not allowed in 5.x either
 [2017-02-06 14:24 UTC] cmb@php.net
> You don't know what "may not" means?

Wouldn't "must not" be clearer, anyway?
 [2017-03-01 09:08 UTC] peehaa@php.net
IMO OP just confused himself here.

May not in this context is just fine.

Sounds like OP is thinking about https://www.ietf.org/rfc/rfc2119.txt which our manual does not follow.

> That's confusing, as "may not" usually means "may or may not"

No it usually does not. It means "may not".

I don't feel strongly either way to change or keep the wording if it really is confusing to people, but I wonder if it's just OP or also other people *and* whether it means it's also confusing in other places in the manual.
 [2017-03-01 10:59 UTC] teo8976 at gmail dot com
> IMO OP just confused himself here.

I got confused because the phrasing is confusing.

> Sounds like OP is thinking about https://www.ietf.org/rfc/rfc2119.txt which our 
> manual does not follow.

No, I'm just thinking about plain English.

> No it usually does not. It means "may not".

Yeah, but "may not" as in "it is a possibility that it doesn't". Here, instead, the intended meaning is "it is not a possibility that it does", i.e. "cannot"/"must not". It is a correct but not common use of "may not". 
In this particular context the  "it is not allowed to", so the most natural way of saying it is "cannot". Why use an unnecessarily elaborate phrasing when there is a simpler, unambiguous, cristal clear one?

> but I wonder if it's just OP or also other people

Judging by comment  [2017-02-06 14:24 UTC] cmb@php.net (how shitty is it that comments aren't even numbered??), it looks like it's not just me.
 [2017-03-31 08:20 UTC] peehaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2017-03-31 08:20 UTC] peehaa@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC