Referencing bug 29386, I am not sure wether this would be considered a bug
or expected behavior.
It looks like in order to support using an explicit clone call, you also
have to support implicitly called clones when
zend.ze1_compatibility_mode clone is set on. It seems to be an all or
nothing there.
If this would not considered expected behavior, then is there some way to
define 2 different clone handlers so that ze1 compatibility would use a
different handler? - I couldnt find a way while looking through the code.
The problem arises, in this case, that an explicit clone call works
correctly as the internal object needs to be cloned, but when it is called
implicitly, the internal object shouldnt be cloned. Really would just like
to create a new object (zval - which would be pointing to the current
internal object).
This behavior isnt limited to dom, as the same behavior can be reproduced
using simpleXML due the interdependancy of the libxml nodes and implicit
cloning breaking the hierarchy. Not sure if this issue exists elsewhere.
Rob