<commit_before>/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 1997-2013 The PHP Group                                |
  +----------------------------------------------------------------------+
  | http://www.opensource.org/licenses/mit-license.php  MIT License      |
  +----------------------------------------------------------------------+
  | Author: <NAME> <<EMAIL>>                         |
  | Author: <NAME> <<EMAIL>>                             |
  +----------------------------------------------------------------------+
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php_v8js_macros.h"

extern "C" {
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
}

#include "v8js_class.h"
#include "v8js_exceptions.h"
#include "v8js_v8object_class.h"

ZEND_DECLARE_MODULE_GLOBALS(v8js)

/* {{{ INI Settings */

static ZEND_INI_MH(v8js_OnUpdateV8Flags) /* {{{ */
{
	if (new_value) {
		if (V8JSG(v8_flags)) {
			free(V8JSG(v8_flags));
			V8JSG(v8_flags) = NULL;
		}
		if (!new_value[0]) {
			return FAILURE;
		}
		V8JSG(v8_flags) = zend_strndup(new_value, new_value_length);
	}

	return SUCCESS;
}

static ZEND_INI_MH(v8js_OnUpdateUseDate) /* {{{ */
{
	bool value;
	if (new_value_length==2 && strcasecmp("on", new_value)==0) {
		value = (bool) 1;
    } else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
		value = (bool) 1;
	} else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
		value = (bool) 1;
	} else {
		value = (bool) atoi(new_value);
	}
	V8JSG(use_date) = value;
	return SUCCESS;
}
/* }}} */

static ZEND_INI_MH(v8js_OnUpdateUseArrayAccess) /* {{{ */
{
	bool value;
	if (new_value_length==2 && strcasecmp("on", new_value)==0) {
		value = (bool) 1;
    } else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
		value = (bool) 1;
	} else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
		value = (bool) 1;
	} else {
		value = (bool) atoi(new_value);
	}
	V8JSG(use_array_access) = value;
	return SUCCESS;<commit_msg>Adapt v8js.cc to PHP7 API<commit_after>/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | Copyright (c) 1997-2013 The PHP Group                                |
  +----------------------------------------------------------------------+
  | http://www.opensource.org/licenses/mit-license.php  MIT License      |
  +----------------------------------------------------------------------+
  | Author: <NAME> <<EMAIL>>                         |
  | Author: <NAME> <<EMAIL>>                             |
  +----------------------------------------------------------------------+
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php_v8js_macros.h"

extern "C" {
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
}

#include "v8js_class.h"
#include "v8js_exceptions.h"
#include "v8js_v8object_class.h"

ZEND_DECLARE_MODULE_GLOBALS(v8js)

/* {{{ INI Settings */

static ZEND_INI_MH(v8js_OnUpdateV8Flags) /* {{{ */
{
	if (new_value) {
		if (V8JSG(v8_flags)) {
			free(V8JSG(v8_flags));
			V8JSG(v8_flags) = NULL;
		}
		if (!new_value->val[0]) {
			return FAILURE;
		}
		V8JSG(v8_flags) = zend_strndup(new_value->val, new_value->len);
	}

	return SUCCESS;
}

static ZEND_INI_MH(v8js_OnUpdateUseDate) /* {{{ */
{
	bool value;
	if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
		value = (bool) 1;
    } else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
		value = (bool) 1;
	} else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
		value = (bool) 1;
	} else {
		value = (bool) atoi(new_value->val);
	}
	V8JSG(use_date) = value;
	return SUCCESS;
}
/* }}} */

static ZEND_INI_MH(v8js_OnUpdateUseArrayAccess) /* {{{ */
{
	bool value;
	if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) {
		value = (bool) 1;
    } else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) {
		value = (bool) 1;
	} else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) {
		value = (bool) 1;
	} else {
		value = (bool) atoi(new_value->val);
	}
	V8JSG(use_array_access) = value;
	return SUCCESS;
{'fraction_non_alphanumeric': 0.30273007485689124, 'fraction_numerical': 0.02157639806252752, 'mean_word_length': 1.6770771950500885, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3411011', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1575, 'n_words': 277}