Req #53610 [Com]: closure and static private class member
| From: | sergey dot s dot betke at novgaro dot ru | Date: | Sat, 25 Dec 2010 23:28:23 +0000 |
| Subject: | Req #53610 [Com]: closure and static private class member | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157323@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53610&edit=1
ID: 53610
Comment by: sergey dot s dot betke at novgaro dot ru
Reported by: sergey dot s dot betke at novgaro dot ru
Summary: closure and static private class member
Status: Open
Type: Feature/Change Request
Package: Class/Object related
Operating System: Windows
PHP Version: 5.3.4
Block user comment: N
Private report: N
New Comment:
My article in Russian on this issue <a
href="http://sergey-s-betke.blogs.novgaro.ru/lyambda-funkcii-zamykaniya-i-klassy-php">http://sergey-s-betke.blogs.novgaro.ru/lyambda-funkcii-zamykaniya-i-klassy-php</a>.
Previous Comments:
------------------------------------------------------------------------
[2010-12-26 00:19:09] sergey dot s dot betke at novgaro dot ru
Description:
------------
just one example:
class test {
private static $_domain;
static member() {
add_settings_section(
self::$_namespace . '_location_options',
__('Location of your opensearch.xml file', self::$_domain),
function () { ?>
<p><?php _e('You can select location of your opensearch.xml file
and his url, or leave automatic detection.', self::$_domain); ?></p>
<?php },
self::$_namespace . '_options_page'
);
}
}
and, this sample - not working.
I honestly do not understand, and therefore the PHP developers do not
consider the closure, created by the code of methods of class, as a
class method. But it is implicitly "import" $this.
Test script:
---------------
class test {
private static $_domain;
static test_member() {
add_settings_section( // wordpress API
self::$_namespace . '_location_options',
__('Location of your opensearch.xml file', self::$_domain),
function () { ?>
<p><?php _e('You can select location of your opensearch.xml file
and his url, or leave automatic detection.', self::$_domain); ?></p>
<?php },
self::$_namespace . '_options_page'
);
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53610&edit=1