[wp-trac] [WordPress Trac] #19986: Issue with add_filter() and add_action() when using anonymous functions.
WordPress Trac
wp-trac at lists.automattic.com
Wed Feb 8 05:43:05 UTC 2012
#19986: Issue with add_filter() and add_action() when using anonymous functions.
--------------------------+------------------------------
Reporter: pagesimplify | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.3.1
Severity: minor | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Comment (by SergeyBiryukov):
Anonymous function names indeed start with a null character, in order to
ensure they don't clash with user-defined functions:
* https://bugs.php.net/bug.php?id=10721
* https://bugs.php.net/bug.php?id=40160
That said, null is also a valid array key (will evaluate to an empty
string):[[BR]]
http://www.php.net/manual/en/language.types.array.php#30132
Both of these examples seem to work:
{{{
$foo = array( null => 'bar' );
echo $foo[''];
$foo = array( chr(0) . 'key' => 'bar' );
echo $foo[ chr(0) . 'key' ];
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19986#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list