@@ -138,6 +138,8 @@ static void preload_shutdown(void);
138
138
static void preload_activate (void );
139
139
static void preload_restart (void );
140
140
141
+ static zend_string * normalize_path (const zend_string * src );
142
+
141
143
#ifdef HAVE_STDATOMIC_H
142
144
# define INCREMENT (v ) (++ZCSG(v))
143
145
# define DECREMENT (v ) (--ZCSG(v))
@@ -2008,14 +2010,12 @@ static int check_persistent_script_access(zend_persistent_script *persistent_scr
2008
2010
}
2009
2011
2010
2012
/* zend_compile() replacement */
2011
- zend_op_array * persistent_compile_file (zend_file_handle * file_handle , int type )
2013
+ static zend_op_array * persistent_compile_file_inner (zend_file_handle * file_handle , zend_string * const filename , int type )
2012
2014
{
2013
2015
zend_persistent_script * persistent_script = NULL ;
2014
2016
zend_string * key = NULL ;
2015
2017
bool from_shared_memory ; /* if the script we've got is stored in SHM */
2016
2018
2017
- zend_string * filename = file_handle -> filename ;
2018
-
2019
2019
if (!filename || !ZCG (accelerator_enabled )) {
2020
2020
/* The Accelerator is disabled, act as if without the Accelerator */
2021
2021
ZCG (cache_opline ) = NULL ;
@@ -2285,6 +2285,31 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
2285
2285
return zend_accel_load_script (persistent_script , from_shared_memory );
2286
2286
}
2287
2287
2288
+ /* zend_compile() replacement */
2289
+ zend_op_array * persistent_compile_file (zend_file_handle * file_handle , int type )
2290
+ {
2291
+ zend_string * filename = file_handle -> filename ;
2292
+
2293
+ zend_string * allocated_filename = NULL ;
2294
+ if (filename && ZCG (accelerator_enabled ) && !file_cache_only &&
2295
+ !is_stream_path (ZSTR_VAL (filename )) && (type == ZEND_INCLUDE || type == ZEND_REQUIRE )) {
2296
+ /* zend_include_or_eval() calls zend_resolve_path()
2297
+ only for ZEND_INCLUDE_ONCE and ZEND_REQUIRE_ONCE;
2298
+ for ZEND_INCLUDE/ZEND_REQUIRE, we need to do that
2299
+ here so lookups in the ZIP file work */
2300
+ filename = allocated_filename = normalize_path (filename );
2301
+ }
2302
+
2303
+ zend_op_array * op_array = persistent_compile_file_inner (file_handle , filename , type );
2304
+
2305
+ if (allocated_filename ) {
2306
+ /* free the normalized filename */
2307
+ zend_string_efree (allocated_filename );
2308
+ }
2309
+
2310
+ return op_array ;
2311
+ }
2312
+
2288
2313
static zend_always_inline zend_inheritance_cache_entry * zend_accel_inheritance_cache_find (zend_inheritance_cache_entry * entry , zend_class_entry * ce , zend_class_entry * parent , zend_class_entry * * traits_and_interfaces , bool * needs_autoload_ptr )
2289
2314
{
2290
2315
uint32_t i ;
0 commit comments