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: 2020-11-11 14:47 UTC
Votes:7
Avg. Score:4.6 ± 0.7
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: cmb (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
 [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
 [2020-11-11 13:34 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-11-11 13:34 UTC] cmb@php.net
Is this still relevant, Nicolas?
 [2020-11-11 13:45 UTC] nicolasgrekas@php.net
Thanks for the ping cmb, let's close!
 [2020-11-11 14:47 UTC] cmb@php.net
-Status: Feedback +Status: Closed
 [2020-11-11 14:47 UTC] cmb@php.net
Thanks for the swift reply!
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 17:01:23 2020 UTC