0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-23 04:51:53 +00:00

Adapt v8js.cc to PHP7 API

This commit is contained in:
Stefan Siegl 2015-08-24 21:35:29 +02:00
parent 2d0aa9b2cc
commit 8e84f99830

20
v8js.cc
View File

@ -38,10 +38,10 @@ static ZEND_INI_MH(v8js_OnUpdateV8Flags) /* {{{ */
free(V8JSG(v8_flags)); free(V8JSG(v8_flags));
V8JSG(v8_flags) = NULL; V8JSG(v8_flags) = NULL;
} }
if (!new_value[0]) { if (!new_value->val[0]) {
return FAILURE; return FAILURE;
} }
V8JSG(v8_flags) = zend_strndup(new_value, new_value_length); V8JSG(v8_flags) = zend_strndup(new_value->val, new_value->len);
} }
return SUCCESS; return SUCCESS;
@ -50,14 +50,14 @@ static ZEND_INI_MH(v8js_OnUpdateV8Flags) /* {{{ */
static ZEND_INI_MH(v8js_OnUpdateUseDate) /* {{{ */ static ZEND_INI_MH(v8js_OnUpdateUseDate) /* {{{ */
{ {
bool value; bool value;
if (new_value_length==2 && strcasecmp("on", new_value)==0) { if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else if (new_value_length==3 && strcasecmp("yes", new_value)==0) { } else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else if (new_value_length==4 && strcasecmp("true", new_value)==0) { } else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else { } else {
value = (bool) atoi(new_value); value = (bool) atoi(new_value->val);
} }
V8JSG(use_date) = value; V8JSG(use_date) = value;
return SUCCESS; return SUCCESS;
@ -67,14 +67,14 @@ static ZEND_INI_MH(v8js_OnUpdateUseDate) /* {{{ */
static ZEND_INI_MH(v8js_OnUpdateUseArrayAccess) /* {{{ */ static ZEND_INI_MH(v8js_OnUpdateUseArrayAccess) /* {{{ */
{ {
bool value; bool value;
if (new_value_length==2 && strcasecmp("on", new_value)==0) { if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else if (new_value_length==3 && strcasecmp("yes", new_value)==0) { } else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else if (new_value_length==4 && strcasecmp("true", new_value)==0) { } else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
value = (bool) 1; value = (bool) 1;
} else { } else {
value = (bool) atoi(new_value); value = (bool) atoi(new_value->val);
} }
V8JSG(use_array_access) = value; V8JSG(use_array_access) = value;
return SUCCESS; return SUCCESS;