mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-21 16:31:53 +00:00
Since ArrayBuffer has InternalFieldCount set to 2 by default, added !isArrayBuffer() and !isArrayBufferView() to ensure that is PHP object
This commit is contained in:
parent
752cfa1d50
commit
752cbdb8ac
@ -260,7 +260,7 @@ int v8js_to_zval(v8::Local<v8::Value> jsValue, zval *return_value, int flags, v8
|
||||
}
|
||||
|
||||
// if this is a wrapped PHP object, then just unwrap it.
|
||||
if (self->InternalFieldCount() == 2) {
|
||||
if ((self->InternalFieldCount() == 2) && !jsValue->IsArrayBufferView() && !jsValue->IsArrayBuffer()) {
|
||||
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
|
||||
zval zval_object;
|
||||
ZVAL_OBJ(&zval_object, object);
|
||||
|
@ -141,7 +141,8 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, c
|
||||
{
|
||||
v8::Local<v8::Object> param_object;
|
||||
|
||||
if (info[i]->IsObject() && info[i]->ToObject(v8_context).ToLocal(¶m_object) && param_object->InternalFieldCount() == 2)
|
||||
if (info[i]->IsObject() && info[i]->ToObject(v8_context).ToLocal(¶m_object) && param_object->InternalFieldCount() == 2
|
||||
&& !param_object->IsArrayBufferView() && !param_object->IsArrayBuffer())
|
||||
{
|
||||
/* This is a PHP object, passed to JS and back. */
|
||||
zend_object *object = reinterpret_cast<zend_object *>(param_object->GetAlignedPointerFromInternalField(1));
|
||||
|
@ -325,7 +325,8 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
|
||||
ZVAL_UNDEF(&value);
|
||||
|
||||
v8::Local<v8::Object> jsValObject;
|
||||
if (jsVal->IsObject() && jsVal->ToObject(v8_context).ToLocal(&jsValObject) && jsValObject->InternalFieldCount() == 2) {
|
||||
if (jsVal->IsObject() && !jsVal->IsArrayBufferView() && !jsVal->IsArrayBuffer()
|
||||
&& jsVal->ToObject(v8_context).ToLocal(&jsValObject) && (jsValObject->InternalFieldCount() == 2)) {
|
||||
/* This is a PHP object, passed to JS and back. */
|
||||
zend_object *object = reinterpret_cast<zend_object *>(jsValObject->GetAlignedPointerFromInternalField(1));
|
||||
ZVAL_OBJ(&value, object);
|
||||
|
Loading…
Reference in New Issue
Block a user