attached is a diff of php_domxml.c i have been working on.
it is meant to allow the extension to synch up when sub trees which are
freed by libxml (basically it was started to attempt to fix the set_content
routine).

thanks to Lukas Schroeder and Christian Stocker for answering my questions
and their help on this, but i think i may have some issues with zval
cleanup.

the diff includes a modified set_content which seems to be working fine. so
far no segfaults on the tests i have run, as it doesnt seem to be trying to
double free memory anymore, but i feel that there may be some left of zvals
floating around especially when nodes are retrieved with xpath and returned
in an array.

the problem seems to come in the routine node_wrapper_destroy which was
added. the wrapper is set to null as the xml node no longer exists. the
php_free_xml_node routine will no longer dtor if the xml is removed as there
is no wrapper. i tried attempted to take care of this in the
node_wrapper_destroy function, but find when running scripts with xpath
calls i can keep increasing the refcount. so far using xpath has been the
only way i have found to increase the refcount above 2. the function will
remove the object from the hash if it exists there, so they become invalid
in scripting, but with the refcount possibly still above 0 after a call to
node_wrapper_destroy i dont think the zvals are being cleaned up properly. a
possible solution, though i am trying to avoid doing it is to get the
refcount when entering the node_wrapper_destroy function and just calling
zval_ptr_dtor that many times, but i dont think it is proper, so i figured
it was time to ask here for help.

any more help would be greatly appreciated.
please let me know if i am way off base with this methodology and wasting my
time here so i can look into other ways of accomplishing this.

thanks

rob

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to