@@ -1196,6 +1196,8 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
1196
1196
/* store script structure in the hash table */
1197
1197
bucket = zend_accel_hash_update (& ZCSG (hash ), new_persistent_script -> full_path , new_persistent_script -> full_path_len + 1 , 0 , new_persistent_script );
1198
1198
if (bucket &&
1199
+ /* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
1200
+ memcmp (key , "phar://" , sizeof ("phar://" ) - 1 ) != 0 &&
1199
1201
(new_persistent_script -> full_path_len != key_length ||
1200
1202
memcmp (new_persistent_script -> full_path , key , key_length ) != 0 )) {
1201
1203
/* link key to the same persistent script in hash table */
@@ -1651,7 +1653,18 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
1651
1653
#endif
1652
1654
void * dummy = (void * ) 1 ;
1653
1655
1654
- zend_hash_quick_add (& EG (included_files ), persistent_script -> full_path , persistent_script -> full_path_len + 1 , persistent_script -> hash_value , & dummy , sizeof (void * ), NULL );
1656
+ if (zend_hash_quick_add (& EG (included_files ), persistent_script -> full_path , persistent_script -> full_path_len + 1 , persistent_script -> hash_value , & dummy , sizeof (void * ), NULL ) == SUCCESS ) {
1657
+ /* ext/phar has to load phar's metadata into memory */
1658
+ if (strstr (persistent_script -> full_path , ".phar" ) && !strstr (persistent_script -> full_path , "://" )) {
1659
+ php_stream_statbuf ssb ;
1660
+ char * fname = emalloc (sizeof ("phar://" ) + persistent_script -> full_path_len );
1661
+
1662
+ memcpy (fname , "phar://" , sizeof ("phar://" ) - 1 );
1663
+ memcpy (fname + sizeof ("phar://" ) - 1 , persistent_script -> full_path , persistent_script -> full_path_len + 1 );
1664
+ php_stream_stat_path (fname , & ssb );
1665
+ efree (fname );
1666
+ }
1667
+ }
1655
1668
}
1656
1669
}
1657
1670
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
0 commit comments