introduce temporary current_ref(), key_ref() and xml_set_object_ref() in preparation...
commitc388fd40b5e6dacad74532a52e96fa75e63621fe
authorDaniel Neiter <dneiter@fb.com>
Wed, 14 Aug 2019 22:13:26 +0000 (14 15:13 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 14 Aug 2019 22:18:43 +0000 (14 15:18 -0700)
treea93e16d6a948774f5fa39e449c275118f94a1964
parent3c3cc4d49313df59ac49920a043c283583a0b340
introduce temporary current_ref(), key_ref() and xml_set_object_ref() in preparation for removing references from key(), current() and xml_set_object()

Summary:
key(), current() and xml_set_object() should not be taking reference arguments:
- key() and current() never mutate their argument
- xml_set_object() expects its argument to be an object, and objects have reference semantics by themselves

However, changing reference parameter to a regular parameter is a breaking change, which has to be synchorized between function definition and all callers. It's not realistically possible to fix all affected hack code in lockstep with HHVM release, so I'm proposing the following migration plan instead:

1. introduce temporary key_ref(), current_ref() and xml_set_object() builtins, which behave exactly same way as current(), key() and xml_set_object().
2. wait for a short time to allow hack code to migrate to current_ref(), key_ref(), xml_set_object_ref().
3. change remove references from key(), current(), xml_set_object()
4. wait for a short time to allow hack code to migrate to current(), key(), xml_set_object().
5. remove key_ref(), current_ref() and xml_set_object().

I expect overall migration to take on the order of months, so the migration plan only applies to users, who upgrade regularly.

Reviewed By: billf

Differential Revision: D16699409

fbshipit-source-id: 1a9630566072f63ed47b42df27e5de2cbe1d74f7
hphp/hack/hhi/stdlib/builtins_array.hhi
hphp/hack/hhi/stdlib/builtins_xml.hhi
hphp/runtime/ext/array/ext_array.php
hphp/runtime/ext/xml/ext_xml.php