Commit:    325224832babac68b4c7d0ab1f38db5ce1192cb1
Author:    Anatol Belski <a...@php.net>         Mon, 9 Dec 2013 10:20:04 +0100
Parents:   31a4d08d37e744789f1718b890cbb0a9f1b9728d 
912be1243207a334a856c0d759c978a3029fd6d5
Branches:  str_size_and_int64

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

Log:
Merge remote-tracking branch 'origin/master' into str_size_and_int64

Conflicts:
        Zend/zend_compile.c
        Zend/zend_compile.h

Changed paths:
  MM  Zend/zend_compile.c
  MM  Zend/zend_compile.h
  MM  Zend/zend_globals.h
  MM  Zend/zend_language_parser.y
  MM  main/streams/plain_wrapper.c

diff --cc Zend/zend_compile.c
index 3da1084,35f5f30..77675f6
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@@ -417,12 -421,16 +421,16 @@@ int zend_add_ns_func_name_literal(zend_
        lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
        CALCULATE_LITERAL_HASH(lc_literal);
  
-       ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', 
Z_STRSIZE_P(zv)) + 1;
-       lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv));
-       lc_name = zend_str_tolower_dup(ns_separator, lc_len);
-       ZVAL_STRINGL(&c, lc_name, lc_len, 0);
-       lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
-       CALCULATE_LITERAL_HASH(lc_literal);
+       ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', 
Z_STRLEN_P(zv));
+ 
+       if (ns_separator != NULL) {
+               ns_separator += 1;
 -              lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv));
++              lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv));
+               lc_name = zend_str_tolower_dup(ns_separator, lc_len);
+               ZVAL_STRINGL(&c, lc_name, lc_len, 0);
+               lc_literal = zend_add_literal(CG(active_op_array), &c 
TSRMLS_CC);
+               CALCULATE_LITERAL_HASH(lc_literal);
+       }
  
        return ret;
  }
@@@ -1703,14 -1725,15 +1725,15 @@@ void zend_do_begin_function_declaration
                opline->op1_type = IS_CONST;
                build_runtime_defined_function_key(&key, lcname, name_len 
TSRMLS_CC);
                opline->op1.constant = zend_add_literal(CG(active_op_array), 
&key TSRMLS_CC);
 -              Z_HASH_P(&CONSTANT(opline->op1.constant)) = 
zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), 
Z_STRLEN(CONSTANT(opline->op1.constant)));
 +              Z_HASH_P(&CONSTANT(opline->op1.constant)) = 
zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), 
Z_STRSIZE(CONSTANT(opline->op1.constant)));
                opline->op2_type = IS_CONST;
-               LITERAL_STRINGL(opline->op2, lcname, name_len, 0);
+               LITERAL_STRINGL(opline->op2, lcname, name_len, 1);
                CALCULATE_LITERAL_HASH(opline->op2.constant);
                opline->extended_value = ZEND_DECLARE_FUNCTION;
 -              zend_hash_quick_update(CG(function_table), Z_STRVAL(key), 
Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, 
sizeof(zend_op_array), (void **) &CG(active_op_array));
 +              zend_hash_quick_update(CG(function_table), Z_STRVAL(key), 
Z_STRSIZE(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, 
sizeof(zend_op_array), (void **) &CG(active_op_array));
                zend_stack_push(&CG(context_stack), (void *) &CG(context), 
sizeof(CG(context)));
                zend_init_compiler_context(TSRMLS_C);
+               str_efree(lcname);
        }
  
        if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
@@@ -1931,9 -1954,9 +1954,9 @@@ int zend_do_begin_function_call(znode *
  {
        zend_function *function;
        char *lcname;
 -      char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', 
Z_STRLEN(function_name->u.constant));
 +      char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', 
Z_STRSIZE(function_name->u.constant));
  
-       zend_resolve_non_class_name(function_name, check_namespace TSRMLS_CC);
+       zend_resolve_function_name(function_name, &check_namespace TSRMLS_CC);
  
        if (check_namespace && CG(current_namespace) && !is_compound) {
                        /* We assume we call function from the current namespace
@@@ -2070,12 -2093,12 +2093,12 @@@ void zend_do_begin_dynamic_function_cal
  }
  /* }}} */
  
- void zend_resolve_non_class_name(znode *element_name, zend_bool 
check_namespace TSRMLS_DC) /* {{{ */
+ void zend_resolve_non_class_name(znode *element_name, zend_bool 
*check_namespace, zend_bool case_sensitive, HashTable *current_import_sub 
TSRMLS_DC) /* {{{ */
  {
        znode tmp;
 -      int len;
 +      zend_str_size len;
        zval **ns;
-       char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), 
'\\', Z_STRSIZE(element_name->u.constant));
 -      char *lookup_name, *compound = 
