This also fixes a leak in the `object_dom` testcase, where the DOM extension
returns an object with refcnt 1 but object_store refcnt 2, causing
READY_TO_DESTROY to return false. Don't try to be fancy, just use the
standard PHP destructor.
zend_update_property does not own the value after the call; we need to
do the deref ourself. Tweaks to the getter based on a better understanding
of the zend_read_property API.
Test against php 5.3, 5.4, and 5.5 -- which incidentally works around
the 'make test always succeeds' bug in php 5.3 and 5.4
(https://bugs.php.net/bug.php?id=60285).
('make test' may always succeed, but we still test against 5.3 and 5.4 to
ensure that we build correctly w/o errors on these php versions.)
The timer_ctx was being popped & freed in terminate_execution, from the
timer thread (not the main thread), and then popped again in the main
thread when execution was aborted. Do all pop/free work in main thread.
Also, remember to pop the timer_ctx when just a memory limit is set.
Transfer stesie's comment from the c3512587acf2f6aeeb80d7cc753f08a784c4c86b
commit message so that future additions to v8js_globals maintain the
proper ZTS behavior.
Deleting the global object implicitly deletes all the properties,
i.e. PHP objects we previously attached to it (and for which we
increased the reference counter).
Since the following idle notifications trigger the weak callbacks,
the references on the PHP objects are finally decreased.
Before the idle notifications to V8 were sent without a special
Isolate entered, which results in V8 using it's default isolate
(which we don't use at all). Hence those were pretty useless
anyways (if they were called, which was unlikely).
Besides V8 seems to not trigger the weak object callbacks if
the isolate is destroyed, hence the PHP objects we add-ref'ed
before will leak.
Therefore this removes the previous idle notification logic
and forces garbage collection from the V8Js object destructor.
If ZTS is disabled, the v8js_globals instance is declared right
in the BSS and hence automatically initialized by C++ compiler.
Most of the variables are just zeroed.
If ZTS is enabled however, v8js_globals just points to a freshly
allocated, unitialized piece of memory, hence we need to
initialize all fields on our own. Likewise on shutdown we have to
run the destructors manually.