mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool() Closes GH-6844
This commit is contained in:
parent
f191e4f257
commit
09efad615b
20 changed files with 153 additions and 221 deletions
|
@ -235,8 +235,7 @@ constant_binary_op:
|
|||
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
|
||||
/* for A::B */
|
||||
if (op_array->scope &&
|
||||
!strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
|
||||
ZSTR_VAL(op_array->scope->name), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
|
||||
zend_string_equals_ci(Z_STR(ZEND_OP1_LITERAL(opline)), op_array->scope->name)) {
|
||||
ce = op_array->scope;
|
||||
} else {
|
||||
if ((ce = zend_hash_find_ptr(EG(class_table),
|
||||
|
|
|
@ -485,9 +485,10 @@ ZEND_API zend_string *zend_ini_get_value(zend_string *name) /* {{{ */
|
|||
|
||||
ZEND_API bool zend_ini_parse_bool(zend_string *str)
|
||||
{
|
||||
if ((ZSTR_LEN(str) == 4 && strcasecmp(ZSTR_VAL(str), "true") == 0)
|
||||
|| (ZSTR_LEN(str) == 3 && strcasecmp(ZSTR_VAL(str), "yes") == 0)
|
||||
|| (ZSTR_LEN(str) == 2 && strcasecmp(ZSTR_VAL(str), "on") == 0)) {
|
||||
if (zend_string_equals_literal_ci(str, "true")
|
||||
|| zend_string_equals_literal_ci(str, "yes")
|
||||
|| zend_string_equals_literal_ci(str, "on")
|
||||
) {
|
||||
return 1;
|
||||
} else {
|
||||
return atoi(ZSTR_VAL(str)) != 0;
|
||||
|
|
|
@ -2233,12 +2233,12 @@ PHP_FUNCTION(iconv)
|
|||
/* {{{ Sets internal encoding and output encoding for ob_iconv_handler() */
|
||||
PHP_FUNCTION(iconv_set_encoding)
|
||||
{
|
||||
char *type;
|
||||
zend_string *type;
|
||||
zend_string *charset;
|
||||
size_t type_len, retval;
|
||||
zend_result retval;
|
||||
zend_string *name;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &type, &charset) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
@ -2247,11 +2247,11 @@ PHP_FUNCTION(iconv_set_encoding)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(!strcasecmp("input_encoding", type)) {
|
||||
if(zend_string_equals_literal_ci(type, "input_encoding")) {
|
||||
name = zend_string_init("iconv.input_encoding", sizeof("iconv.input_encoding") - 1, 0);
|
||||
} else if(!strcasecmp("output_encoding", type)) {
|
||||
} else if(zend_string_equals_literal_ci(type, "output_encoding")) {
|
||||
name = zend_string_init("iconv.output_encoding", sizeof("iconv.output_encoding") - 1, 0);
|
||||
} else if(!strcasecmp("internal_encoding", type)) {
|
||||
} else if(zend_string_equals_literal_ci(type, "internal_encoding")) {
|
||||
name = zend_string_init("iconv.internal_encoding", sizeof("iconv.internal_encoding") - 1, 0);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
|
@ -2271,25 +2271,25 @@ PHP_FUNCTION(iconv_set_encoding)
|
|||
/* {{{ Get internal encoding and output encoding for ob_iconv_handler() */
|
||||
PHP_FUNCTION(iconv_get_encoding)
|
||||
{
|
||||
char *type = "all";
|
||||
size_t type_len = sizeof("all")-1;
|
||||
zend_string *type = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &type, &type_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &type) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (!strcasecmp("all", type)) {
|
||||
if (!type || zend_string_equals_literal_ci(type, "all")) {
|
||||
array_init(return_value);
|
||||
add_assoc_string(return_value, "input_encoding", get_input_encoding());
|
||||
add_assoc_string(return_value, "output_encoding", get_output_encoding());
|
||||
add_assoc_string(return_value, "internal_encoding", get_internal_encoding());
|
||||
} else if (!strcasecmp("input_encoding", type)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "input_encoding")) {
|
||||
RETVAL_STRING(get_input_encoding());
|
||||
} else if (!strcasecmp("output_encoding", type)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "output_encoding")) {
|
||||
RETVAL_STRING(get_output_encoding());
|
||||
} else if (!strcasecmp("internal_encoding", type)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "internal_encoding")) {
|
||||
RETVAL_STRING(get_internal_encoding());
|
||||
} else {
|
||||
/* TODO Warning/ValueError? */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ static const mbfl_encoding *php_mb_get_encoding(zend_string *encoding_name, uint
|
|||
const mbfl_encoding *encoding;
|
||||
zend_string *last_encoding_name = MBSTRG(last_used_encoding_name);
|
||||
if (last_encoding_name && (last_encoding_name == encoding_name
|
||||
|| !strcasecmp(ZSTR_VAL(encoding_name), ZSTR_VAL(last_encoding_name)))) {
|
||||
|| zend_string_equals_ci(encoding_name, last_encoding_name))) {
|
||||
return MBSTRG(last_used_encoding);
|
||||
}
|
||||
|
||||
|
@ -835,13 +835,13 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
|
|||
char *endptr = NULL;
|
||||
|
||||
if (new_value != NULL) {
|
||||
if (strcasecmp("none", ZSTR_VAL(new_value)) == 0) {
|
||||
if (zend_string_equals_literal_ci(new_value, "none")) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
||||
} else if (strcasecmp("long", ZSTR_VAL(new_value)) == 0) {
|
||||
} else if (zend_string_equals_literal_ci(new_value, "long")) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
||||
} else if (strcasecmp("entity", ZSTR_VAL(new_value)) == 0) {
|
||||
} else if (zend_string_equals_literal_ci(new_value, "entity")) {
|
||||
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
||||
} else {
|
||||
|
@ -3703,8 +3703,7 @@ PHP_FUNCTION(mb_send_mail)
|
|||
/* {{{ Returns the current settings of mbstring */
|
||||
PHP_FUNCTION(mb_get_info)
|
||||
{
|
||||
char *typ = NULL;
|
||||
size_t typ_len;
|
||||
zend_string *type = NULL;
|
||||
size_t n;
|
||||
char *name;
|
||||
zval row;
|
||||
|
@ -3713,10 +3712,10 @@ PHP_FUNCTION(mb_get_info)
|
|||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING(typ, typ_len)
|
||||
Z_PARAM_STR(type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (!typ || !strcasecmp("all", typ)) {
|
||||
if (!type || zend_string_equals_literal_ci(type, "all")) {
|
||||
array_init(return_value);
|
||||
if (MBSTRG(current_internal_encoding)) {
|
||||
add_assoc_string(return_value, "internal_encoding", (char *)MBSTRG(current_internal_encoding)->name);
|
||||
|
@ -3775,47 +3774,47 @@ PHP_FUNCTION(mb_get_info)
|
|||
} else {
|
||||
add_assoc_string(return_value, "strict_detection", "Off");
|
||||
}
|
||||
} else if (!strcasecmp("internal_encoding", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "internal_encoding")) {
|
||||
if (MBSTRG(current_internal_encoding)) {
|
||||
RETVAL_STRING((char *)MBSTRG(current_internal_encoding)->name);
|
||||
}
|
||||
} else if (!strcasecmp("http_input", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "http_input")) {
|
||||
if (MBSTRG(http_input_identify)) {
|
||||
RETVAL_STRING((char *)MBSTRG(http_input_identify)->name);
|
||||
}
|
||||
} else if (!strcasecmp("http_output", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "http_output")) {
|
||||
if (MBSTRG(current_http_output_encoding)) {
|
||||
RETVAL_STRING((char *)MBSTRG(current_http_output_encoding)->name);
|
||||
}
|
||||
} else if (!strcasecmp("http_output_conv_mimetypes", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "http_output_conv_mimetypes")) {
|
||||
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
|
||||
RETVAL_STRING(name);
|
||||
}
|
||||
} else if (!strcasecmp("mail_charset", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "mail_charset")) {
|
||||
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
|
||||
RETVAL_STRING(name);
|
||||
}
|
||||
} else if (!strcasecmp("mail_header_encoding", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "mail_header_encoding")) {
|
||||
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_header_encoding)) != NULL) {
|
||||
RETVAL_STRING(name);
|
||||
}
|
||||
} else if (!strcasecmp("mail_body_encoding", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "mail_body_encoding")) {
|
||||
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_body_encoding)) != NULL) {
|
||||
RETVAL_STRING(name);
|
||||
}
|
||||
} else if (!strcasecmp("illegal_chars", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "illegal_chars")) {
|
||||
RETVAL_LONG(MBSTRG(illegalchars));
|
||||
} else if (!strcasecmp("encoding_translation", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "encoding_translation")) {
|
||||
if (MBSTRG(encoding_translation)) {
|
||||
RETVAL_STRING("On");
|
||||
} else {
|
||||
RETVAL_STRING("Off");
|
||||
}
|
||||
} else if (!strcasecmp("language", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "language")) {
|
||||
if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) {
|
||||
RETVAL_STRING(name);
|
||||
}
|
||||
} else if (!strcasecmp("detect_order", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "detect_order")) {
|
||||
n = MBSTRG(current_detect_order_list_size);
|
||||
entry = MBSTRG(current_detect_order_list);
|
||||
if (n > 0) {
|
||||
|
@ -3826,7 +3825,7 @@ PHP_FUNCTION(mb_get_info)
|
|||
entry++;
|
||||
}
|
||||
}
|
||||
} else if (!strcasecmp("substitute_character", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "substitute_character")) {
|
||||
if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
|
||||
RETVAL_STRING("none");
|
||||
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
|
||||
|
@ -3836,7 +3835,7 @@ PHP_FUNCTION(mb_get_info)
|
|||
} else {
|
||||
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
|
||||
}
|
||||
} else if (!strcasecmp("strict_detection", typ)) {
|
||||
} else if (zend_string_equals_literal_ci(type, "strict_detection")) {
|
||||
if (MBSTRG(strict_detection)) {
|
||||
RETVAL_STRING("On");
|
||||
} else {
|
||||
|
|
|
@ -117,10 +117,7 @@ static ZEND_INI_MH(OnEnable)
|
|||
} else {
|
||||
/* It may be only temporary disabled */
|
||||
bool *p = (bool *) ZEND_INI_GET_ADDR();
|
||||
if ((ZSTR_LEN(new_value) == 2 && strcasecmp("on", ZSTR_VAL(new_value)) == 0) ||
|
||||
(ZSTR_LEN(new_value) == 3 && strcasecmp("yes", ZSTR_VAL(new_value)) == 0) ||
|
||||
(ZSTR_LEN(new_value) == 4 && strcasecmp("true", ZSTR_VAL(new_value)) == 0) ||
|
||||
atoi(ZSTR_VAL(new_value)) != 0) {
|
||||
if (zend_ini_parse_bool(new_value)) {
|
||||
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)");
|
||||
return FAILURE;
|
||||
} else {
|
||||
|
|
|
@ -185,9 +185,9 @@ static int php_openssl_is_http_stream_talking_to_iis(php_stream *stream) /* {{{
|
|||
#define SERVER_GOOGLE "Server: GFE/"
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(stream->wrapperdata), tmp) {
|
||||
if (strncasecmp(Z_STRVAL_P(tmp), SERVER_MICROSOFT_IIS, sizeof(SERVER_MICROSOFT_IIS)-1) == 0) {
|
||||
if (zend_string_equals_literal_ci(Z_STR_P(tmp), SERVER_MICROSOFT_IIS)) {
|
||||
return 1;
|
||||
} else if (strncasecmp(Z_STRVAL_P(tmp), SERVER_GOOGLE, sizeof(SERVER_GOOGLE)-1) == 0) {
|
||||
} else if (zend_string_equals_literal_ci(Z_STR_P(tmp), SERVER_GOOGLE)) {
|
||||
return 1;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
|
|
@ -4944,7 +4944,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
|
|||
case IS_STRING:
|
||||
if (Z_STRLEN_P(val) == 0) {
|
||||
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
|
||||
} else if (!strcasecmp(Z_STRVAL_P(val), "now()")) {
|
||||
} else if (zend_string_equals_literal_ci(Z_STR_P(val), "now()")) {
|
||||
ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1);
|
||||
} else {
|
||||
#define REGEX0 "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})(([ \\t]+|T)(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$"
|
||||
|
|
|
@ -55,18 +55,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
|
|||
old = PHAR_G(require_hash_orig);
|
||||
}
|
||||
|
||||
if (ZSTR_LEN(new_value) == 2 && !strcasecmp("on", ZSTR_VAL(new_value))) {
|
||||
ini = (bool) 1;
|
||||
}
|
||||
else if (ZSTR_LEN(new_value) == 3 && !strcasecmp("yes", ZSTR_VAL(new_value))) {
|
||||
ini = (bool) 1;
|
||||
}
|
||||
else if (ZSTR_LEN(new_value) == 4 && !strcasecmp("true", ZSTR_VAL(new_value))) {
|
||||
ini = (bool) 1;
|
||||
}
|
||||
else {
|
||||
ini = (bool) atoi(ZSTR_VAL(new_value));
|
||||
}
|
||||
ini = zend_ini_parse_bool(new_value);
|
||||
|
||||
/* do not allow unsetting in runtime */
|
||||
if (stage == ZEND_INI_STAGE_STARTUP) {
|
||||
|
|
|
@ -140,12 +140,12 @@ PHP_FUNCTION(readline)
|
|||
/* {{{ Gets/sets various internal readline variables. */
|
||||
PHP_FUNCTION(readline_info)
|
||||
{
|
||||
char *what = NULL;
|
||||
zend_string *what = NULL;
|
||||
zval *value = NULL;
|
||||
size_t what_len, oldval;
|
||||
size_t oldval;
|
||||
char *oldstr;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!z!", &what, &what_len, &value) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!z!", &what, &value) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ PHP_FUNCTION(readline_info)
|
|||
add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name));
|
||||
add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over);
|
||||
} else {
|
||||
if (!strcasecmp(what,"line_buffer")) {
|
||||
if (zend_string_equals_literal_ci(what,"line_buffer")) {
|
||||
oldstr = rl_line_buffer;
|
||||
if (value) {
|
||||
/* XXX if (rl_line_buffer) free(rl_line_buffer); */
|
||||
|
@ -187,22 +187,22 @@ PHP_FUNCTION(readline_info)
|
|||
rl_line_buffer = strdup(Z_STRVAL_P(value));
|
||||
}
|
||||
RETVAL_STRING(SAFE_STRING(oldstr));
|
||||
} else if (!strcasecmp(what, "point")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "point")) {
|
||||
RETVAL_LONG(rl_point);
|
||||
#ifndef PHP_WIN32
|
||||
} else if (!strcasecmp(what, "end")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "end")) {
|
||||
RETVAL_LONG(rl_end);
|
||||
#endif
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
} else if (!strcasecmp(what, "mark")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "mark")) {
|
||||
RETVAL_LONG(rl_mark);
|
||||
} else if (!strcasecmp(what, "done")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "done")) {
|
||||
oldval = rl_done;
|
||||
if (value) {
|
||||
rl_done = zval_get_long(value);
|
||||
}
|
||||
RETVAL_LONG(oldval);
|
||||
} else if (!strcasecmp(what, "pending_input")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "pending_input")) {
|
||||
oldval = rl_pending_input;
|
||||
if (value) {
|
||||
if (!try_convert_to_string(value)) {
|
||||
|
@ -211,17 +211,17 @@ PHP_FUNCTION(readline_info)
|
|||
rl_pending_input = Z_STRVAL_P(value)[0];
|
||||
}
|
||||
RETVAL_LONG(oldval);
|
||||
} else if (!strcasecmp(what, "prompt")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "prompt")) {
|
||||
RETVAL_STRING(SAFE_STRING(rl_prompt));
|
||||
} else if (!strcasecmp(what, "terminal_name")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "terminal_name")) {
|
||||
RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name));
|
||||
} else if (!strcasecmp(what, "completion_suppress_append")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "completion_suppress_append")) {
|
||||
oldval = rl_completion_suppress_append;
|
||||
if (value) {
|
||||
rl_completion_suppress_append = zend_is_true(value);
|
||||
}
|
||||
RETVAL_BOOL(oldval);
|
||||
} else if (!strcasecmp(what, "completion_append_character")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "completion_append_character")) {
|
||||
oldval = rl_completion_append_character;
|
||||
if (value) {
|
||||
if (!try_convert_to_string(value)) {
|
||||
|
@ -233,7 +233,7 @@ PHP_FUNCTION(readline_info)
|
|||
oldval == 0 ? ZSTR_EMPTY_ALLOC() : ZSTR_CHAR(oldval));
|
||||
#endif
|
||||
#if HAVE_ERASE_EMPTY_LINE
|
||||
} else if (!strcasecmp(what, "erase_empty_line")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "erase_empty_line")) {
|
||||
oldval = rl_erase_empty_line;
|
||||
if (value) {
|
||||
rl_erase_empty_line = zval_get_long(value);
|
||||
|
@ -241,10 +241,10 @@ PHP_FUNCTION(readline_info)
|
|||
RETVAL_LONG(oldval);
|
||||
#endif
|
||||
#ifndef PHP_WIN32
|
||||
} else if (!strcasecmp(what,"library_version")) {
|
||||
} else if (zend_string_equals_literal_ci(what,"library_version")) {
|
||||
RETVAL_STRING((char *)SAFE_STRING(rl_library_version));
|
||||
#endif
|
||||
} else if (!strcasecmp(what, "readline_name")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "readline_name")) {
|
||||
oldstr = (char*)rl_readline_name;
|
||||
if (value) {
|
||||
/* XXX if (rl_readline_name) free(rl_readline_name); */
|
||||
|
@ -254,7 +254,7 @@ PHP_FUNCTION(readline_info)
|
|||
rl_readline_name = strdup(Z_STRVAL_P(value));
|
||||
}
|
||||
RETVAL_STRING(SAFE_STRING(oldstr));
|
||||
} else if (!strcasecmp(what, "attempted_completion_over")) {
|
||||
} else if (zend_string_equals_literal_ci(what, "attempted_completion_over")) {
|
||||
oldval = rl_attempted_completion_over;
|
||||
if (value) {
|
||||
rl_attempted_completion_over = zval_get_long(value);
|
||||
|
|
|
@ -604,7 +604,7 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
|
|||
SESSION_CHECK_ACTIVE_STATE;
|
||||
SESSION_CHECK_OUTPUT_STATE;
|
||||
|
||||
if (!strncasecmp(ZSTR_VAL(new_value), "on", sizeof("on"))) {
|
||||
if (zend_string_equals_literal_ci(new_value, "on")) {
|
||||
PS(use_trans_sid) = (bool) 1;
|
||||
} else {
|
||||
PS(use_trans_sid) = (bool) atoi(ZSTR_VAL(new_value));
|
||||
|
@ -1732,24 +1732,24 @@ PHP_FUNCTION(session_set_cookie_params)
|
|||
ZEND_HASH_FOREACH_STR_KEY_VAL(options_ht, key, value) {
|
||||
if (key) {
|
||||
ZVAL_DEREF(value);
|
||||
if(!strcasecmp("lifetime", ZSTR_VAL(key))) {
|
||||
if (zend_string_equals_literal_ci(key, "lifetime")) {
|
||||
lifetime = zval_get_string(value);
|
||||
found++;
|
||||
} else if(!strcasecmp("path", ZSTR_VAL(key))) {
|
||||
} else if (zend_string_equals_literal_ci(key, "path")) {
|
||||
path = zval_get_string(value);
|
||||
found++;
|
||||
} else if(!strcasecmp("domain", ZSTR_VAL(key))) {
|
||||
} else if (zend_string_equals_literal_ci(key, "domain")) {
|
||||
domain = zval_get_string(value);
|
||||
found++;
|
||||
} else if(!strcasecmp("secure", ZSTR_VAL(key))) {
|
||||
} else if (zend_string_equals_literal_ci(key, "secure")) {
|
||||
secure = zval_is_true(value);
|
||||
secure_null = 0;
|
||||
found++;
|
||||
} else if(!strcasecmp("httponly", ZSTR_VAL(key))) {
|
||||
} else if (zend_string_equals_literal_ci(key, "httponly")) {
|
||||
httponly = zval_is_true(value);
|
||||
httponly_null = 0;
|
||||
found++;
|
||||
} else if(!strcasecmp("samesite", ZSTR_VAL(key))) {
|
||||
} else if (zend_string_equals_literal_ci(key, "samesite")) {
|
||||
samesite = zval_get_string(value);
|
||||
found++;
|
||||
} else {
|
||||
|
|
|
@ -313,26 +313,25 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
|||
zend_string *new_key, *new_value;
|
||||
|
||||
/* Set proper value for true/false settings */
|
||||
if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1))
|
||||
if (zend_string_equals_literal_ci(Z_STR_P(arg2), "on")
|
||||
|| zend_string_equals_literal_ci(Z_STR_P(arg2), "yes")
|
||||
|| zend_string_equals_literal_ci(Z_STR_P(arg2), "true")
|
||||
) {
|
||||
new_value = ZSTR_CHAR('1');
|
||||
} else if (
|
||||
(Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) ||
|
||||
(Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1))
|
||||
} else if (zend_string_equals_literal_ci(Z_STR_P(arg2), "no")
|
||||
|| zend_string_equals_literal_ci(Z_STR_P(arg2), "off")
|
||||
|| zend_string_equals_literal_ci(Z_STR_P(arg2), "none")
|
||||
|| zend_string_equals_literal_ci(Z_STR_P(arg2), "false")
|
||||
) {
|
||||
new_value = ZSTR_EMPTY_ALLOC();
|
||||
} else { /* Other than true/false setting */
|
||||
new_value = browscap_intern_str(ctx, Z_STR_P(arg2), persistent);
|
||||
}
|
||||
|
||||
if (!strcasecmp(Z_STRVAL_P(arg1), "parent")) {
|
||||
if (zend_string_equals_literal_ci(Z_STR_P(arg1), "parent")) {
|
||||
/* parent entry can not be same as current section -> causes infinite loop! */
|
||||
if (ctx->current_section_name != NULL &&
|
||||
!strcasecmp(ZSTR_VAL(ctx->current_section_name), Z_STRVAL_P(arg2))
|
||||
zend_string_equals_ci(ctx->current_section_name, Z_STR_P(arg2))
|
||||
) {
|
||||
zend_error(E_CORE_ERROR, "Invalid browscap ini file: "
|
||||
"'Parent' value cannot be same as the section name: %s "
|
||||
|
|
|
@ -355,8 +355,9 @@ PHP_FUNCTION(dns_check_record)
|
|||
{
|
||||
HEADER *hp;
|
||||
querybuf answer;
|
||||
char *hostname, *rectype = NULL;
|
||||
size_t hostname_len, rectype_len = 0;
|
||||
char *hostname;
|
||||
size_t hostname_len;
|
||||
zend_string *rectype = NULL;
|
||||
int type = DNS_T_MX, i;
|
||||
#if defined(HAVE_DNS_SEARCH)
|
||||
struct sockaddr_storage from;
|
||||
|
@ -370,7 +371,7 @@ PHP_FUNCTION(dns_check_record)
|
|||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STRING(hostname, hostname_len)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STRING(rectype, rectype_len)
|
||||
Z_PARAM_STR(rectype)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (hostname_len == 0) {
|
||||
|
@ -379,19 +380,19 @@ PHP_FUNCTION(dns_check_record)
|
|||
}
|
||||
|
||||
if (rectype) {
|
||||
if (!strcasecmp("A", rectype)) type = DNS_T_A;
|
||||
else if (!strcasecmp("NS", rectype)) type = DNS_T_NS;
|
||||
else if (!strcasecmp("MX", rectype)) type = DNS_T_MX;
|
||||
else if (!strcasecmp("PTR", rectype)) type = DNS_T_PTR;
|
||||
else if (!strcasecmp("ANY", rectype)) type = DNS_T_ANY;
|
||||
else if (!strcasecmp("SOA", rectype)) type = DNS_T_SOA;
|
||||
else if (!strcasecmp("CAA", rectype)) type = DNS_T_CAA;
|
||||
else if (!strcasecmp("TXT", rectype)) type = DNS_T_TXT;
|
||||
else if (!strcasecmp("CNAME", rectype)) type = DNS_T_CNAME;
|
||||
else if (!strcasecmp("AAAA", rectype)) type = DNS_T_AAAA;
|
||||
else if (!strcasecmp("SRV", rectype)) type = DNS_T_SRV;
|
||||
else if (!strcasecmp("NAPTR", rectype)) type = DNS_T_NAPTR;
|
||||
else if (!strcasecmp("A6", rectype)) type = DNS_T_A6;
|
||||
if (zend_string_equals_literal_ci(rectype, "A")) type = DNS_T_A;
|
||||
else if (zend_string_equals_literal_ci(rectype, "NS")) type = DNS_T_NS;
|
||||
else if (zend_string_equals_literal_ci(rectype, "MX")) type = DNS_T_MX;
|
||||
else if (zend_string_equals_literal_ci(rectype, "PTR")) type = DNS_T_PTR;
|
||||
else if (zend_string_equals_literal_ci(rectype, "ANY")) type = DNS_T_ANY;
|
||||
else if (zend_string_equals_literal_ci(rectype, "SOA")) type = DNS_T_SOA;
|
||||
else if (zend_string_equals_literal_ci(rectype, "CAA")) type = DNS_T_CAA;
|
||||
else if (zend_string_equals_literal_ci(rectype, "TXT")) type = DNS_T_TXT;
|
||||
else if (zend_string_equals_literal_ci(rectype, "CNAME")) type = DNS_T_CNAME;
|
||||
else if (zend_string_equals_literal_ci(rectype, "AAAA")) type = DNS_T_AAAA;
|
||||
else if (zend_string_equals_literal_ci(rectype, "SRV")) type = DNS_T_SRV;
|
||||
else if (zend_string_equals_literal_ci(rectype, "NAPTR")) type = DNS_T_NAPTR;
|
||||
else if (zend_string_equals_literal_ci(rectype, "A6")) type = DNS_T_A6;
|
||||
else {
|
||||
zend_argument_value_error(2, "must be a valid DNS record type");
|
||||
RETURN_THROWS();
|
||||
|
|
|
@ -94,14 +94,15 @@ cleanup:
|
|||
/* {{{ Check DNS records corresponding to a given Internet host name or IP address */
|
||||
PHP_FUNCTION(dns_check_record)
|
||||
{
|
||||
char *hostname, *rectype = NULL;
|
||||
size_t hostname_len, rectype_len = 0;
|
||||
char *hostname;
|
||||
size_t hostname_len;
|
||||
zend_string *rectype = NULL;
|
||||
int type = DNS_TYPE_MX;
|
||||
|
||||
DNS_STATUS status; /* Return value of DnsQuery_A() function */
|
||||
PDNS_RECORD pResult; /* Pointer to DNS_RECORD structure */
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|S", &hostname, &hostname_len, &rectype) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
@ -111,18 +112,18 @@ PHP_FUNCTION(dns_check_record)
|
|||
}
|
||||
|
||||
if (rectype) {
|
||||
if (!strcasecmp("A", rectype)) type = DNS_TYPE_A;
|
||||
else if (!strcasecmp("NS", rectype)) type = DNS_TYPE_NS;
|
||||
else if (!strcasecmp("MX", rectype)) type = DNS_TYPE_MX;
|
||||
else if (!strcasecmp("PTR", rectype)) type = DNS_TYPE_PTR;
|
||||
else if (!strcasecmp("ANY", rectype)) type = DNS_TYPE_ANY;
|
||||
else if (!strcasecmp("SOA", rectype)) type = DNS_TYPE_SOA;
|
||||
else if (!strcasecmp("TXT", rectype)) type = DNS_TYPE_TEXT;
|
||||
else if (!strcasecmp("CNAME", rectype)) type = DNS_TYPE_CNAME;
|
||||
else if (!strcasecmp("AAAA", rectype)) type = DNS_TYPE_AAAA;
|
||||
else if (!strcasecmp("SRV", rectype)) type = DNS_TYPE_SRV;
|
||||
else if (!strcasecmp("NAPTR", rectype)) type = DNS_TYPE_NAPTR;
|
||||
else if (!strcasecmp("A6", rectype)) type = DNS_TYPE_A6;
|
||||
if (zend_string_equals_literal_ci(rectype, "A")) type = DNS_TYPE_A;
|
||||
else if (zend_string_equals_literal_ci(rectype, "NS")) type = DNS_TYPE_NS;
|
||||
else if (zend_string_equals_literal_ci(rectype, "MX")) type = DNS_TYPE_MX;
|
||||
else if (zend_string_equals_literal_ci(rectype, "PTR")) type = DNS_TYPE_PTR;
|
||||
else if (zend_string_equals_literal_ci(rectype, "ANY")) type = DNS_TYPE_ANY;
|
||||
else if (zend_string_equals_literal_ci(rectype, "SOA")) type = DNS_TYPE_SOA;
|
||||
else if (zend_string_equals_literal_ci(rectype, "TXT")) type = DNS_TYPE_TEXT;
|
||||
else if (zend_string_equals_literal_ci(rectype, "CNAME")) type = DNS_TYPE_CNAME;
|
||||
else if (zend_string_equals_literal_ci(rectype, "AAAA")) type = DNS_TYPE_AAAA;
|
||||
else if (zend_string_equals_literal_ci(rectype, "SRV")) type = DNS_TYPE_SRV;
|
||||
else if (zend_string_equals_literal_ci(rectype, "NAPTR")) type = DNS_TYPE_NAPTR;
|
||||
else if (zend_string_equals_literal_ci(rectype, "A6")) type = DNS_TYPE_A6;
|
||||
else {
|
||||
zend_argument_value_error(2, "must be a valid DNS record type");
|
||||
RETURN_THROWS();
|
||||
|
|
|
@ -158,78 +158,30 @@ PHPAPI zend_string *php_mail_build_headers(HashTable *headers)
|
|||
break;
|
||||
}
|
||||
/* https://tools.ietf.org/html/rfc2822#section-3.6 */
|
||||
switch(ZSTR_LEN(key)) {
|
||||
case sizeof("orig-date")-1:
|
||||
if (!strncasecmp("orig-date", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("orig-date", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("from")-1:
|
||||
if (!strncasecmp("from", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("from", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("sender")-1:
|
||||
if (!strncasecmp("sender", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("sender", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("reply-to")-1:
|
||||
if (!strncasecmp("reply-to", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("reply-to", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("to")-1: /* "to", "cc" */
|
||||
if (!strncasecmp("to", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
zend_value_error("The additional headers cannot contain the \"To\" header");
|
||||
break;
|
||||
}
|
||||
if (!strncasecmp("cc", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("cc", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("bcc")-1:
|
||||
if (!strncasecmp("bcc", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("bcc", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("message-id")-1: /* "references" */
|
||||
if (!strncasecmp("message-id", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("message-id", s, key, val);
|
||||
} else if (!strncasecmp("references", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("references", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("in-reply-to")-1:
|
||||
if (!strncasecmp("in-reply-to", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("in-reply-to", s, key, val);
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
break;
|
||||
case sizeof("subject")-1:
|
||||
if (!strncasecmp("subject", ZSTR_VAL(key), ZSTR_LEN(key))) {
|
||||
zend_value_error("The additional headers cannot contain the \"Subject\" header");
|
||||
break;
|
||||
}
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
break;
|
||||
default:
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
if (zend_string_equals_literal_ci(key, "orig-date")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("orig-date", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "from")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("from", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "sender")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("sender", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "reply-to")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("reply-to", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "to")) {
|
||||
zend_value_error("The additional headers cannot contain the \"To\" header");
|
||||
} else if (zend_string_equals_literal_ci(key, "cc")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("cc", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "bcc")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("bcc", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "message-id")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("message-id", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "references")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("references", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "in-reply-to")) {
|
||||
PHP_MAIL_BUILD_HEADER_CHECK("in-reply-to", s, key, val);
|
||||
} else if (zend_string_equals_literal_ci(key, "subject")) {
|
||||
zend_value_error("The additional headers cannot contain the \"Subject\" header");
|
||||
} else {
|
||||
PHP_MAIL_BUILD_HEADER_DEFAULT(s, key, val);
|
||||
}
|
||||
|
||||
if (EG(exception)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ do { \
|
|||
if (Z_TYPE_P(val) == IS_STRING) { \
|
||||
php_mail_build_headers_elem(&s, key, val); \
|
||||
} else if (Z_TYPE_P(val) == IS_ARRAY) { \
|
||||
if (!strncasecmp(target, ZSTR_VAL(key), ZSTR_LEN(key))) { \
|
||||
if (zend_string_equals_literal_ci(key, target)) { \
|
||||
zend_type_error("Header \"%s\" must be of type string, array given", target); \
|
||||
break; \
|
||||
} \
|
||||
|
|
|
@ -887,15 +887,7 @@ static PHP_INI_MH(php_tidy_set_clean_output)
|
|||
int status;
|
||||
bool value;
|
||||
|
||||
if (ZSTR_LEN(new_value)==2 && strcasecmp("on", ZSTR_VAL(new_value))==0) {
|
||||
value = (bool) 1;
|
||||
} else if (ZSTR_LEN(new_value)==3 && strcasecmp("yes", ZSTR_VAL(new_value))==0) {
|
||||
value = (bool) 1;
|
||||
} else if (ZSTR_LEN(new_value)==4 && strcasecmp("true", ZSTR_VAL(new_value))==0) {
|
||||
value = (bool) 1;
|
||||
} else {
|
||||
value = (bool) atoi(ZSTR_VAL(new_value));
|
||||
}
|
||||
value = zend_ini_parse_bool(new_value);
|
||||
|
||||
if (stage == PHP_INI_STAGE_RUNTIME) {
|
||||
status = php_output_get_status();
|
||||
|
|
|
@ -1001,15 +1001,14 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
|
|||
xml_parser *parser;
|
||||
int auto_detect = 0;
|
||||
|
||||
char *encoding_param = NULL;
|
||||
size_t encoding_param_len = 0;
|
||||
zend_string *encoding_param = NULL;
|
||||
|
||||
char *ns_param = NULL;
|
||||
size_t ns_param_len = 0;
|
||||
|
||||
XML_Char *encoding;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|s!s": "|s!"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|S!s": "|S!"), &encoding_param, &ns_param, &ns_param_len) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
@ -1017,14 +1016,14 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
|
|||
/* The supported encoding types are hardcoded here because
|
||||
* we are limited to the encodings supported by expat/xmltok.
|
||||
*/
|
||||
if (encoding_param_len == 0) {
|
||||
if (ZSTR_LEN(encoding_param) == 0) {
|
||||
encoding = XML(default_encoding);
|
||||
auto_detect = 1;
|
||||
} else if (strcasecmp(encoding_param, "ISO-8859-1") == 0) {
|
||||
} else if (zend_string_equals_literal_ci(encoding_param, "ISO-8859-1")) {
|
||||
encoding = (XML_Char*)"ISO-8859-1";
|
||||
} else if (strcasecmp(encoding_param, "UTF-8") == 0) {
|
||||
} else if (zend_string_equals_literal_ci(encoding_param, "UTF-8")) {
|
||||
encoding = (XML_Char*)"UTF-8";
|
||||
} else if (strcasecmp(encoding_param, "US-ASCII") == 0) {
|
||||
} else if (zend_string_equals_literal_ci(encoding_param, "US-ASCII")) {
|
||||
encoding = (XML_Char*)"US-ASCII";
|
||||
} else {
|
||||
zend_argument_value_error(1, "is not a supported source encoding");
|
||||
|
|
|
@ -1273,9 +1273,9 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!strncasecmp(ZSTR_VAL(new_value), "off", sizeof("off"))) {
|
||||
if (zend_string_equals_literal_ci(new_value, "off")) {
|
||||
int_value = 0;
|
||||
} else if (!strncasecmp(ZSTR_VAL(new_value), "on", sizeof("on"))) {
|
||||
} else if (zend_string_equals_literal_ci(new_value, "on")) {
|
||||
int_value = 1;
|
||||
} else {
|
||||
int_value = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
|
||||
|
|
|
@ -200,10 +200,10 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
|
|||
}
|
||||
|
||||
/* PHP and Zend extensions are not added into configuration hash! */
|
||||
if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */
|
||||
if (!is_special_section && zend_string_equals_literal_ci(Z_STR_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */
|
||||
extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
|
||||
zend_llist_add_element(&extension_lists.functions, &extension_name);
|
||||
} else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
|
||||
} else if (!is_special_section && zend_string_equals_literal_ci(Z_STR_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
|
||||
extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
|
||||
zend_llist_add_element(&extension_lists.engine, &extension_name);
|
||||
|
||||
|
|
|
@ -587,18 +587,21 @@ PHP_FUNCTION(sapi_windows_cp_set)
|
|||
/* {{{ Get process codepage. */
|
||||
PHP_FUNCTION(sapi_windows_cp_get)
|
||||
{
|
||||
char *kind;
|
||||
size_t kind_len = 0;
|
||||
zend_string *kind = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &kind, &kind_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &kind) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (kind_len == sizeof("ansi")-1 && !strncasecmp(kind, "ansi", kind_len)) {
|
||||
if (!kind) {
|
||||
const struct php_win32_cp *cp = php_win32_cp_get_current();
|
||||
RETURN_LONG(cp->id);
|
||||
} else if (zend_string_equals_literal_ci(kind, "ansi")) {
|
||||
RETURN_LONG(GetACP());
|
||||
} else if (kind_len == sizeof("oem")-1 && !strncasecmp(kind, "oem", kind_len)) {
|
||||
} else if (zend_string_equals_literal_ci(kind, "oem")) {
|
||||
RETURN_LONG(GetOEMCP());
|
||||
} else {
|
||||
/* TODO Warn/ValueError for invalid kind? */
|
||||
const struct php_win32_cp *cp = php_win32_cp_get_current();
|
||||
RETURN_LONG(cp->id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue