mirror of
https://github.com/phpv8/v8js.git
synced 2025-01-03 15:41:55 +00:00
PHP7 adapt: handle ZEND_WRONG_PROPERTY_INFO special ptr
This commit is contained in:
parent
1e8ce5a609
commit
794da39882
@ -440,7 +440,9 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
}
|
}
|
||||||
|
|
||||||
zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1 TSRMLS_CC);
|
zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1 TSRMLS_CC);
|
||||||
if(property_info && property_info->flags & ZEND_ACC_PUBLIC) {
|
if(property_info &&
|
||||||
|
property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
|
property_info->flags & ZEND_ACC_PUBLIC) {
|
||||||
/* Write value to PHP JS object */
|
/* Write value to PHP JS object */
|
||||||
php_obj->ForceSet(V8JS_SYML(ZSTR_VAL(member), ZSTR_LEN(member) - 1), zval_to_v8js(value, isolate TSRMLS_CC), v8::ReadOnly);
|
php_obj->ForceSet(V8JS_SYML(ZSTR_VAL(member), ZSTR_LEN(member) - 1), zval_to_v8js(value, isolate TSRMLS_CC), v8::ReadOnly);
|
||||||
}
|
}
|
||||||
@ -995,7 +997,9 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void **
|
|||||||
|
|
||||||
/* Check whether member is public, if so, export to V8. */
|
/* 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 TSRMLS_CC);
|
zend_property_info *property_info = zend_get_property_info(c->std.ce, Z_STR_P(member), 1 TSRMLS_CC);
|
||||||
if(!property_info || property_info->flags & ZEND_ACC_PUBLIC) {
|
if(!property_info ||
|
||||||
|
(property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
|
property_info->flags & ZEND_ACC_PUBLIC)) {
|
||||||
/* Global PHP JS object */
|
/* Global PHP JS object */
|
||||||
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
|
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
|
||||||
v8::Local<v8::Object> jsobj = V8JS_GLOBAL(isolate)->Get(object_name_js)->ToObject();
|
v8::Local<v8::Object> jsobj = V8JS_GLOBAL(isolate)->Get(object_name_js)->ToObject();
|
||||||
|
@ -594,7 +594,9 @@ inline v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> p
|
|||||||
/* Nope, not a method -- must be a (case-sensitive) property */
|
/* Nope, not a method -- must be a (case-sensitive) property */
|
||||||
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
||||||
|
|
||||||
if(property_info && property_info->flags & ZEND_ACC_PUBLIC) {
|
if(property_info &&
|
||||||
|
property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
|
property_info->flags & ZEND_ACC_PUBLIC) {
|
||||||
zval *property_val = zend_read_property(NULL, &zobject, V8JS_CONST name, name_len, true, &php_value TSRMLS_CC);
|
zval *property_val = zend_read_property(NULL, &zobject, V8JS_CONST name, name_len, true, &php_value TSRMLS_CC);
|
||||||
// special case uninitialized_zval_ptr and return an empty value
|
// special case uninitialized_zval_ptr and return an empty value
|
||||||
// (indicating that we don't intercept this property) if the
|
// (indicating that we don't intercept this property) if the
|
||||||
@ -629,7 +631,9 @@ inline v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> p
|
|||||||
else {
|
else {
|
||||||
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
||||||
|
|
||||||
if(property_info && property_info->flags & ZEND_ACC_PUBLIC) {
|
if(property_info &&
|
||||||
|
property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
|
property_info->flags & ZEND_ACC_PUBLIC) {
|
||||||
zend_update_property(scope, &zobject, V8JS_CONST name, name_len, &php_value TSRMLS_CC);
|
zend_update_property(scope, &zobject, V8JS_CONST name, name_len, &php_value TSRMLS_CC);
|
||||||
ret_value = set_value;
|
ret_value = set_value;
|
||||||
}
|
}
|
||||||
@ -660,7 +664,9 @@ inline v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> p
|
|||||||
} else {
|
} else {
|
||||||
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC);
|
||||||
|
|
||||||
if(property_info && property_info->flags & ZEND_ACC_PUBLIC) {
|
if(property_info &&
|
||||||
|
property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
|
property_info->flags & ZEND_ACC_PUBLIC) {
|
||||||
h->unset_property(&zobject, &zname, NULL TSRMLS_CC);
|
h->unset_property(&zobject, &zname, NULL TSRMLS_CC);
|
||||||
ret_value = V8JS_TRUE();
|
ret_value = V8JS_TRUE();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user