Selaa lähdekoodia

Make compatible with V8 3.23.8 (and below)

Stefan Siegl 11 vuotta sitten
vanhempi
commit
1e773dd4a8
3 muutettua tiedostoa jossa 16 lisäystä ja 1 poistoa
  1. 6 1
      php_v8js_macros.h
  2. 5 0
      v8js.cc
  3. 5 0
      v8js_convert.cc

+ 6 - 1
php_v8js_macros.h

@@ -187,7 +187,12 @@ struct php_v8js_ctx {
 /* }}} */
 
 #ifdef ZTS
-# define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((php_v8js_ctx *) isolate->GetData(0))->zts_ctx);
+# if PHP_V8_API_VERSION <= 3023008
+   /* Until V8 3.23.8 Isolate could only take one external pointer. */
+#  define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((php_v8js_ctx *) isolate->GetData())->zts_ctx);
+# else
+#  define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((php_v8js_ctx *) isolate->GetData(0))->zts_ctx);
+# endif
 #else
 # define V8JS_TSRMLS_FETCH()
 #endif

+ 5 - 0
v8js.cc

@@ -779,7 +779,12 @@ static PHP_METHOD(V8Js, __construct)
 	c->pending_exception = NULL;
 	c->in_execution = 0;
 	c->isolate = v8::Isolate::New();
+#if PHP_V8_API_VERSION <= 3023008
+	/* Until V8 3.23.8 Isolate could only take one external pointer. */
+	c->isolate->SetData(c);
+#else
 	c->isolate->SetData(0, c);
+#endif
 	c->time_limit_hit = false;
 	c->memory_limit_hit = false;
 	c->module_loader = NULL;

+ 5 - 0
v8js_convert.cc

@@ -686,7 +686,12 @@ static v8::Handle<v8::Value> php_v8js_hash_to_jsobj(zval *value, v8::Isolate *is
 
 		return v8obj;
 	} else if (ce) {
+#if PHP_V8_API_VERSION <= 3023008
+		/* Until V8 3.23.8 Isolate could only take one external pointer. */
+		php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData();
+#else
 		php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
+#endif
 		v8::Local<v8::FunctionTemplate> new_tpl;
 		v8js_tmpl_t *persist_tpl_;