php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
func_interceptors.c File Reference

Go to the source code of this file.

Data Structures

struct  _phar_orig_functions
 

Macros

#define IS_LINK_OPERATION(__t)
 
#define IS_EXISTS_CHECK(__t)
 
#define IS_ABLE_CHECK(__t)
 
#define IS_ACCESS_CHECK(__t)
 
#define PharFileFunction(fname, funcnum, orig)
 
#define PHAR_INTERCEPT(func)
 
#define PHAR_RELEASE(func)
 

Functions

 if (!PHAR_G(intercepted))
 
 if ((HT_IS_INITIALIZED(&PHAR_G(phar_fname_map)) &&!zend_hash_num_elements(&(PHAR_G(phar_fname_map)))) &&!HT_IS_INITIALIZED(&cached_phars))
 
 if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r!", &filename, &filename_len, &zcontext)==FAILURE)
 
 if (!IS_ABSOLUTE_PATH(filename, filename_len) &&!strstr(filename, "://"))
 
 if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "P|br!ll!", &filename, &use_include_path, &zcontext, &offset, &maxlen, &maxlen_is_null)==FAILURE)
 
 if (maxlen_is_null)
 
else if (maxlen< 0)
 
 if (use_include_path||(!IS_ABSOLUTE_PATH(ZSTR_VAL(filename), ZSTR_LEN(filename)) &&!strstr(ZSTR_VAL(filename), "://")))
 
 if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "P|br!", &filename, &use_include_path, &zcontext)==FAILURE)
 
 if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "Ps|br!", &filename, &mode, &mode_len, &use_include_path, &zcontext)==FAILURE)
 
 PharFileFunction (phar_fileperms, FS_PERMS, orig_fileperms)
 
 if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p", &filename, &filename_len)==FAILURE)
 
 PharFileFunction (phar_lstat, FS_LSTAT, orig_lstat)
 
void phar_release_functions (void)
 
void phar_intercept_functions_init (void)
 
void phar_intercept_functions_shutdown (void)
 
void phar_save_orig_functions (void)
 
void phar_restore_orig_functions (void)
 

Variables

size_t filename_len
 
zvalzcontext = NULL
 
skip_phar __pad0__
 
 return
 
zend_stringcontents
 
bool use_include_path = 0
 
zend_long offset = -1
 
zend_long maxlen
 
bool maxlen_is_null = 1
 
skip_phar __pad1__
 
skip_phar __pad2__
 
char * mode
 
size_t mode_len
 
skip_phar __pad3__
 
skip_phar __pad4__
 

Macro Definition Documentation

◆ IS_ABLE_CHECK

