} else {
decode = ImageInfo->decode_unicode_le;
}
- to = zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC);
- from = zend_multibyte_fetch_encoding(decode TSRMLS_CC);
++ to = zend_multibyte_fetch_encoding(ImageInfo->encode_unicode);
++ from = zend_multibyte_fetch_encoding(decode);
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
- if (zend_multibyte_encoding_converter(
+ if (!to || !from || zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
- zend_multibyte_fetch_encoding(ImageInfo->encode_unicode),
- zend_multibyte_fetch_encoding(decode)
- ) == (size_t)-1) {
+ to,
- from
- TSRMLS_CC) == (size_t)-1) {
++ from) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
szValuePtr = szValuePtr+8;
ByteCount -= 8;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
- if (zend_multibyte_encoding_converter(
- to = zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC);
- from = zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC);
++ to = zend_multibyte_fetch_encoding(ImageInfo->encode_jis);
++ from = zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le);
+ if (!to || !from || zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
- zend_multibyte_fetch_encoding(ImageInfo->encode_jis),
- zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le)
- ) == (size_t)-1) {
+ to,
- from
- TSRMLS_CC) == (size_t)-1) {
++ from) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
break;
case TAG_MAKER_NOTE:
- exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement);
- if (!exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC)) {
++ if (!exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement)) {
+ EFREE_IF(outside);
+ return FALSE;
+ }
break;
case TAG_EXIF_IFD_POINTER:
char resultLocale[INTL_MAX_LOCALE_LEN+1];
UAcceptResult outResult;
- if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &http_accept, &http_accept_len) == FAILURE)
+ if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &http_accept, &http_accept_len) == FAILURE)
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_accept_from_http: unable to parse input parameters", 0 TSRMLS_CC );
+ "locale_accept_from_http: unable to parse input parameters", 0 );
RETURN_FALSE;
}
+ if(http_accept_len > ULOC_FULLNAME_CAPACITY) {
+ /* check each fragment, if any bigger than capacity, can't do it due to bug #72533 */
+ char *start = http_accept;
+ char *end;
+ size_t len;
+ do {
+ end = strchr(start, ',');
+ len = end ? end-start : http_accept_len-(start-http_accept);
+ if(len > ULOC_FULLNAME_CAPACITY) {
+ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
+ "locale_accept_from_http: locale string too long", 0 TSRMLS_CC );
+ RETURN_FALSE;
+ }
+ if(end) {
+ start = end+1;
+ }
+ } while(end != NULL);
+ }
available = ures_openAvailableLocales(NULL, &status);
INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to retrieve locale list");
}
/* }}} */
+ static HashTable *php_snmp_get_gc(zval *object, zval ***gc_data, int *gc_data_count TSRMLS_DC) /* {{{ */
+ {
+ *gc_data = NULL;
+ *gc_data_count = 0;
+ return zend_std_get_properties(object TSRMLS_CC);
+ }
+ /* }}} */
+
/* {{{ php_snmp_get_properties(zval *object)
Returns all object properties. Injects SNMP properties into object on first call */
-static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC)
+static HashTable *php_snmp_get_properties(zval *object)
{
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
PHP_FUNCTION(getenv)
{
char *ptr, *str;
- int str_len;
+ size_t str_len;
+ zend_bool local_only = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &local_only) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &str, &str_len, &local_only) == FAILURE) {
RETURN_FALSE;
}
- /* SAPI method returns an emalloc()'d string */
- ptr = sapi_getenv(str, str_len);
- if (ptr) {
- // TODO: avoid realocation ???
- RETVAL_STRING(ptr);
- efree(ptr);
- return;
+ if (!local_only) {
+ /* SAPI method returns an emalloc()'d string */
- ptr = sapi_getenv(str, str_len TSRMLS_CC);
++ ptr = sapi_getenv(str, str_len);
+ if (ptr) {
- RETURN_STRING(ptr, 0);
++ // TODO: avoid realocation ???
++ RETVAL_STRING(ptr);
++ efree(ptr);
++ return;
+ }
}
#ifdef PHP_WIN32
{
const char *path,
const char *mode,
int options,
- char **opened_path,
- php_stream_context *context STREAMS_DC TSRMLS_DC)
+ zend_string **opened_path,
+ php_stream_context *context STREAMS_DC)
{
- int path_len;
+ size_t path_len;
- char *file_basename;
- size_t file_basename_len;
+ zend_string *file_basename;
char file_dirname[MAXPATHLEN];
struct zip *za;
}
}
-SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
+SAPI_API char *sapi_getenv(char *name, size_t name_len)
{
+ if (!strncasecmp(name, "HTTP_PROXY", name_len)) {
+ /* Ugly fix for HTTP_PROXY issue, see bug #72573 */
+ return NULL;
+ }
if (sapi_module.getenv) {
- char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC);
+ char *value, *tmp = sapi_module.getenv(name, name_len);
if (tmp) {
value = estrdup(tmp);
} else {
return 0; /* don't rearm */
}
- if (zend_hash_exists(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"))) {
+ /* Upgly hack to fix HTTP_PROXY issue, see bug #72573 */
+ static void check_http_proxy(HashTable *var_table)
+ {
- zend_hash_del(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"));
++ if (zend_hash_str_exists(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY")-1)) {
+ char *local_proxy = getenv("HTTP_PROXY");
+
+ if (!local_proxy) {
- zval *local_zval;
- ALLOC_INIT_ZVAL(local_zval);
- ZVAL_STRING(local_zval, local_proxy, 1);
- zend_hash_update(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"), &local_zval, sizeof(zval **), NULL);
++ zend_hash_str_del(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY")-1);
+ } else {
-static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC)
++ zval local_zval;
++ ZVAL_STRING(&local_zval, local_proxy);
++ zend_hash_str_update(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY")-1, &local_zval);
+ }
+ }
+ }
+
+static zend_bool php_auto_globals_create_server(zend_string *name)
{
if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) {
- php_register_server_variables(TSRMLS_C);
+ php_register_server_variables();
if (PG(register_argc_argv)) {
if (SG(request_info).argc) {
}
} else {
- zval *server_vars=NULL;
- ALLOC_ZVAL(server_vars);
- array_init(server_vars);
- INIT_PZVAL(server_vars);
- if (PG(http_globals)[TRACK_VARS_SERVER]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
- }
- PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
}
- check_http_proxy(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]));
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
- Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
++ check_http_proxy(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]));
+ zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_SERVER]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_env(zend_string *name)
{
- zval *env_vars = NULL;
- ALLOC_ZVAL(env_vars);
- array_init(env_vars);
- INIT_PZVAL(env_vars);
- if (PG(http_globals)[TRACK_VARS_ENV]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
- }
- PG(http_globals)[TRACK_VARS_ENV] = env_vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
+ array_init(&PG(http_globals)[TRACK_VARS_ENV]);
if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) {
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
+ php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV]);
}
- check_http_proxy(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV]));
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
- Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
++ check_http_proxy(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV]));
+ zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_ENV]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_ENV]);
return 0; /* don't rearm */
}