Documentation

NativeRequestHandler
in package
implements RequestHandlerInterface

A request handler using PHP super globals $_GET, $_POST and $_SERVER.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

Interfaces

RequestHandlerInterface
Submits forms if they were submitted.

Constants

FILE_KEYS  = ['error', 'name', 'size', 'tmp_name', 'type']
The allowed keys of the $_FILES array.

Properties

$serverParams  : mixed

Methods

__construct()  : mixed
getUploadFileError()  : int|null
handleRequest()  : mixed
Submits a form if it was submitted.
isFileUpload()  : bool
Returns true if the given data is a file upload.
fixPhpFilesArray()  : mixed
Fixes a malformed PHP $_FILES array.
getRequestMethod()  : string
stripEmptyFiles()  : mixed

Constants

FILE_KEYS

The allowed keys of the $_FILES array.

private mixed FILE_KEYS = ['error', 'name', 'size', 'tmp_name', 'type']

Properties

Methods

getUploadFileError()

public getUploadFileError(mixed $data) : int|null
Parameters
$data : mixed
Return values
int|null

isFileUpload()

Returns true if the given data is a file upload.

public isFileUpload(mixed $data) : bool
Parameters
$data : mixed
Return values
bool

fixPhpFilesArray()

Fixes a malformed PHP $_FILES array.

private static fixPhpFilesArray(mixed $data) : mixed

PHP has a bug that the format of the $_FILES array differs, depending on whether the uploaded file fields had normal field names or array-like field names ("normal" vs. "parent[child]").

This method fixes the array to look like the "normal" $_FILES array.

It's safe to pass an already converted array, in which case this method just returns the original array unmodified.

This method is identical to and should be kept as such in order to port fixes quickly and easily.

Parameters
$data : mixed

stripEmptyFiles()

private static stripEmptyFiles(mixed $data) : mixed
Parameters
$data : mixed

        
On this page

Search results