Browse Source

Merge branch 'PHP-5.6'

Conflicts:
	ext/soap/soap.c
	ext/standard/basic_functions.c
	ext/zlib/zlib.c
pull/944/merge
Xinchen Hui 11 years ago
parent
commit
da7d94cd73
  1. 14
      Zend/zend_compile.c
  2. 1
      Zend/zend_compile.h
  3. 8
      ext/filter/filter.c
  4. 6
      ext/soap/soap.c
  5. 2
      ext/standard/basic_functions.c
  6. 7
      ext/standard/browscap.c
  7. 5
      ext/zlib/zlib.c
  8. 5
      sapi/cli/php_cli.c
  9. 6
      sapi/phpdbg/phpdbg_utils.c

14
Zend/zend_compile.c

@ -1229,6 +1229,7 @@ static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name,
return 0;
}
/* }}} */
void zend_init_list(void *result, void *item) /* {{{ */
{
@ -1309,6 +1310,19 @@ void zend_do_extended_fcall_end(void) /* {{{ */
}
/* }}} */
zend_bool zend_is_auto_global_str(char *name, size_t len) /* {{{ */ {
zend_auto_global *auto_global;
if ((auto_global = zend_hash_str_find_ptr(CG(auto_globals), name, len)) != NULL) {
if (auto_global->armed) {
auto_global->armed = auto_global->auto_global_callback(auto_global->name);
}
return 1;
}
return 0;
}
/* }}} */
zend_bool zend_is_auto_global(zend_string *name) /* {{{ */
{
zend_auto_global *auto_global;

1
Zend/zend_compile.h

@ -730,6 +730,7 @@ typedef struct _zend_auto_global {
ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback);
ZEND_API void zend_activate_auto_globals(void);
ZEND_API zend_bool zend_is_auto_global(zend_string *name);
ZEND_API zend_bool zend_is_auto_global_str(char *name, size_t len);
ZEND_API size_t zend_dirname(char *path, size_t len);
int zendlex(zend_parser_stack_elem *elem);

8
ext/filter/filter.c

@ -534,17 +534,13 @@ static zval *php_filter_get_storage(zend_long arg)/* {{{ */
break;
case PARSE_SERVER:
if (PG(auto_globals_jit)) {
zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(name);
zend_string_release(name);
zend_is_auto_global_str(ZEND_STRL("_SERVER"));
}
array_ptr = &IF_G(server_array);
break;
case PARSE_ENV:
if (PG(auto_globals_jit)) {
zend_string *name = zend_string_init("_ENV", sizeof("_ENV") - 1, 0);
zend_is_auto_global(name);
zend_string_release(name);
zend_is_auto_global_str(ZEND_STRL("_ENV"));
}
array_ptr = &IF_G(env_array) ? &IF_G(env_array) : &PG(http_globals)[TRACK_VARS_ENV];
break;

6
ext/soap/soap.c

@ -1568,7 +1568,7 @@ PHP_METHOD(SoapServer, handle)
if (SG(request_info).request_body && 0 == php_stream_rewind(SG(request_info).request_body)) {
zval *server_vars, *encoding;
php_stream_filter *zf = NULL;
zend_string *server = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0);
zend_string *server = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(server);
if ((server_vars = zend_hash_find(&EG(symbol_table).ht, server)) != NULL &&
@ -2089,9 +2089,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
xmlDocDumpMemory(doc_return, &buf, &size);
server = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(server);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF &&
if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) &&
(agent_name = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) != NULL &&
Z_TYPE_P(agent_name) == IS_STRING) {
if (strncmp(Z_STRVAL_P(agent_name), "Shockwave Flash", sizeof("Shockwave Flash")-1) == 0) {

2
ext/standard/basic_functions.c

@ -4229,7 +4229,7 @@ PHP_FUNCTION(getopt)
/* Get argv from the global symbol table. We calculate argc ourselves
* in order to be on the safe side, even though it is also available
* from the symbol table. */
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF &&
if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) &&
((args = zend_hash_str_find_ind(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv")-1)) != NULL ||
(args = zend_hash_str_find_ind(&EG(symbol_table).ht, "argv", sizeof("argv")-1)) != NULL)
) {

7
ext/standard/browscap.c

@ -462,11 +462,8 @@ PHP_FUNCTION(get_browser)
}
if (agent_name == NULL) {
zend_string *key = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(key);
zend_string_release(key);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF ||
(http_user_agent = zend_hash_str_find(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) == NULL
if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) ||
(http_user_agent = zend_hash_str_find(Z_ARRVAL_P(&PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) == NULL
) {
php_error_docref(NULL, E_WARNING, "HTTP_USER_AGENT variable is not set, cannot determine user agent name");
RETURN_FALSE;

5
ext/zlib/zlib.c

@ -82,10 +82,7 @@ static int php_zlib_output_encoding(void)
zval *enc;
if (!ZLIBG(compression_coding)) {
zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(name);
zend_string_release(name);
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) &&
(enc = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING") - 1))) {
convert_to_string(enc);
if (strstr(Z_STRVAL_P(enc), "gzip")) {

5
sapi/cli/php_cli.c

@ -661,7 +661,6 @@ static int do_cli(int argc, char **argv) /* {{{ */
int lineno = 0;
const char *param_error=NULL;
int hide_argv = 0;
zend_string *key;
zend_try {
@ -965,9 +964,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
}
}
key = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0);
zend_is_auto_global(key);
zend_string_release(key);
zend_is_auto_global_str(ZEND_STRL("_SERVER"));
PG(during_request_startup) = 0;
switch (behavior) {

6
sapi/phpdbg/phpdbg_utils.c

@ -516,11 +516,7 @@ PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable
}
int phpdbg_is_auto_global(char *name, int len) {
int ret;
zend_string *str = zend_string_init(name, len, 0);
ret = zend_is_auto_global(str);
efree(str);
return ret;
return zend_is_auto_global_str(name, len);
}
static int phpdbg_xml_array_element_dump(zval *zv, zend_string *key, zend_ulong num) {

Loading…
Cancel
Save