0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-01-03 14:31:53 +00:00

Handle access of undeclared properties

This commit is contained in:
Stefan Siegl 2015-09-28 22:57:00 +02:00
parent cbbce91ffd
commit fcb056b5a5

View File

@ -594,9 +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 && if(!property_info ||
property_info != ZEND_WRONG_PROPERTY_INFO && (property_info != ZEND_WRONG_PROPERTY_INFO &&
property_info->flags & ZEND_ACC_PUBLIC) { 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
@ -631,9 +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 && if(!property_info ||
property_info != ZEND_WRONG_PROPERTY_INFO && (property_info != ZEND_WRONG_PROPERTY_INFO &&
property_info->flags & ZEND_ACC_PUBLIC) { 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;
} }
@ -664,9 +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 && if(!property_info ||
property_info != ZEND_WRONG_PROPERTY_INFO && (property_info != ZEND_WRONG_PROPERTY_INFO &&
property_info->flags & ZEND_ACC_PUBLIC) { 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();
} }