#define IS_ABLE_CHECK ( __t)
Value:
((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X)
#define FS_IS_W
#define FS_IS_X
#define FS_IS_R

Definition at line 328 of file func_interceptors.c.

◆ IS_ACCESS_CHECK

#define IS_ACCESS_CHECK ( __t)
Value:
zend_ffi_type * type
Definition ffi.c:3812
#define IS_ABLE_CHECK(__t)
#define FS_EXISTS

Definition at line 329 of file func_interceptors.c.

◆ IS_EXISTS_CHECK

#define IS_EXISTS_CHECK ( __t)
Value:
((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
#define FS_IS_DIR
#define FS_IS_FILE
#define FS_IS_LINK

Definition at line 327 of file func_interceptors.c.

◆ IS_LINK_OPERATION

#define IS_LINK_OPERATION ( __t)
Value:
((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT)
#define FS_TYPE
#define FS_LSTAT

Definition at line 326 of file func_interceptors.c.

◆ PHAR_INTERCEPT

#define PHAR_INTERCEPT ( func)
Value:
PHAR_G(orig_##func) = NULL; \
if (NULL != (orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1))) { \
PHAR_G(orig_##func) = orig->internal_function.handler; \
orig->internal_function.handler = PHP_FN(phar_##func); \
}
#define NULL
Definition gdcache.h:45
#define PHAR_G(v)
#define PHP_FN
Definition php.h:361
execute_data func
#define CG(v)

Definition at line 884 of file func_interceptors.c.

◆ PHAR_RELEASE

#define PHAR_RELEASE ( func)
Value:
if (PHAR_G(orig_##func) && NULL != (orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1))) { \
orig->internal_function.handler = PHAR_G(orig_##func); \
} \
PHAR_G(orig_##func) = NULL;

Definition at line 922 of file func_interceptors.c.

◆ PharFileFunction

#define PharFileFunction ( fname,
funcnum,
orig )
Value:
PHP_FUNCTION(fname) { \
if (!PHAR_G(intercepted)) { \
} else { \
char *filename; \
size_t filename_len; \
\
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { \
RETURN_THROWS(); \
} \
\
phar_file_stat(filename, filename_len, funcnum, PHAR_G(orig), INTERNAL_FUNCTION_PARAM_PASSTHRU); \
} \
}
size_t filename_len
bool intercepted
#define PHP_FUNCTION
Definition php.h:364
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
Definition zend.h:50
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
Definition zend_API.c:1300
#define ZEND_NUM_ARGS()
Definition zend_API.h:530
@ FAILURE
Definition zend_types.h:61

Definition at line 654 of file func_interceptors.c.

Function Documentation

◆ if() [1/11]

if ( ! IS_ABSOLUTE_PATHfilename, filename_len) &&!strstr(filename, "://")

Definition at line 42 of file func_interceptors.c.

◆ if() [2/11]

if ( ! PHAR_Gintercepted)

Definition at line 29 of file func_interceptors.c.

◆ if() [3/11]

if ( (HT_IS_INITIALIZED(&PHAR_G(phar_fname_map)) &&!zend_hash_num_elements(&(PHAR_G(phar_fname_map)))) &&!HT_IS_INITIALIZED & cached_phars)

Definition at line 33 of file func_interceptors.c.

◆ if() [4/11]

else if ( )

Definition at line 184 of file func_interceptors.c.

◆ if() [5/11]

Definition at line 182 of file func_interceptors.c.

◆ if() [6/11]

if ( use_include_path|| !IS_ABSOLUTE_PATH(ZSTR_VAL(filename), ZSTR_LEN(filename)) &&!strstr(ZSTR_VAL(filename), "://"))

Definition at line 189 of file func_interceptors.c.

◆ if() [7/11]

if ( zend_parse_parameters(ZEND_NUM_ARGS(), "p|r!", &filename, &filename_len, &zcontext) = FAILURE)

Definition at line 38 of file func_interceptors.c.

◆ if() [8/11]

Definition at line 806 of file func_interceptors.c.

◆ if() [9/11]

◆ if() [10/11]

Definition at line 249 of file func_interceptors.c.

◆ if() [11/11]

◆ phar_intercept_functions_init()

void phar_intercept_functions_init ( void )

Definition at line 891 of file func_interceptors.c.

◆ phar_intercept_functions_shutdown()

void phar_intercept_functions_shutdown ( void )

Definition at line 928 of file func_interceptors.c.

◆ phar_release_functions()

void phar_release_functions ( void )

Definition at line 877 of file func_interceptors.c.

◆ phar_restore_orig_functions()

void phar_restore_orig_functions ( void )

Definition at line 1009 of file func_interceptors.c.

◆ phar_save_orig_functions()

void phar_save_orig_functions ( void )

Definition at line 982 of file func_interceptors.c.

◆ PharFileFunction() [1/2]

PharFileFunction ( phar_fileperms ,
FS_PERMS ,
orig_fileperms  )

Definition at line 672 of file func_interceptors.c.

◆ PharFileFunction() [2/2]

PharFileFunction ( phar_lstat ,
FS_LSTAT ,
orig_lstat  )

Definition at line 858 of file func_interceptors.c.

Variable Documentation

◆ __pad0__

skip_phar __pad0__

Definition at line 84 of file func_interceptors.c.

◆ __pad1__

skip_phar __pad1__

Definition at line 229 of file func_interceptors.c.

◆ __pad2__

skip_phar __pad2__

Definition at line 272 of file func_interceptors.c.

◆ __pad3__

skip_phar __pad3__

Definition at line 320 of file func_interceptors.c.

◆ __pad4__

skip_phar __pad4__

Definition at line 851 of file func_interceptors.c.

◆ contents

zend_string* contents
Initial value:
{
zend_string *filename
struct _zend_string zend_string

Definition at line 161 of file func_interceptors.c.

◆ filename_len

size_t filename_len
Initial value:
{
char *filename

Definition at line 26 of file func_interceptors.c.

◆ maxlen

zend_long maxlen

Definition at line 164 of file func_interceptors.c.

◆ maxlen_is_null

bool maxlen_is_null = 1

Definition at line 165 of file func_interceptors.c.

◆ mode

char* mode
Initial value:
{
zend_string *filename

Definition at line 282 of file func_interceptors.c.

◆ mode_len

size_t mode_len

Definition at line 283 of file func_interceptors.c.

◆ offset

spl_handler_SplPriorityQueue offset = -1

Definition at line 163 of file func_interceptors.c.

◆ return

return

Definition at line 86 of file func_interceptors.c.

◆ use_include_path

bool use_include_path = 0

Definition at line 162 of file func_interceptors.c.

◆ zcontext

zval * zcontext = NULL

Definition at line 27 of file func_interceptors.c.