Changeset 864
- Timestamp:
- 2012-03-29T07:51:14+02:00 (15 months ago)
- Location:
- trunk
- Files:
-
- 6 added
- 1 edited
-
tests/include-skipif.php (added)
-
tests/sub-a.php (added)
-
tests/sub-b.php (added)
-
tests/xcache_include_absolute.phpt (added)
-
tests/xcache_include_relative_cwd.phpt (added)
-
tests/xcache_include_relative_file.phpt (added)
-
xcache.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r862 r864 199 199 } 200 200 #endif 201 202 #ifdef IS_UNICODE 203 if (entry1->name_type == IS_UNICODE) { 204 assert(IS_ABSOLUTE_PATH(entry1->name.ustr.val, entry1->name.ustr.len)); 205 } 206 else 207 #endif 208 { 209 assert(IS_ABSOLUTE_PATH(entry1->name.str.val, entry1->name.str.len)); 210 } 211 212 #ifdef IS_UNICODE 213 if (entry2->name_type == IS_UNICODE) { 214 assert(IS_ABSOLUTE_PATH(entry2->name.ustr.val, entry2->name.ustr.len)); 215 } 216 else 217 #endif 218 { 219 assert(IS_ABSOLUTE_PATH(entry2->name.str.val, entry2->name.str.len)); 220 } 201 221 /* fall */ 202 222 … … 204 224 do { 205 225 #ifdef IS_UNICODE 206 if (entry1->name_type == IS_UNICODE) { 226 if (entry1->name_type != entry2->name_type) { 227 return 0; 228 } 229 else if (entry1->name_type == IS_UNICODE) { 207 230 if (entry1->name.ustr.len != entry2->name.ustr.len) { 208 231 return 0; … … 210 233 return memcmp(entry1->name.ustr.val, entry2->name.ustr.val, (entry1->name.ustr.len + 1) * sizeof(UChar)) == 0; 211 234 } 212 #endif 213 if (entry1->name.str.len != entry2->name.str.len) { 214 return 0; 235 else 236 #endif 237 { 238 if (entry1->name.str.len != entry2->name.str.len) { 239 return 0; 240 } 241 return memcmp(entry1->name.str.val, entry2->name.str.val, entry1->name.str.len + 1) == 0; 215 242 } 216 return memcmp(entry1->name.str.val, entry2->name.str.val, entry1->name.str.len + 1) == 0;217 243 218 244 } while(0); … … 973 999 /* }}} */ 974 1000 975 static int xc_entry_init_key_php(xc_compiler_t *compiler TSRMLS_DC) /* {{{ */ 976 { 977 if (!compiler->filename || !SG(request_info).path_translated) { 978 return FAILURE; 979 } 980 981 if (strstr(compiler->filename, "://") != NULL) { 982 return FAILURE; 983 } 984 1001 static int xc_entry_php_resolve_opened_path(xc_compiler_t *compiler TSRMLS_DC) /* {{{ */ 1002 { 1003 assert(!compiler->opened_path); 1004 compiler->opened_path = expand_filepath(compiler->filename, compiler->opened_path_buffer TSRMLS_CC); 1005 return SUCCESS; 1006 } 1007 /* }}} */ 1008 static int xc_entry_php_init_key(xc_compiler_t *compiler TSRMLS_DC) /* {{{ */ 1009 { 985 1010 if (XG(stat)) { 986 1011 struct stat buf, *pbuf; … … 1049 1074 compiler->new_entry.file_inode = 0; 1050 1075 #endif 1051 compiler->opened_path = expand_filepath(compiler->filename, compiler->opened_path_buffer TSRMLS_CC); 1076 } 1077 1078 if (!compiler->new_entry.file_inode) { 1079 if (!compiler->opened_path) { 1080 xc_entry_php_resolve_opened_path(compiler TSRMLS_CC); 1081 } 1052 1082 } 1053 1083 … … 1094 1124 } 1095 1125 /* }}} */ 1096 static int xc_entry_ init_key_php_md5(xc_cache_t *cache, xc_compiler_t *compiler TSRMLS_DC) /* {{{ */1126 static int xc_entry_data_php_init_md5(xc_cache_t *cache, xc_compiler_t *compiler TSRMLS_DC) /* {{{ */ 1097 1127 { 1098 1128 unsigned char buf[1024]; … … 1134 1164 } 1135 1165 /* }}} */ 1136 static void xc_entry_ init_key_php_entry(xc_entry_php_t *entry_php, const char *filepath TSRMLS_DC) /* {{{*/1166 static void xc_entry_php_init(xc_entry_php_t *entry_php, const char *filepath TSRMLS_DC) /* {{{*/ 1137 1167 { 1138 1168 entry_php->filepath = ZEND_24((char *), NOTHING) filepath; … … 1635 1665 unsigned int i; 1636 1666 1637 xc_entry_ init_key_php_entry(&compiler->new_entry, zend_get_compiled_filename(TSRMLS_C) TSRMLS_CC);1667 xc_entry_php_init(&compiler->new_entry, zend_get_compiled_filename(TSRMLS_C) TSRMLS_CC); 1638 1668 memset(&const_usage, 0, sizeof(const_usage)); 1639 1669 … … 1825 1855 TRACE("miss entry %d:%s", compiler->new_entry.file_inode, compiler->new_entry.entry.name.str.val); 1826 1856 1827 if (xc_entry_ init_key_php_md5(cache, compiler TSRMLS_CC) != SUCCESS) {1857 if (xc_entry_data_php_init_md5(cache, compiler TSRMLS_CC) != SUCCESS) { 1828 1858 gaveup = 1; 1829 1859 break; … … 1832 1862 stored_php = xc_php_find_dmz(cache, &compiler->new_php TSRMLS_CC); 1833 1863 1834 /* miss but compiling */1835 1864 if (stored_php) { 1836 1865 compiler->new_entry.php = stored_php; 1837 1866 xc_php_addref_dmz(stored_php); 1838 1867 if (!compiler->opened_path) { 1839 compiler->opened_path = expand_filepath(compiler->filename, compiler->opened_path_buffer TSRMLS_CC);1840 } 1841 xc_entry_ init_key_php_entry(&compiler->new_entry, compiler->opened_path TSRMLS_CC);1868 xc_entry_php_resolve_opened_path(compiler TSRMLS_CC); 1869 } 1870 xc_entry_php_init(&compiler->new_entry, compiler->opened_path TSRMLS_CC); 1842 1871 stored_entry = xc_entry_php_store_dmz(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC); 1843 1872 TRACE(" cached %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val); … … 1978 2007 1979 2008 TRACE("xc_compile_file: type=%d name=%s", h->type, h->filename ? h->filename : "NULL"); 1980 if (!XG(cacher)) { 2009 2010 if (!XG(cacher) 2011 || !h->filename 2012 || !SG(request_info).path_translated 2013 || strstr(h->filename, "://") != NULL) { 1981 2014 op_array = old_compile_file(h, type TSRMLS_CC); 1982 2015 TRACE("%s", "cacher not enabled"); … … 1987 2020 compiler.opened_path = h->opened_path; 1988 2021 compiler.filename = compiler.opened_path ? compiler.opened_path : h->filename; 1989 if (xc_entry_ init_key_php(&compiler TSRMLS_CC) != SUCCESS) {2022 if (xc_entry_php_init_key(&compiler TSRMLS_CC) != SUCCESS) { 1990 2023 TRACE("failed to init key for %s", compiler.filename); 1991 2024 return old_compile_file(h, type TSRMLS_CC); … … 2631 2664 xc_hash_value_t hv; 2632 2665 2666 switch (name->type) { 2633 2667 #ifdef IS_UNICODE 2634 convert_to_unicode(name); 2668 case IS_UNICODE: 2669 case IS_STRING: 2670 #endif 2671 default: 2672 #ifdef IS_UNICODE 2673 convert_to_unicode(name); 2635 2674 #else 2636 convert_to_string(name); 2637 #endif 2675 convert_to_string(name); 2676 #endif 2677 } 2638 2678 2639 2679 #ifdef IS_UNICODE
Note: See TracChangeset
for help on using the changeset viewer.

