# keeping ref var_hash within recursive serialize() calls

- Thread: https://externals.io/message/48369
- Original archive: https://news-web.php.net/php.internals/48369
- Started by Michael Wallner on 2010-05-21T08:46:24+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #48369 — Michael Wallner — 2010-05-21T08:46:24+00:00

URL: https://externals.io/message/48369#48369

Hi,

I prepared a patch [1] which enables `serialize()` to keep track of
object/variable references through its var_hash throughout
recursive calls to `serialize()`.

See the test included in the patch respectively bug #45706  [2]
what this exactly means.

It also has the side affect that the hack [3] in spl_array.c
is apparently no longer needed.

All serialization  tests pass.

There should not be any need to change external code (except
hack-alike things like those obsoleted in spl_array.c), but ABI
compatibility is broken and it's quite an intrusive change to
the serialization code, so I start here and not with `svn ci` ;)

Objections, comments?

Cheers,
Mike


[1]http://dev.iworks.at/PATCHES/keep_refs_with_recursive_serialize.txt
[2]http://bugs.php.net/45706
[3] http://svn.php.net/viewvc/php/php-src/trunk/ext/spl/spl_array.c?r1=264490&r2=265477

---

## #48370 — Michael Wallner — 2010-05-21T10:36:03+00:00

URL: https://externals.io/message/48369#48370 · In reply to: #48369

> See the test included in the patch respectively bug #45706 [2]
> what this exactly means.

> [2]http://bugs.php.net/45706

Sorry, wrong bug referenced. The request I actually meant is 36424:
http://bugs.php.net/36424

Mike

---

## #48463 — Michael Wallner — 2010-05-25T12:14:36+00:00

URL: https://externals.io/message/48369#48463 · In reply to: #48369

So I guess, nobody objects to me committing it then.

Regards,
Mike



> Hi,
>
> I prepared a patch [1] which enables `serialize()` to keep track of
> object/variable references through its var_hash throughout
> recursive calls to `serialize()`.
>
> See the test included in the patch respectively bug #45706 [2]
> what this exactly means.
>
> It also has the side affect that the hack [3] in spl_array.c
> is apparently no longer needed.
>
> All serialization tests pass.
>
> There should not be any need to change external code (except
> hack-alike things like those obsoleted in spl_array.c), but ABI
> compatibility is broken and it's quite an intrusive change to
> the serialization code, so I start here and not with `svn ci` ;)
>
> Objections, comments?
>
> Cheers,
> Mike
>
>
> [1]http://dev.iworks.at/PATCHES/keep_refs_with_recursive_serialize.txt
> [2]http://bugs.php.net/45706
> [3]
> http://svn.php.net/viewvc/php/php-src/trunk/ext/spl/spl_array.c?r1=264490&r2=265477
