@@ -108,6 +108,10 @@ static char *(*accelerator_orig_zend_resolve_path)(const char *filename, int fil
108
108
static void (* orig_chdir )(INTERNAL_FUNCTION_PARAMETERS ) = NULL ;
109
109
static ZEND_INI_MH ((* orig_include_path_on_modify )) = NULL ;
110
110
111
+ #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
112
+ static char * accel_php_resolve_path (const char * filename , int filename_length , const char * path TSRMLS_DC );
113
+ #endif
114
+
111
115
#ifdef ZEND_WIN32
112
116
# define INCREMENT (v ) InterlockedIncrement(&ZCSG(v))
113
117
# define DECREMENT (v ) InterlockedDecrement(&ZCSG(v))
@@ -196,28 +200,31 @@ static ZEND_INI_MH(accel_include_path_on_modify)
196
200
ZCG (include_path_len ) = new_value_length ;
197
201
198
202
if (ZCG (enabled ) && accel_startup_ok &&
199
- (ZCG (counted ) || ZCSG (accelerator_enabled )) &&
200
- !zend_accel_hash_is_full (& ZCSG (include_paths ))) {
201
-
202
- SHM_UNPROTECT ();
203
- zend_shared_alloc_lock (TSRMLS_C );
203
+ (ZCG (counted ) || ZCSG (accelerator_enabled ))) {
204
204
205
205
ZCG (include_path_key ) = zend_accel_hash_find (& ZCSG (include_paths ), ZCG (include_path ), ZCG (include_path_len ) + 1 );
206
206
if (!ZCG (include_path_key ) &&
207
- !zend_accel_hash_is_full (& ZCSG (include_paths ))) {
208
- char * key ;
207
+ !zend_accel_hash_is_full (& ZCSG (include_paths ))) {
208
+ SHM_UNPROTECT ();
209
+ zend_shared_alloc_lock (TSRMLS_C );
209
210
210
- key = zend_shared_alloc (ZCG (include_path_len ) + 2 );
211
- if (key ) {
212
- memcpy (key , ZCG (include_path ), ZCG (include_path_len ) + 1 );
213
- key [ZCG (include_path_len ) + 1 ] = 'A' + ZCSG (include_paths ).num_entries ;
214
- ZCG (include_path_key ) = key + ZCG (include_path_len ) + 1 ;
215
- zend_accel_hash_update (& ZCSG (include_paths ), key , ZCG (include_path_len ) + 1 , 0 , ZCG (include_path_key ));
216
- }
217
- }
211
+ ZCG (include_path_key ) = zend_accel_hash_find (& ZCSG (include_paths ), ZCG (include_path ), ZCG (include_path_len ) + 1 );
212
+ if (!ZCG (include_path_key ) &&
213
+ !zend_accel_hash_is_full (& ZCSG (include_paths ))) {
214
+ char * key ;
218
215
219
- zend_shared_alloc_unlock (TSRMLS_C );
220
- SHM_PROTECT ();
216
+ key = zend_shared_alloc (ZCG (include_path_len ) + 2 );
217
+ if (key ) {
218
+ memcpy (key , ZCG (include_path ), ZCG (include_path_len ) + 1 );
219
+ key [ZCG (include_path_len ) + 1 ] = 'A' + ZCSG (include_paths ).num_entries ;
220
+ ZCG (include_path_key ) = key + ZCG (include_path_len ) + 1 ;
221
+ zend_accel_hash_update (& ZCSG (include_paths ), key , ZCG (include_path_len ) + 1 , 0 , ZCG (include_path_key ));
222
+ }
223
+ }
224
+
225
+ zend_shared_alloc_unlock (TSRMLS_C );
226
+ SHM_PROTECT ();
227
+ }
221
228
} else {
222
229
ZCG (include_path_check ) = 1 ;
223
230
}
@@ -807,7 +814,6 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle
807
814
static inline int do_validate_timestamps (zend_persistent_script * persistent_script , zend_file_handle * file_handle TSRMLS_DC )
808
815
{
809
816
zend_file_handle ps_handle ;
810
- char actualpath [MAXPATHLEN + 1 ];
811
817
char * full_path_ptr = NULL ;
812
818
813
819
/** check that the persistant script is indeed the same file we cached
@@ -818,28 +824,36 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
818
824
if (strcmp (persistent_script -> full_path , file_handle -> opened_path ) != 0 ) {
819
825
return FAILURE ;
820
826
}
821
- } else {
822
- full_path_ptr = VCWD_REALPATH (file_handle -> filename , actualpath );
827
+ } else {
828
+ #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
829
+ full_path_ptr = accel_php_resolve_path (file_handle -> filename , strlen (file_handle -> filename ), ZCG (include_path ) TSRMLS_CC );
830
+ #else
831
+ full_path_ptr = accelerator_orig_zend_resolve_path (file_handle -> filename , strlen (file_handle -> filename ) TSRMLS_CC );
832
+ #endif
823
833
if (full_path_ptr && strcmp (persistent_script -> full_path , full_path_ptr ) != 0 ) {
834
+ efree (full_path_ptr );
824
835
return FAILURE ;
825
836
}
826
837
file_handle -> opened_path = full_path_ptr ;
827
838
}
828
839
829
840
if (persistent_script -> timestamp == 0 ) {
830
841
if (full_path_ptr ) {
842
+ efree (full_path_ptr );
831
843
file_handle -> opened_path = NULL ;
832
844
}
833
845
return FAILURE ;
834
846
}
835
847
836
848
if (zend_get_file_handle_timestamp (file_handle , NULL TSRMLS_CC ) == persistent_script -> timestamp ) {
837
849
if (full_path_ptr ) {
850
+ efree (full_path_ptr );
838
851
file_handle -> opened_path = NULL ;
839
852
}
840
853
return SUCCESS ;
841
854
}
842
855
if (full_path_ptr ) {
856
+ efree (full_path_ptr );
843
857
file_handle -> opened_path = NULL ;
844
858
}
845
859
@@ -938,6 +952,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
938
952
if (ZCG (include_path_check ) &&
939
953
ZCG (enabled ) && accel_startup_ok &&
940
954
(ZCG (counted ) || ZCSG (accelerator_enabled )) &&
955
+ !zend_accel_hash_find (& ZCSG (include_paths ), ZCG (include_path ), ZCG (include_path_len ) + 1 ) &&
941
956
!zend_accel_hash_is_full (& ZCSG (include_paths ))) {
942
957
943
958
SHM_UNPROTECT ();
0 commit comments