Commit:    27990438f184cfecd179a78231cfb04af6084f31
Author:    Anatol Belski <a...@php.net>         Tue, 10 Dec 2013 19:46:40 +0100
Parents:   34e5236836e9da4a5f0a384c73d482eb27793286 
8e29235b6c74a5eaaf4dec26e8e2aec92e3f44e1
Branches:  str_size_and_int64

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=27990438f184cfecd179a78231cfb04af6084f31

Log:
Merge branch 'master' into str_size_and_int64

Conflicts:
        Zend/zend_builtin_functions.c
        ext/opcache/Optimizer/pass1_5.c
        ext/reflection/php_reflection.c
        ext/soap/soap.c

Changed paths:
  MM  Zend/zend_builtin_functions.c
  MM  Zend/zend_compile.c
  MM  Zend/zend_execute_API.c
  MM  Zend/zend_operators.h
  MM  ext/opcache/Optimizer/pass1_5.c
  MM  ext/reflection/php_reflection.c
  MM  ext/soap/soap.c
  MM  sapi/cli/php_cli_server.c

diff --cc Zend/zend_builtin_functions.c
index 2b2de95,0a478a7..1d509ce
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@@ -2447,36 -2447,49 +2447,49 @@@ ZEND_FUNCTION(extension_loaded
     Returns an array with the names of functions belonging to the named 
extension */
  ZEND_FUNCTION(get_extension_funcs)
  {
-       char *extension_name;
-       zend_str_size extension_name_len;
+       char *extension_name, *lcname;
 -      int extension_name_len, array;
++      zend_str_size_int extension_name_len, array;
        zend_module_entry *module;
-       const zend_function_entry *func;
- 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", 
&extension_name, &extension_name_len) == FAILURE) {
+       HashPosition iterator;
+       zend_function *zif;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", 
&extension_name, &extension_name_len) == FAILURE) {
                return;
        }
- 
        if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
-               char *lcname = zend_str_tolower_dup(extension_name, 
extension_name_len);
-               if (zend_hash_find(&module_registry, lcname,
-                       extension_name_len+1, (void**)&module) == FAILURE) {
-                       efree(lcname);
-                       RETURN_FALSE;
-               }
+               lcname = zend_str_tolower_dup(extension_name, 
extension_name_len);
+       } else {
+               lcname = estrdup("core");
+       }
+       if (zend_hash_find(&module_registry, lcname,
+               extension_name_len+1, (void**)&module) == FAILURE) {
                efree(lcname);
+               RETURN_FALSE;
+       }
  
-               if (!(func = module->functions)) {
-                       RETURN_FALSE;
-               }
+       zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
+       if (module->functions) {
+               /* avoid BC break, if functions list is empty, will return an 
empty array */
+               array_init(return_value);
+               array = 1;
        } else {
-               func = builtin_functions;
+               array = 0;
+       }
+       while (zend_hash_get_current_data_ex(CG(function_table), (void **) 
&zif, &iterator) == SUCCESS) {
+               if (zif->common.type==ZEND_INTERNAL_FUNCTION
+                       && zif->internal_function.module == module) {
+                       if (!array) {
+                               array_init(return_value);
+                               array = 1;
+                       }
+                       add_next_index_string(return_value, 
zif->common.function_name, 1);
+               }
+               zend_hash_move_forward_ex(CG(function_table), &iterator);
        }
  
-       array_init(return_value);
+       efree(lcname);
  
-       while (func->fname) {
-               add_next_index_string(return_value, func->fname, 1);
-               func++;
+       if (!array) {
+               RETURN_FALSE;
        }
  }
  /* }}} */
diff --cc ext/opcache/Optimizer/pass1_5.c
index 474c074,f173c3f..34a22e3
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@@ -321,6 -321,27 +321,27 @@@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATIO
                        break;
  
                case ZEND_DO_FCALL:
