php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55564 Make spl_object_hash accept scalars and arrays
Submitted: 2011-09-01 14:05 UTC Modified: 2018-02-28 20:01 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Open Package: SPL related
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-09-01 14:05 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
Currently, spl_object_hash() only works on objects. But for scalars and even more arrays, PHP lacks a way to check for circular references.

As serialize() is able to dump circular data structures, its seams PHP internally has all what's needed.

If spl_object_hash() could work on any variable type, it would be fantastic!

If that can't be done because of call by value, maybe a new
spl_ref_hash(&$var) working like spl_object_hash but taking its argument by reference could work?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-28 20:01 UTC] cmb@php.net
-Package: Unknown/Other Function +Package: SPL related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 20 12:01:21 2019 UTC