0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-19 21:15:19 +00:00
Commit Graph

330 Commits

Author SHA1 Message Date
Stefan Siegl
1186e7951f Make compatible with V8 3.25.12, fixes #88 2014-03-22 17:58:38 +01:00
Stefan Siegl
bc86ce9e44 Clear persistent cells with weak references correctly, refs #88 2014-03-22 17:41:00 +01:00
Stefan Siegl
4c64bc4ad9 Make compatible with V8 3.24.10, fixes #83 2014-03-22 00:07:53 +01:00
Taneli Leppa
3b6390b7f8 Fix passing of null bytes from V8 to PHP (github issue #80). 2014-03-21 10:59:18 +02:00
Taneli Leppa
da53c90f88 Added new "v8js.use_date" ini setting to convert PHP DateTime objects to Javascript Date objects
when set as V8JS object properties.
2014-03-20 16:06:18 +02:00
Taneli Leppa
66dbe7d323 Forgot to commit test for large number support. 2014-03-20 15:45:35 +02:00
Taneli Leppa
9ddac3f124 Passing integers that didn't fit in 32-bit integers from PHP to Javascript
did not work properly, now uses float to pass larger numbers.
2014-03-20 12:00:45 +02:00
Taneli Leppa
0a85d27ee7 V8 needs to be notified when timezone changes. Keep track of timezone changes and notify it.
Also added a test.
2014-03-20 11:20:59 +02:00
Taneli Leppa
dd20670546 When passing objects from JS to PHP with mixed keys, some of the keys
might get lost or "re-indexed". This fixes it and adds two tests.
2014-03-20 10:35:05 +02:00
Taneli Leppa
54621e18f3 Added checkString() method for checking Javascript syntax. 2014-03-19 17:00:28 +02:00
Taneli Leppa
52dc41e30e Build fix for GCC 4.4 (eg. el6). 2014-03-19 16:24:24 +02:00
Patrick Reilly
98d535b8b1 Merge pull request #82 from stesie/fix-ftbfs-v8-3.24.5
Fix build against V8 >= 3.24.4
2013-12-29 00:21:38 -08:00
Stefan Siegl
985307dc91 Update README, removed build badge, require V8 3.22.3
GitHub now caches the build badge image if it is served via HTTP.
However the Jenkins box has no SSL certificate, hence I had to remove
the badge.
2013-12-21 20:54:55 +01:00
Stefan Siegl
8858bf5f27 Make compatible with V8 3.23.2 (and below) 2013-12-21 20:54:55 +01:00
Stefan Siegl
1e773dd4a8 Make compatible with V8 3.23.8 (and below) 2013-12-21 20:54:55 +01:00
Stefan Siegl
e20e5098c7 Make compatible with V8 3.23.11 (and below) 2013-12-21 19:56:28 +01:00
Stefan Siegl
69290b5779 Fix build against libv8 3.24.5 2013-12-21 01:18:08 +01:00
Patrick Reilly
e68d7073de Merge pull request #77 from cscott/minor-fixes
A pair of minor fixes
2013-10-30 11:45:03 -07:00
Patrick Reilly
5f0cd045e2 Merge pull request #76 from cscott/issue-75
Protect against direct invocation of `new V8Object` and `new V8Function`
2013-10-30 11:44:33 -07:00
C. Scott Ananian
30497766a3 Fix test cases which hard coded the object identity of returned objects. 2013-10-29 15:38:27 -04:00
C. Scott Ananian
7c5817c931 Remove unnecessary TSRMLS_FETCH from php_v8js_weak_object_callback. 2013-10-29 15:38:18 -04:00
C. Scott Ananian
2fe87a4cbc Protect against direct invocation of new V8Object and new V8Function.
This fixes issue #75.
2013-10-29 15:37:04 -04:00
Patrick Reilly
6eeafc0f83 Merge pull request #74 from cscott/dtor-simple
Simplify php_v8js_weak_object_callback.
2013-10-27 10:32:14 -07:00
Patrick Reilly
38837af243 Merge pull request #73 from cscott/a-few-more-leaks
Fix leak in v8 named property setter; clean up v8 named property getter.
2013-10-27 10:31:24 -07:00
C. Scott Ananian
892c654c8c Simplify php_v8js_weak_object_callback.
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.
2013-10-27 12:39:02 -04:00
C. Scott Ananian
1976e35b9a Fix leak in v8 named property setter; clean up v8 named property getter.
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.
2013-10-27 12:36:54 -04:00
Patrick Reilly
a730ddeb67 Merge pull request #70 from cscott/travis-fix-3
More memory leak and safety fixes; fix travis configuration.
2013-10-27 04:18:34 -07:00
C. Scott Ananian
99a1d54e9e Travis config update: compile against minimum supported v8 and most recent v8. 2013-10-27 02:49:24 -04:00
C. Scott Ananian
673d178ce7 Travis config update: fix for issue #56.
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.)
2013-10-27 02:49:24 -04:00
C. Scott Ananian
24257b54af Free php_v8js_accessor_ctx when we are done with it. 2013-10-27 02:49:24 -04:00
C. Scott Ananian
3f77a5a356 Make PHP object accessors typesafe using V8::AccessorSignature.
This ensures that if you copy the accessor to another object you can't
trigger a segfault.
2013-10-27 02:49:24 -04:00
C. Scott Ananian
879d1d54a2 Fix memory leak in zend_read_property; also pass correct scope object. 2013-10-27 02:49:24 -04:00
C. Scott Ananian
1c3a919ae8 Don't leak if PHP constructor is called from JavaScript.
Register the weak reference callback to deref and do memory limit
accounting for wrapped PHP objects created from within JavaScript.
2013-10-27 02:49:23 -04:00
C. Scott Ananian
57348c5f7d Fix double-pop of timer_ctx (and efree from wrong thread).
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.
2013-10-27 02:48:52 -04:00
C. Scott Ananian
dba6322812 Fix memory leak: The get_properties handler owns the returned hashtable. 2013-10-26 23:14:39 -04:00
C. Scott Ananian
b4d560dd52 Fix a bunch of memory leaks.
Found by compiling PHP with --enable-debug.
2013-10-26 23:14:39 -04:00
C. Scott Ananian
7cdcb5f45e Document rules for initialization/cleanup of ZTS globals.
Transfer stesie's comment from the c3512587ac
commit message so that future additions to v8js_globals maintain the
proper ZTS behavior.
2013-10-26 23:14:39 -04:00
Patrick Reilly
ae2ad9967d Merge pull request #69 from stesie/fix-global-zts-init
Initialize v8js_globals manually only if ZTS is enabled.
2013-10-26 18:21:25 -07:00
Patrick Reilly
8a51e0bc81 Merge pull request #67 from stesie/fix-garbage-collection
Fix garbage collection
2013-10-26 18:21:14 -07:00
Stefan Siegl
68a579f3ae Delete global PHP object on shutdown
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.
2013-10-27 00:41:47 +02:00
Stefan Siegl
18b129b128 Trigger garbage collection within Isolate::Scope
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.
2013-10-27 00:41:47 +02:00
Stefan Siegl
c3512587ac Initialize v8js_globals manually only if ZTS is enabled.
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.
2013-10-27 00:29:50 +02:00
Stefan Siegl
5c1c68b045 Merge pull request #68 from stesie/fix-double-free
Don't manually call destructors on v8js_globals.
2013-10-26 14:59:33 -07:00
Stefan Siegl
16934c2254 Don't manually call destructors on v8js_globals.
v8js_globals is declared at the beginning of v8js.cc and hence
it's constructors and destructors are run automatically.
2013-10-26 23:57:49 +02:00
Patrick Reilly
1906a8e6b6 Merge pull request #66 from cscott/mem-leaks
Fix init/shutdown of v8js_globals.
2013-10-26 14:26:34 -07:00
Patrick Reilly
b2a92e5be1 Merge pull request #65 from cscott/zts-fix
ZTS fixes
2013-10-26 14:25:30 -07:00
C. Scott Ananian
39cc821f91 Store tsrm_ls in php_v8js_ctx.
This avoids the need to ever do a (slow) TSRMLS_FETCH().
2013-10-26 02:07:12 -04:00
C. Scott Ananian
011e517cfe Fix ZTS errors in v8js_convert.cc. 2013-10-26 02:07:00 -04:00
C. Scott Ananian
527e636b25 Fix init/shutdown of v8js_globals.
The mutex/map/stack constructor/destructors weren't being properly called.
2013-10-26 02:04:57 -04:00
Patrick Reilly
e2a8186ad6 Merge pull request #63 from cscott/travis-fix
Travis config update: Partial fix for issue #56.
2013-10-25 14:49:43 -07:00