Doc #68828 [Nab]: spl-object-hash shows object only but can use callable
| From: | mgcummings at yahoo dot com | Date: | Tue, 13 Jan 2015 19:58:04 +0000 |
| Subject: | Doc #68828 [Nab]: spl-object-hash shows object only but can use callable | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11851@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68828&edit=1
ID: 68828
User updated by: mgcummings at yahoo dot com
Reported by: mgcummings at yahoo dot com
Summary: spl-object-hash shows object only but can use
callable
Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: N/A
PHP Version: 5.4.36
Block user comment: N
Private report: N
New Comment:
Sorry wasn't thinking about that you are right it doesn't work if you use something like
['test','test'] instead.
Previous Comments:
------------------------------------------------------------------------
[2015-01-13 19:29:01] aharvey@php.net
It can only be callable if the callable is an object: $callable in this case is a Closure object, so
spl_object_hash() can deal with that. spl_object_hash() would still fail with any callable that
isn't an object, such as 'functionName', or [$object, 'methodName'].
------------------------------------------------------------------------
[2015-01-13 19:21:29] mgcummings at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/function.spl-object-hash
---
Documents say parameter can only be object but callable is also allowed and the docs should be
updated to reflect it.
Test script:
---------------
$callable = function() {
return 'test';
};
$result = spl_object_hash($callable);
// $result = '000000002ddd793a0000000047573d56' for example
print $result .PHP_EOL;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68828&edit=1