mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 07:01:52 +00:00
change retval of write_property handlers, refs #409
This commit is contained in:
parent
714ae87ab6
commit
c2873fd8d3
@ -1307,9 +1307,10 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
|
||||
|
||||
/* V8Js object handlers */
|
||||
|
||||
static void v8js_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
|
||||
static zval* v8js_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
|
||||
{
|
||||
V8JS_BEGIN_CTX(c, object)
|
||||
v8js_ctx *c = Z_V8JS_CTX_OBJ_P(object);
|
||||
V8JS_CTX_PROLOGUE_EX(c, value);
|
||||
|
||||
/* Check whether member is public, if so, export to V8. */
|
||||
zend_property_info *property_info = zend_get_property_info(c->std.ce, Z_STR_P(member), 1);
|
||||
@ -1323,7 +1324,7 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void **
|
||||
if (Z_STRLEN_P(member) > std::numeric_limits<int>::max()) {
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Property name exceeds maximum supported length", 0);
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Write value to PHP JS object */
|
||||
@ -1332,7 +1333,7 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void **
|
||||
}
|
||||
|
||||
/* Write value to PHP object */
|
||||
std_object_handlers.write_property(object, member, value, NULL);
|
||||
return std_object_handlers.write_property(object, member, value, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -161,29 +161,31 @@ static zval *v8js_v8object_read_property(zval *object, zval *member, int type, v
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void v8js_v8object_write_property(zval *object, zval *member, zval *value, void **cache_slot ) /* {{{ */
|
||||
static zval* v8js_v8object_write_property(zval *object, zval *member, zval *value, void **cache_slot ) /* {{{ */
|
||||
{
|
||||
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object);
|
||||
|
||||
if (!obj->ctx) {
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Can't access V8Object after V8Js instance is destroyed!", 0);
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
|
||||
V8JS_CTX_PROLOGUE(obj->ctx);
|
||||
V8JS_CTX_PROLOGUE_EX(obj->ctx, value);
|
||||
v8::Local<v8::Value> v8objHandle = v8::Local<v8::Value>::New(isolate, obj->v8obj);
|
||||
|
||||
if (Z_STRLEN_P(member) > std::numeric_limits<int>::max()) {
|
||||
zend_throw_exception(php_ce_v8js_exception,
|
||||
"Member name length exceeds maximum supported length", 0);
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> v8obj;
|
||||
if (v8objHandle->IsObject() && v8objHandle->ToObject(v8_context).ToLocal(&v8obj)) {
|
||||
v8obj->CreateDataProperty(v8_context, V8JS_ZSYM(Z_STR_P(member)), zval_to_v8js(value, isolate));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user