0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 15:11:53 +00:00

Fix ZTS errors in v8js_convert.cc.

This commit is contained in:
C. Scott Ananian 2013-10-25 23:22:14 -04:00
parent e2a8186ad6
commit 011e517cfe

View File

@ -153,9 +153,10 @@ static void php_v8js_php_callback(const v8::FunctionCallbackInfo<v8::Value>& inf
{
v8::Isolate *isolate = info.GetIsolate();
v8::Local<v8::Object> self = info.Holder();
TSRMLS_FETCH();
zval *value = reinterpret_cast<zval *>(v8::External::Cast(*self->GetHiddenValue(V8JS_SYM(PHPJS_OBJECT_KEY)))->Value());
zend_function *method_ptr;
TSRMLS_FETCH();
zend_class_entry *ce = Z_OBJCE_P(value);
/* Set method_ptr from v8::External or fetch the closure invoker */
@ -177,7 +178,6 @@ static void php_v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value
// @todo assert constructor call
v8::Handle<v8::Object> newobj = info.This();
v8::Local<v8::External> php_object;
TSRMLS_FETCH();
if (!info.IsConstructCall()) {
return;
@ -192,6 +192,7 @@ static void php_v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value
php_object = v8::Local<v8::External>::Cast(info[0]);
} else {
// Object created from JavaScript context. Need to create PHP object first.
TSRMLS_FETCH();
zend_class_entry *ce = static_cast<zend_class_entry *>(ext_ce->Value());
zend_function *ctor_ptr = ce->constructor;
@ -279,6 +280,7 @@ static void php_v8js_named_property_enumerator(const v8::PropertyCallbackInfo<v8
v8::Local<v8::Array> result = v8::Array::New(0);
uint32_t result_len = 0;
TSRMLS_FETCH();
zend_class_entry *ce;
zend_function *method_ptr;
HashTable *proptable;
@ -401,6 +403,7 @@ static void php_v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& i
char *error;
int error_len;
TSRMLS_FETCH();
zend_class_entry *ce;
zval *object = reinterpret_cast<zval *>(v8::External::Cast(*self->GetHiddenValue(V8JS_SYM(PHPJS_OBJECT_KEY)))->Value());
ce = Z_OBJCE_P(object);
@ -443,7 +446,7 @@ static void php_v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& i
const zend_object_handlers *h = Z_OBJ_HT_P(object);
zend_function *method_ptr =
h->get_method(&object, (char*)method_name, method_name_len
ZEND_HASH_KEY_NULL TSRMLS_DC);
ZEND_HASH_KEY_NULL TSRMLS_CC);
if (method_ptr == NULL ||
(method_ptr->common.fn_flags & ZEND_ACC_PUBLIC) == 0 ||
(method_ptr->common.fn_flags & (ZEND_ACC_CTOR|ZEND_ACC_DTOR|ZEND_ACC_CLONE)) != 0) {
@ -494,6 +497,7 @@ static inline v8::Local<v8::Value> php_v8js_named_property_callback(v8::Local<v8
v8::Local<v8::Value> ret_value;
v8::Local<v8::Function> cb;
TSRMLS_FETCH();
zend_class_entry *scope = NULL; /* XXX? */
zend_class_entry *ce;
zend_function *method_ptr = NULL;
@ -559,7 +563,7 @@ static inline v8::Local<v8::Value> php_v8js_named_property_callback(v8::Local<v8
}
if (callback_type == V8JS_PROP_GETTER) {
/* Nope, not a method -- must be a (case-sensitive) property */
php_value = zend_read_property(scope, object, V8JS_CONST name, name_len, true);
php_value = zend_read_property(scope, object, V8JS_CONST name, name_len, true TSRMLS_CC);
// special case 'NULL' and return an empty value (indicating that
// we don't intercept this property) if the property doesn't
// exist.
@ -582,8 +586,8 @@ static inline v8::Local<v8::Value> php_v8js_named_property_callback(v8::Local<v8
* reference to it (and so don't have to deref) */
} else if (callback_type == V8JS_PROP_SETTER) {
MAKE_STD_ZVAL(php_value);
if (v8js_to_zval(set_value, php_value, 0, isolate) == SUCCESS) {
zend_update_property(scope, object, V8JS_CONST name, name_len, php_value);
if (v8js_to_zval(set_value, php_value, 0, isolate TSRMLS_CC) == SUCCESS) {
zend_update_property(scope, object, V8JS_CONST name, name_len, php_value TSRMLS_CC);
ret_value = set_value;
} else {
ret_value = v8::Handle<v8::Value>();