Doc #77148 [Ver->Csd]: No mention of __FUNCTION__ being self-referential inside a closure
| From: | cmb@php.net | Date: | Wed, 14 Nov 2018 14:26:15 +0000 |
| Subject: | Doc #77148 [Ver->Csd]: No mention of __FUNCTION__ being self-referential inside a closure | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16139@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77148&edit=1
ID: 77148
Updated by: cmb@php.net
Reported by: roy-orbison at devo dot net dot au
Summary: No mention of __FUNCTION__ being self-referential
inside a closure
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2018-11-14 14:25:45] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=345983
Log: Fix #77148: No mention of __FUNCTION__ being self-referential inside a closure
------------------------------------------------------------------------
[2018-11-14 11:51:51] cmb@php.net
According to <https://3v4l.org/731uA>, the behavior is
identical
for all PHP versions since anonymous functions have been
introduced. I think it makes sense to document this.
------------------------------------------------------------------------
[2018-11-14 04:21:37] roy-orbison at devo dot net dot au
Description:
------------
---
From manual page: https://php.net/language.constants.predefined
From manual page: https://php.net/functions.anonymous
---
__FUNCTION__ seems to correctly refer to an anonymous function within itself, but there's no
information on either of the above pages. Based on internet searches it wasn't always the case,
but I couldn't find the changelog where it was fixed.
Does it not work 100% of the time? Is there some reason it's not officially documented?
Test script:
---------------
<?php
call_user_func(function() {
var_dump(__FUNCTION__);
});
Actual result:
--------------
/path/to/closure-test.php:3:string '{closure}' (length=9)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77148&edit=1