memchr(Z_STRVAL(element_name->u.constant), '\\', 
Z_STRLEN(element_name->u.constant));
++      char *lookup_name, *compound = 
memchr(Z_STRVAL(element_name->u.constant), '\\', 
Z_STRSIZE(element_name->u.constant));
  
        if (Z_STRVAL(element_name->u.constant)[0] == '\\') {
                /* name starts with \ so it is known and unambiguos, nothing to 
do here but shorten it */
@@@ -2098,14 -2141,15 +2141,15 @@@
                        tmp.u.constant = **ns;
                        zval_copy_ctor(&tmp.u.constant);
                        len += 1;
 -                      Z_STRLEN(element_name->u.constant) -= len;
 -                      memmove(Z_STRVAL(element_name->u.constant), 
Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1);
 +                      Z_STRSIZE(element_name->u.constant) -= len;
 +                      memmove(Z_STRVAL(element_name->u.constant), 
Z_STRVAL(element_name->u.constant)+len, Z_STRSIZE(element_name->u.constant)+1);
                        zend_do_build_namespace_name(&tmp, &tmp, element_name 
TSRMLS_CC);
                        *element_name = tmp;
-                       efree(lcname);
+                       efree(lookup_name);
+                       *check_namespace = 0;
                        return;
                }
-               efree(lcname);
+               efree(lookup_name);
        }
  
        if (CG(current_namespace)) {
@@@ -5628,9 -5684,9 +5684,9 @@@ void zend_do_fetch_constant(znode *resu
                        result->u.constant.type = IS_CONSTANT | fetch_type;
                        break;
                case ZEND_RT:
 -                      compound = memchr(Z_STRVAL(constant_name->u.constant), 
'\\', Z_STRLEN(constant_name->u.constant));
 +                      compound = memchr(Z_STRVAL(constant_name->u.constant), 
'\\', Z_STRSIZE(constant_name->u.constant));
  
-                       zend_resolve_non_class_name(constant_name, 
check_namespace TSRMLS_CC);
+                       zend_resolve_const_name(constant_name, &check_namespace 
TSRMLS_CC);
  
                        if(zend_constant_ct_subst(result, 
&constant_name->u.constant, 1 TSRMLS_CC)) {
                                break;
diff --cc Zend/zend_compile.h
index 7d21c24,e3f06a0..8fb87e1
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@@ -444,12 -440,14 +444,14 @@@ void shutdown_scanner(TSRMLS_D)
  ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename 
TSRMLS_DC);
  ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename 
TSRMLS_DC);
  ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
 -ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
 +ZEND_API zend_str_size_int zend_get_compiled_lineno(TSRMLS_D);
  ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
  
- void zend_resolve_non_class_name(znode *element_name, zend_bool 
check_namespace TSRMLS_DC);
+ void zend_resolve_non_class_name(znode *element_name, zend_bool 
*check_namespace, zend_bool case_sensitive, HashTable *current_import_sub 
TSRMLS_DC);
+ void zend_resolve_function_name(znode *element_name, zend_bool 
*check_namespace TSRMLS_DC);
+ void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace 
TSRMLS_DC);
  void zend_resolve_class_name(znode *class_name TSRMLS_DC);
 -ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array 
*op_array, zend_uint var, int* name_len);
 +ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array 
*op_array, zend_uint var, zend_str_size_int* name_len);
  
  #ifdef ZTS
  const char *zend_get_zendtext(TSRMLS_D);
@@@ -683,10 -684,10 +688,10 @@@ ZEND_API void zend_function_dtor(zend_f
  ZEND_API void destroy_zend_class(zend_class_entry **pce);
  void zend_class_add_ref(zend_class_entry **ce);
  
 -ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const 
char *src1, int src1_length, const char *src2, int src2_length, int internal);
 +ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int 
*dest_length, const char *src1, zend_str_size_int src1_length, const char 
*src2, zend_str_size_int src2_length, int internal);
  #define zend_unmangle_property_name(mangled_property, mangled_property_len, 
class_name, prop_name) \
-         zend_unmangle_property_name_ex(mangled_property, 
mangled_property_len, class_name, prop_name, NULL) 
+         zend_unmangle_property_name_ex(mangled_property, 
mangled_property_len, class_name, prop_name, NULL)
 -ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int 
mangled_property_len, const char **class_name, const char **prop_name, int 
*prop_len);
 +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, 
zend_str_size_int mangled_property_len, const char **class_name, const char 
**prop_name, zend_str_size_int *prop_len);
  
  #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
  #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to