@@ -8,11 +8,11 @@ use parking_lot::{const_rwlock, RwLock, RwLockReadGuard, RwLockWriteGuard};
8
8
9
9
use crate :: boxed:: ZBox ;
10
10
use crate :: ffi:: {
11
- _zend_executor_globals, ext_php_rs_executor_globals, ext_php_rs_process_globals ,
12
- ext_php_rs_sapi_globals , file_globals , php_core_globals, php_file_globals, sapi_globals_struct ,
13
- sapi_header_struct, sapi_headers_struct, sapi_request_info, zend_is_auto_global ,
14
- TRACK_VARS_COOKIE , TRACK_VARS_ENV , TRACK_VARS_FILES , TRACK_VARS_GET , TRACK_VARS_POST ,
15
- TRACK_VARS_REQUEST , TRACK_VARS_SERVER ,
11
+ _zend_executor_globals, ext_php_rs_executor_globals, ext_php_rs_file_globals ,
12
+ ext_php_rs_process_globals , ext_php_rs_sapi_globals , php_core_globals, php_file_globals,
13
+ sapi_globals_struct , sapi_header_struct, sapi_headers_struct, sapi_request_info,
14
+ zend_is_auto_global , TRACK_VARS_COOKIE , TRACK_VARS_ENV , TRACK_VARS_FILES , TRACK_VARS_GET ,
15
+ TRACK_VARS_POST , TRACK_VARS_REQUEST , TRACK_VARS_SERVER ,
16
16
} ;
17
17
18
18
use crate :: types:: { ZendHashTable , ZendObject , ZendStr } ;
@@ -378,7 +378,8 @@ impl FileGlobals {
378
378
pub fn get ( ) -> GlobalReadGuard < Self > {
379
379
// SAFETY: PHP executor globals are statically declared therefore should never
380
380
// return an invalid pointer.
381
- let globals = unsafe { & file_globals } ;
381
+ let globals = unsafe { ext_php_rs_file_globals ( ) . as_ref ( ) }
382
+ . expect ( "Static file globals were invalid" ) ;
382
383
let guard = FILE_GLOBALS_LOCK . read ( ) ;
383
384
GlobalReadGuard { globals, guard }
384
385
}
@@ -393,7 +394,7 @@ impl FileGlobals {
393
394
pub fn get_mut ( ) -> GlobalWriteGuard < Self > {
394
395
// SAFETY: PHP executor globals are statically declared therefore should never
395
396
// return an invalid pointer.
396
- let globals = unsafe { & mut file_globals } ;
397
+ let globals = unsafe { & mut * ext_php_rs_file_globals ( ) } ;
397
398
let guard = SAPI_GLOBALS_LOCK . write ( ) ;
398
399
GlobalWriteGuard { globals, guard }
399
400
}
0 commit comments