C# Class PHP.Core.PhpStream

Abstraction of streaming behavior for PHP. PhpStreams are opened by StreamWrappers on a call to fopen().
Inheritance: PHP.Core.PhpResource
Mostra file Open project: jadu/Phalanger Class Usage Examples

Public Methods

Method Description
CanReadWithoutLock ( ) : bool
CanWriteWithoutLock ( ) : bool
CheckAccess ( string filename, CheckAccessMode mode, CheckAccessOptions options ) : bool

Performs all checks on a path passed to a PHP function.

This method performs a check similar to safe_mode.c: php_checkuid_ex() together with open_basedir check.

The filename may be one of the following: A relative path. The path is resolved regarding the include_path too if required and checking continues as in the next case. An absolute path. The file or directory is checked for existence and for access permissions1 according to the given mode. 1 Regarding the open_basedir configuration option. File access permissions are checked at the time of file manipulation (opening, copying etc.).

ResolvePath ( string &path, StreamWrapper &wrapper, CheckAccessMode mode, CheckAccessOptions options ) : bool

Merges the path with the current working directory to get a canonicalized absolute pathname representing the same file.

This method is an analogy of main/safe_mode.c: php_checkuid. Looks for the file in the include_path and checks for open_basedir restrictions.

Stat ( ) : PHP.Core.StatStruct

Private Methods

Method Description
CheckIncludePath ( string relativePath, string &absolutePath ) : bool

Check if the path lays inside of the directory tree specified by the open_basedir configuration option and return the resulting absolutePath.

Method Details

CanReadWithoutLock() public method

public CanReadWithoutLock ( ) : bool
return bool

CanWriteWithoutLock() public method

public CanWriteWithoutLock ( ) : bool
return bool

CheckAccess() public static method

Performs all checks on a path passed to a PHP function.

This method performs a check similar to safe_mode.c: php_checkuid_ex() together with open_basedir check.

The filename may be one of the following: A relative path. The path is resolved regarding the include_path too if required and checking continues as in the next case. An absolute path. The file or directory is checked for existence and for access permissions1 according to the given mode. 1 Regarding the open_basedir configuration option. File access permissions are checked at the time of file manipulation (opening, copying etc.).

If the file can not be accessed /// and the is not set.
public static CheckAccess ( string filename, CheckAccessMode mode, CheckAccessOptions options ) : bool
filename string A resolved path. Must be an absolute path to a local file.
mode CheckAccessMode One of the .
options CheckAccessOptions true to suppress error messages.
return bool

ResolvePath() public static method

Merges the path with the current working directory to get a canonicalized absolute pathname representing the same file.
This method is an analogy of main/safe_mode.c: php_checkuid. Looks for the file in the include_path and checks for open_basedir restrictions.
Security violation - when the target file /// lays outside the tree defined by open_basedir configuration option.
public static ResolvePath ( string &path, StreamWrapper &wrapper, CheckAccessMode mode, CheckAccessOptions options ) : bool
path string An absolute or relative path to a file.
wrapper StreamWrapper The wrapper found for the specified file or null if the path resolution fails.
mode CheckAccessMode The checking mode of the method (file, directory etc.).
options CheckAccessOptions Additional options for the method.
return bool

Stat() public method

public Stat ( ) : PHP.Core.StatStruct
return PHP.Core.StatStruct