+                       /* define("name", scalar); */
+                       if (collect_constants &&
+                           opline->extended_value == 2 &&
+                           ZEND_OP1_TYPE(opline) == IS_CONST &&
+                           Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
 -                          Z_STRLEN(ZEND_OP1_LITERAL(opline)) == 
sizeof("define")-1 &&
 -                          
zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), 
Z_STRLEN(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 &&
++                          Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == 
sizeof("define")-1 &&
++                          
zend_binary_strcasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), 
Z_STRSIZE(ZEND_OP1_LITERAL(opline)), "define", sizeof("define")-1) == 0 &&
+                           (opline-1)->opcode == ZEND_SEND_VAL &&
+                           ZEND_OP1_TYPE(opline-1) == IS_CONST &&
+                           (Z_TYPE(ZEND_OP1_LITERAL(opline-1)) <= IS_BOOL ||
+                            Z_TYPE(ZEND_OP1_LITERAL(opline-1)) == IS_STRING) &&
+                           (opline-2)->opcode == ZEND_SEND_VAL &&
+                           ZEND_OP1_TYPE(opline-2) == IS_CONST &&
+                           Z_TYPE(ZEND_OP1_LITERAL(opline-2)) == IS_STRING) {
+                               zend_optimizer_collect_constant(constants, 
&ZEND_OP1_LITERAL(opline-2), &ZEND_OP1_LITERAL(opline-1));
+                               break;
+                       } else {
+                               /* don't colllect constants after any other 
function call */
+                               collect_constants = 0;
+                       }
+ 
                        /* pre-evaluate constant functions:
                           defined(x)
                           constant(x)
diff --cc ext/soap/soap.c
index 6054e1a,90cd67f..a62e695
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@@ -2599,8 -2593,13 +2594,13 @@@ static int do_request(zval *this_ptr, x
                ret = FALSE;
        } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", 
sizeof("trace"), (void **) &trace) == SUCCESS &&
            Z_LVAL_PP(trace) > 0) {
 -              add_property_stringl(this_ptr, "__last_response", 
Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
 +              add_property_stringl(this_ptr, "__last_response", 
Z_STRVAL_P(response), Z_STRSIZE_P(response), 1);
        }
+       zval_ptr_dtor(&params[4]);
+       zval_ptr_dtor(&params[3]);
+       zval_ptr_dtor(&params[2]);
+       zval_ptr_dtor(&params[1]);
+       zval_ptr_dtor(&params[0]);
        xmlFree(buf);
        if (ret && zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", 
sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
          return FALSE;
@@@ -2692,116 -2691,121 +2692,121 @@@ static void do_soap_call(zval* this_ptr
                SOAP_GLOBAL(features) = 0;
        }
  
-       if (sdl != NULL) {
-               fn = get_function(sdl, function);
-               if (fn != NULL) {
-                       sdlBindingPtr binding = fn->binding;
-                       int one_way = 0;
- 
-                       if (fn->responseName == NULL &&
-                           fn->responseParameters == NULL &&
-                           soap_headers == NULL) {
-                               one_way = 1;
-                       }
- 
-                       if (location == NULL) {
-                               location = binding->location;
-                       }
-                       if (binding->bindingType == BINDING_SOAP) {
-                               sdlSoapBindingFunctionPtr fnb = 
(sdlSoapBindingFunctionPtr)fn->bindingAttributes;
-                               request = serialize_function_call(this_ptr, fn, 
NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers 
TSRMLS_CC);
-                               ret = do_request(this_ptr, request, location, 
fnb->soapAction, soap_version, one_way, &response TSRMLS_CC);
-                       }       else {
-                               request = serialize_function_call(this_ptr, fn, 
NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers 
TSRMLS_CC);
-                               ret = do_request(this_ptr, request, location, 
NULL, soap_version, one_way, &response TSRMLS_CC);
-                       }
- 
-                       xmlFreeDoc(request);
- 
-                       if (ret && Z_TYPE(response) == IS_STRING) {
-                               encode_reset_ns();
-                               ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers 
TSRMLS_CC);
-                               encode_finish();
-                       }
+       zend_try {
+               if (sdl != NULL) {
+                       fn = get_function(sdl, function);
+                       if (fn != NULL) {
+                               sdlBindingPtr binding = fn->binding;
+                               int one_way = 0;
+ 
+                               if (fn->responseName == NULL &&
+                                   fn->responseParameters == NULL &&
+                                   soap_headers == NULL) {
+                                       one_way = 1;
+                               }
  
-                       zval_dtor(&response);
+                               if (location == NULL) {
+                                       location = binding->location;
+                               }
+                               if (binding->bindingType == BINDING_SOAP) {
+                                       sdlSoapBindingFunctionPtr fnb = 
(sdlSoapBindingFunctionPtr)fn->bindingAttributes;
+                                       request = 
serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, 
arg_count, soap_version, soap_headers TSRMLS_CC);
+                                       ret = do_request(this_ptr, request, 
location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC);
+                               } else {
+                                       request = 
serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, 
arg_count, soap_version, soap_headers TSRMLS_CC);
+                                       ret = do_request(this_ptr, request, 
location, NULL, soap_version, one_way, &response TSRMLS_CC);
+                               }
+ 
+                               xmlFreeDoc(request);
+ 
+                               if (ret && Z_TYPE(response) == IS_STRING) {
+                                       encode_reset_ns();
 -                                      ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers 
TSRMLS_CC);
++                                      ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers 
TSRMLS_CC);
+                                       encode_finish();
+                               }
  
-               } else {
-                       smart_str error = {0};
-                       smart_str_appends(&error,"Function (\"");
-                       smart_str_appends(&error,function);
-                       smart_str_appends(&error,"\") is not a valid method for 
this service");
-                       smart_str_0(&error);
-                       add_soap_fault(this_ptr, "Client", error.c, NULL, NULL 
TSRMLS_CC);
-                       smart_str_free(&error);
-               }
-       } else {
-               zval **uri;
-               smart_str action = {0};
+                               zval_dtor(&response);
  
-               if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), 
(void *)&uri) == FAILURE) {
-                       add_soap_fault(this_ptr, "Client", "Error finding 
\"uri\" property", NULL, NULL TSRMLS_CC);
-               } else if (location == NULL) {
-                       add_soap_fault(this_ptr, "Client", "Error could not 
find \"location\" property", NULL, NULL TSRMLS_CC);
-               } else {
-                       if (call_uri == NULL) {
-                               call_uri = Z_STRVAL_PP(uri);
+                       } else {
+                               smart_str error = {0};
+                               smart_str_appends(&error,"Function (\"");
+                               smart_str_appends(&error,function);
+                               smart_str_appends(&error,"\") is not a valid 
method for this service");
+                               smart_str_0(&error);
+                               add_soap_fault(this_ptr, "Client", error.c, 
NULL, NULL TSRMLS_CC);
+                               smart_str_free(&error);
                        }
-                       request = serialize_function_call(this_ptr, NULL, 
function, call_uri, real_args, arg_count, soap_version, soap_headers TSRMLS_CC);
+               } else {
+                       zval **uri;
+                       smart_str action = {0};
  
-                       if (soap_action == NULL) {
-                               smart_str_appends(&action, call_uri);
-                               smart_str_appendc(&action, '#');
-                               smart_str_appends(&action, function);
+                       if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", 
sizeof("uri"), (void *)&uri) == FAILURE) {
+                               add_soap_fault(this_ptr, "Client", "Error 
finding \"uri\" property", NULL, NULL TSRMLS_CC);
+                       } else if (location == NULL) {
+                               add_soap_fault(this_ptr, "Client", "Error could 
not find \"location\" property", NULL, NULL TSRMLS_CC);
                        } else {
-                               smart_str_appends(&action, soap_action);
-                       }
-                       smart_str_0(&action);
+                               if (call_uri == NULL) {
+                                       call_uri = Z_STRVAL_PP(uri);
+                               }
+                               request = serialize_function_call(this_ptr, 
NULL, function, call_uri, real_args, arg_count, soap_version, soap_headers 
TSRMLS_CC);
  
-                       ret = do_request(this_ptr, request, location, action.c, 
soap_version, 0, &response TSRMLS_CC);
+                               if (soap_action == NULL) {
+                                       smart_str_appends(&action, call_uri);
+                                       smart_str_appendc(&action, '#');
+                                       smart_str_appends(&action, function);
+                               } else {
+                                       smart_str_appends(&action, soap_action);
+                               }
+                               smart_str_0(&action);
  
-                       smart_str_free(&action);
-                       xmlFreeDoc(request);
+                               ret = do_request(this_ptr, request, location, 
action.c, soap_version, 0, &response TSRMLS_CC);
  
-                       if (ret && Z_TYPE(response) == IS_STRING) {
-                               encode_reset_ns();
-                               ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, 
output_headers TSRMLS_CC);
-                               encode_finish();
-                       }
+                               smart_str_free(&action);
+                               xmlFreeDoc(request);
  
-                       zval_dtor(&response);
-               }
-       }
+                               if (ret && Z_TYPE(response) == IS_STRING) {
+                                       encode_reset_ns();
 -                                      ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, 
output_headers TSRMLS_CC);
++                                      ret = parse_packet_soap(this_ptr, 
Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, 
output_headers TSRMLS_CC);
+                                       encode_finish();
+                               }
  
-       if (!ret) {
-               zval** fault;
-               if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", 
sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
-                       *return_value = **fault;
-                       zval_copy_ctor(return_value);
+                               zval_dtor(&response);
+                       }
+               }
+ 
+               if (!ret) {
+                       zval** fault;
+                       if (zend_hash_find(Z_OBJPROP_P(this_ptr), 
"__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
+                               *return_value = **fault;
+                               zval_copy_ctor(return_value);
+                       } else {
+                               *return_value = *add_soap_fault(this_ptr, 
"Client", "Unknown Error", NULL, NULL TSRMLS_CC);
+                               zval_copy_ctor(return_value);
+                       }
                } else {
-                       *return_value = *add_soap_fault(this_ptr, "Client", 
"Unknown Error", NULL, NULL TSRMLS_CC);
-                       zval_copy_ctor(return_value);
-               }
-       } else {
-               zval** fault;
-               if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", 
sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
-                       *return_value = **fault;
-                       zval_copy_ctor(return_value);
+                       zval** fault;
+                       if (zend_hash_find(Z_OBJPROP_P(this_ptr), 
"__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
+                               *return_value = **fault;
+                               zval_copy_ctor(return_value);
+                       }
                }
-       }
  
-       if (!EG(exception) &&
-           Z_TYPE_P(return_value) == IS_OBJECT &&
-           instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry 
TSRMLS_CC) &&
-           (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", 
sizeof("_exceptions"), (void **) &tmp) != SUCCESS ||
-                  Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) {
-               zval *exception;
+               if (!EG(exception) &&
+                   Z_TYPE_P(return_value) == IS_OBJECT &&
+                   instanceof_function(Z_OBJCE_P(return_value), 
soap_fault_class_entry TSRMLS_CC) &&
+                   (zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions", 
sizeof("_exceptions"), (void **) &tmp) != SUCCESS ||
+                          Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) {
+                       zval *exception;
  
-               MAKE_STD_ZVAL(exception);
-               MAKE_COPY_ZVAL(&return_value, exception);
-               zend_throw_exception_object(exception TSRMLS_CC);
-       }
+                       MAKE_STD_ZVAL(exception);
+                       MAKE_COPY_ZVAL(&return_value, exception);
+                       zend_throw_exception_object(exception TSRMLS_CC);
+               }
  
+       } zend_catch {
+               _bailout = 1;
+       } zend_end_try();
+       
        if (SOAP_GLOBAL(encoding) != NULL) {
                xmlCharEncCloseFunc(SOAP_GLOBAL(encoding));
        }
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to