mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 07:01:52 +00:00
Merge pull request #512 from chrisbckr/php8-v8js_to_zval_check_arraybuffer
Since ArrayBuffer has InternalFieldCount set to 2 by default, added !…
This commit is contained in:
commit
133bf61e05
@ -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 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));
|
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
|
||||||
zval zval_object;
|
zval zval_object;
|
||||||
ZVAL_OBJ(&zval_object, 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;
|
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. */
|
/* This is a PHP object, passed to JS and back. */
|
||||||
zend_object *object = reinterpret_cast<zend_object *>(param_object->GetAlignedPointerFromInternalField(1));
|
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);
|
ZVAL_UNDEF(&value);
|
||||||
|
|
||||||
v8::Local<v8::Object> jsValObject;
|
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. */
|
/* This is a PHP object, passed to JS and back. */
|
||||||
zend_object *object = reinterpret_cast<zend_object *>(jsValObject->GetAlignedPointerFromInternalField(1));
|
zend_object *object = reinterpret_cast<zend_object *>(jsValObject->GetAlignedPointerFromInternalField(1));
|
||||||
ZVAL_OBJ(&value, object);
|
ZVAL_OBJ(&value, object);
|
||||||
|
Loading…
Reference in New Issue
Block a user