diff --git a/generated/Exceptions/PdfException.php b/generated/Exceptions/DomException.php similarity index 79% rename from generated/Exceptions/PdfException.php rename to generated/Exceptions/DomException.php index bcf36b3c..401173cb 100644 --- a/generated/Exceptions/PdfException.php +++ b/generated/Exceptions/DomException.php @@ -1,7 +1,7 @@ - * - * - * - * The mode parameter consists of three octal + * + * + * + * The permissions parameter consists of three octal * number components specifying access restrictions for the owner, * the user group in which the owner is in, and to everybody else in * this order. One component can be computed by adding up the needed @@ -53,15 +53,15 @@ function chgrp(string $filename, $group): void * up these numbers to specify needed rights. You can also read more * about modes on Unix systems with 'man 1 chmod' * and 'man 2 chmod'. - * - * - * - * + * + * + * + * */ -function chmod(string $filename, int $mode): void +function chmod(string $filename, int $permissions): void { error_clear_last(); - $result = \chmod($filename, $mode); + $result = \chmod($filename, $permissions); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -72,13 +72,13 @@ function chmod(string $filename, int $mode): void * Attempts to change the owner of the file filename * to user user. Only the superuser may change the * owner of a file. - * + * * @param string $filename Path to the file. * @param string|int $user A user name or number. * @throws FilesystemException - * + * */ -function chown(string $filename, $user): void +function chown(string $filename, $user): void { error_clear_last(); $result = \chown($filename, $user); @@ -89,30 +89,26 @@ function chown(string $filename, $user): void /** - * Makes a copy of the file source to - * dest. - * + * Makes a copy of the file from to + * to. + * * If you wish to move a file, use the rename function. - * - * @param string $source Path to the source file. - * @param string $dest The destination path. If dest is a URL, the + * + * @param string $from Path to the source file. + * @param string $to The destination path. If to is a URL, the * copy operation may fail if the wrapper does not support overwriting of * existing files. - * + * * If the destination file already exists, it will be overwritten. - * @param resource $context A valid context resource created with + * @param resource $context A valid context resource created with * stream_context_create. * @throws FilesystemException - * + * */ -function copy(string $source, string $dest, $context = null): void +function copy(string $from, string $to, $context = null): void { error_clear_last(); - if ($context !== null) { - $result = \copy($source, $dest, $context); - } else { - $result = \copy($source, $dest); - } + $result = \copy($from, $to, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -123,15 +119,15 @@ function copy(string $source, string $dest, $context = null): void * Given a string containing a directory, this function will return the * number of bytes available on the corresponding filesystem or disk * partition. - * + * * @param string $directory A directory of the filesystem or disk partition. - * + * * Given a file name instead of a directory, the behaviour of the * function is unspecified and may differ between operating systems and * PHP versions. * @return float Returns the number of available bytes as a float. * @throws FilesystemException - * + * */ function disk_free_space(string $directory): float { @@ -147,11 +143,11 @@ function disk_free_space(string $directory): float /** * Given a string containing a directory, this function will return the total * number of bytes on the corresponding filesystem or disk partition. - * + * * @param string $directory A directory of the filesystem or disk partition. * @return float Returns the total number of bytes as a float. * @throws FilesystemException - * + * */ function disk_total_space(string $directory): float { @@ -165,17 +161,40 @@ function disk_total_space(string $directory): float /** - * The file pointed to by handle is closed. - * - * @param resource $handle The file pointer must be valid, and must point to a file successfully + * The file pointed to by stream is closed. + * + * @param resource $stream The file pointer must be valid, and must point to a file successfully * opened by fopen or fsockopen. * @throws FilesystemException - * + * + */ +function fclose( $stream): void +{ + error_clear_last(); + $result = \fclose($stream); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } +} + + +/** + * This function synchronizes stream contents to storage media, just like fsync does, + * but it does not synchronize file meta-data. + * Note that this function is only effectively different in POSIX systems. + * In Windows, this function is aliased to fsync. + * + * @param resource $stream The file pointer must be valid, and must point to + * a file successfully opened by fopen or + * fsockopen (and not yet closed by + * fclose). + * @throws FilesystemException + * */ -function fclose($handle): void +function fdatasync( $stream): void { error_clear_last(); - $result = \fclose($handle); + $result = \fdatasync($stream); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -184,36 +203,72 @@ function fclose($handle): void /** * This function forces a write of all buffered output to the resource - * pointed to by the file handle. - * - * @param resource $handle The file pointer must be valid, and must point to + * pointed to by the file stream. + * + * @param resource $stream The file pointer must be valid, and must point to * a file successfully opened by fopen or * fsockopen (and not yet closed by * fclose). * @throws FilesystemException - * + * */ -function fflush($handle): void +function fflush( $stream): void { error_clear_last(); - $result = \fflush($handle); + $result = \fflush($stream); if ($result === false) { throw FilesystemException::createFromPhpError(); } } +/** + * Similar to fgets except that + * fgetcsv parses the line it reads for fields in + * CSV format and returns an array containing the fields + * read. + * + * @param resource $stream A valid file pointer to a file successfully opened by + * fopen, popen, or + * fsockopen. + * @param int $length Must be greater than the longest line (in characters) to be found in + * the CSV file (allowing for trailing line-end characters). Otherwise the + * line is split in chunks of length characters, + * unless the split would occur inside an enclosure. + * + * Omitting this parameter (or setting it to 0, + * or NULL in PHP 8.0.0 or later) the maximum line length is not limited, + * which is slightly slower. + * @param string $separator The optional separator parameter sets the field separator (one single-byte character only). + * @param string $enclosure The optional enclosure parameter sets the field enclosure character (one single-byte character only). + * @param string $escape The optional escape parameter sets the escape character (at most one single-byte character). + * An empty string ("") disables the proprietary escape mechanism. + * @return array|false|null Returns an indexed array containing the fields read on success. + * @throws FilesystemException + * + */ +function fgetcsv( $stream, int $length = null, string $separator = ",", string $enclosure = "\"", string $escape = "\\") +{ + error_clear_last(); + $result = \fgetcsv($stream, $length, $separator, $enclosure, $escape); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } + return $result; +} + + /** * This function is similar to file, except that - * file_get_contents returns the file in a - * string, starting at the specified offset - * up to maxlen bytes. On failure, + * file_get_contents returns the file in a + * string, starting at the specified offset + * up to length bytes. On failure, * file_get_contents will return FALSE. - * + * * file_get_contents is the preferred way to read the * contents of a file into a string. It will use memory mapping techniques if * supported by your OS to enhance performance. - * + * * @param string $filename Name of the file to read. * @param bool $use_include_path The FILE_USE_INCLUDE_PATH constant can be used * to trigger include path @@ -221,34 +276,26 @@ function fflush($handle): void * This is not possible if strict typing * is enabled, since FILE_USE_INCLUDE_PATH is an * int. Use TRUE instead. - * @param resource|null $context A valid context resource created with + * @param resource|null $context A valid context resource created with * stream_context_create. If you don't need to use a * custom context, you can skip this parameter by NULL. * @param int $offset The offset where the reading starts on the original stream. * Negative offsets count from the end of the stream. - * + * * Seeking (offset) is not supported with remote files. * Attempting to seek on non-local files may work with small offsets, but this * is unpredictable because it works on the buffered stream. - * @param int $maxlen Maximum length of data read. The default is to read until end - * of file is reached. Note that this parameter is applied to the + * @param $length Maximum length of data read. The default is to read until end + * of file is reached. Note that this parameter is applied to the * stream processed by the filters. * @return string The function returns the read data. * @throws FilesystemException - * + * */ -function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, int $maxlen = null): string +function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, $length = null): string { error_clear_last(); - if ($maxlen !== null) { - $result = @\file_get_contents($filename, $use_include_path, $context, $offset, $maxlen); - } elseif ($offset !== 0) { - $result = @\file_get_contents($filename, $use_include_path, $context, $offset); - } elseif ($context !== null) { - $result = @\file_get_contents($filename, $use_include_path, $context); - } else { - $result = @\file_get_contents($filename, $use_include_path); - } + $result = \file_get_contents($filename, $use_include_path, $context, $offset, $length); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -257,87 +304,83 @@ function file_get_contents(string $filename, bool $use_include_path = false, $co /** - * This function is identical to calling fopen, + * This function is identical to calling fopen, * fwrite and fclose successively * to write data to a file. - * + * * If filename does not exist, the file is created. - * Otherwise, the existing file is overwritten, unless the + * Otherwise, the existing file is overwritten, unless the * FILE_APPEND flag is set. - * + * * @param string $filename Path to the file where to write the data. * @param mixed $data The data to write. Can be either a string, an * array or a stream resource. - * + * * If data is a stream resource, the * remaining buffer of that stream will be copied to the specified file. * This is similar with using stream_copy_to_stream. - * + * * You can also specify the data parameter as a single * dimension array. This is equivalent to * file_put_contents($filename, implode('', $array)). - * @param int $flags The value of flags can be any combination of + * @param int $flags The value of flags can be any combination of * the following flags, joined with the binary OR (|) * operator. - * - * + * + * * Available flags - * - * - * + * + * + * * Flag * Description - * - * - * - * - * + * + * + * + * + * * FILE_USE_INCLUDE_PATH - * - * + * + * * Search for filename in the include directory. * See include_path for more * information. - * - * - * - * + * + * + * + * * FILE_APPEND - * - * - * If file filename already exists, append + * + * + * If file filename already exists, append * the data to the file instead of overwriting it. - * - * - * - * + * + * + * + * * LOCK_EX - * - * - * Acquire an exclusive lock on the file while proceeding to the + * + * + * Acquire an exclusive lock on the file while proceeding to the * writing. In other words, a flock call happens - * between the fopen call and the - * fwrite call. This is not identical to an + * between the fopen call and the + * fwrite call. This is not identical to an * fopen call with mode "x". - * - * - * - * - * - * @param resource $context A valid context resource created with + * + * + * + * + * + * @param resource $context A valid context resource created with * stream_context_create. * @return int This function returns the number of bytes that were written to the file. * @throws FilesystemException - * + * */ -function file_put_contents(string $filename, $data, int $flags = 0, $context = null): int +function file_put_contents(string $filename, $data, int $flags = 0, $context = null): int { error_clear_last(); - if ($context !== null) { - $result = \file_put_contents($filename, $data, $flags, $context); - } else { - $result = \file_put_contents($filename, $data, $flags); - } + $result = \file_put_contents($filename, $data, $flags, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -347,57 +390,53 @@ function file_put_contents(string $filename, $data, int $flags = 0, $context = n /** * Reads an entire file into an array. - * + * * @param string $filename Path to the file. * @param int $flags The optional parameter flags can be one, or * more, of the following constants: - * - * - * + * + * + * * FILE_USE_INCLUDE_PATH - * - * - * + * + * + * * Search for the file in the include_path. - * - * - * - * - * + * + * + * + * + * * FILE_IGNORE_NEW_LINES - * - * - * + * + * + * * Omit newline at the end of each array element - * - * - * - * - * + * + * + * + * + * * FILE_SKIP_EMPTY_LINES - * - * - * + * + * + * * Skip empty lines - * - * - * - * - * @param resource $context + * + * + * + * + * @param resource $context * @return array Returns the file in an array. Each element of the array corresponds to a * line in the file, with the newline still attached. Upon failure, * file returns FALSE. * @throws FilesystemException - * + * */ -function file(string $filename, int $flags = 0, $context = null): array +function file(string $filename, int $flags = 0, $context = null): array { error_clear_last(); - if ($context !== null) { - $result = \file($filename, $flags, $context); - } else { - $result = \file($filename, $flags); - } + $result = \file($filename, $flags, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -406,13 +445,13 @@ function file(string $filename, int $flags = 0, $context = null): array /** - * - * + * + * * @param string $filename Path to the file. * @return int Returns the time the file was last accessed. * The time is returned as a Unix timestamp. * @throws FilesystemException - * + * */ function fileatime(string $filename): int { @@ -427,12 +466,12 @@ function fileatime(string $filename): int /** * Gets the inode change time of a file. - * + * * @param string $filename Path to the file. * @return int Returns the time the file was last changed. * The time is returned as a Unix timestamp. * @throws FilesystemException - * + * */ function filectime(string $filename): int { @@ -447,11 +486,11 @@ function filectime(string $filename): int /** * Gets the file inode. - * + * * @param string $filename Path to the file. * @return int Returns the inode number of the file. * @throws FilesystemException - * + * */ function fileinode(string $filename): int { @@ -467,13 +506,13 @@ function fileinode(string $filename): int /** * This function returns the time when the data blocks of a file were being * written to, that is, the time when the content of the file was changed. - * + * * @param string $filename Path to the file. * @return int Returns the time the file was last modified. * The time is returned as a Unix timestamp, which is * suitable for the date function. * @throws FilesystemException - * + * */ function filemtime(string $filename): int { @@ -488,13 +527,13 @@ function filemtime(string $filename): int /** * Gets the file owner. - * + * * @param string $filename Path to the file. * @return int Returns the user ID of the owner of the file. * The user ID is returned in numerical format, use * posix_getpwuid to resolve it to a username. * @throws FilesystemException - * + * */ function fileowner(string $filename): int { @@ -507,14 +546,47 @@ function fileowner(string $filename): int } +/** + * Gets permissions for the given file. + * + * @param string $filename Path to the file. + * @return int Returns the file's permissions as a numeric mode. Lower bits of this mode + * are the same as the permissions expected by chmod, + * however on most platforms the return value will also include information on + * the type of file given as filename. The examples + * below demonstrate how to test the return value for specific permissions and + * file types on POSIX systems, including Linux and macOS. + * + * For local files, the specific return value is that of the + * st_mode member of the structure returned by the C + * library's stat function. Exactly which bits are set + * can vary from platform to platform, and looking up your specific platform's + * documentation is recommended if parsing the non-permission bits of the + * return value is required. + * + * Returns FALSE on failure. + * @throws FilesystemException + * + */ +function fileperms(string $filename): int +{ + error_clear_last(); + $result = \fileperms($filename); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } + return $result; +} + + /** * Gets the size for the given file. - * + * * @param string $filename Path to the file. * @return int Returns the size of the file in bytes, or FALSE (and generates an error * of level E_WARNING) in case of an error. * @throws FilesystemException - * + * */ function filesize(string $filename): int { @@ -531,49 +603,48 @@ function filesize(string $filename): int * flock allows you to perform a simple reader/writer * model which can be used on virtually every platform (including most Unix * derivatives and even Windows). - * - * On versions of PHP before 5.3.2, the lock is released also by - * fclose (which is also called automatically when script - * finished). - * + * + * The lock is released also by fclose, + * or when stream is garbage collected. + * * PHP supports a portable way of locking complete files in an advisory way * (which means all accessing programs have to use the same way of locking * or it will not work). By default, this function will block until the * requested lock is acquired; this may be controlled with the LOCK_NB option documented below. - * - * @param resource $handle A file system pointer resource + * + * @param resource $stream A file system pointer resource * that is typically created using fopen. * @param int $operation operation is one of the following: - * - * - * + * + * + * * LOCK_SH to acquire a shared lock (reader). - * - * - * - * + * + * + * + * * LOCK_EX to acquire an exclusive lock (writer). - * - * - * - * + * + * + * + * * LOCK_UN to release a lock (shared or exclusive). - * - * - * - * - * It is also possible to add LOCK_NB as a bitmask to one + * + * + * + * + * It is also possible to add LOCK_NB as a bitmask to one * of the above operations, if flock should not * block during the locking attempt. - * @param int|null $wouldblock The optional third argument is set to 1 if the lock would block + * @param int $would_block The optional third argument is set to 1 if the lock would block * (EWOULDBLOCK errno condition). * @throws FilesystemException - * + * */ -function flock($handle, int $operation, ?int &$wouldblock = null): void +function flock( $stream, int $operation, int &$would_block = null): void { error_clear_last(); - $result = \flock($handle, $operation, $wouldblock); + $result = \flock($stream, $operation, $would_block); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -583,14 +654,14 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void /** * fopen binds a named resource, specified by * filename, to a stream. - * + * * @param string $filename If filename is of the form "scheme://...", it * is assumed to be a URL and PHP will search for a protocol handler * (also known as a wrapper) for that scheme. If no wrappers for that * protocol are registered, PHP will emit a notice to help you track * potential problems in your script and then continue as though * filename specifies a regular file. - * + * * If PHP has decided that filename specifies * a local file, then it will try to open a stream on that file. * The file must be accessible to PHP, so you need to ensure that @@ -598,113 +669,112 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void * If you have enabled * open_basedir further * restrictions may apply. - * + * * If PHP has decided that filename specifies * a registered protocol, and that protocol is registered as a * network URL, PHP will check to make sure that * allow_url_fopen is * enabled. If it is switched off, PHP will emit a warning and * the fopen call will fail. - * + * * The list of supported protocols can be found in . Some protocols (also referred to as * wrappers) support context * and/or php.ini options. Refer to the specific page for the * protocol in use for a list of options which can be set. (e.g. * php.ini value user_agent used by the * http wrapper). - * + * * On the Windows platform, be careful to escape any backslashes * used in the path to the file, or use forward slashes. - * - * - * + * + * + * * ]]> - * - * + * + * * @param string $mode The mode parameter specifies the type of access * you require to the stream. It may be any of the following: - * - * + * + * * A list of possible modes for fopen * using mode - * - * - * - * + * + * + * + * * mode * Description - * - * - * - * + * + * + * + * * 'r' - * + * * Open for reading only; place the file pointer at the * beginning of the file. - * - * - * + * + * + * * 'r+' - * + * * Open for reading and writing; place the file pointer at * the beginning of the file. - * - * - * + * + * + * * 'w' - * + * * Open for writing only; place the file pointer at the * beginning of the file and truncate the file to zero length. * If the file does not exist, attempt to create it. - * - * - * + * + * + * * 'w+' - * - * Open for reading and writing; place the file pointer at - * the beginning of the file and truncate the file to zero - * length. If the file does not exist, attempt to create it. - * - * - * + * + * Open for reading and writing; otherwise it has the + * same behavior as 'w'. + * + * + * * 'a' - * + * * Open for writing only; place the file pointer at the end of * the file. If the file does not exist, attempt to create it. * In this mode, fseek has no effect, writes are always appended. - * - * - * + * + * + * * 'a+' - * + * * Open for reading and writing; place the file pointer at * the end of the file. If the file does not exist, attempt to * create it. In this mode, fseek only affects * the reading position, writes are always appended. - * - * - * + * + * + * * 'x' - * + * * Create and open for writing only; place the file pointer at the * beginning of the file. If the file already exists, the * fopen call will fail by returning FALSE and * generating an error of level E_WARNING. If * the file does not exist, attempt to create it. This is equivalent * to specifying O_EXCL|O_CREAT flags for the - * underlying open(2) system call. - * - * - * + * underlying open(2) system call. + * + * + * * 'x+' - * + * * Create and open for reading and writing; otherwise it has the * same behavior as 'x'. - * - * - * + * + * + * * 'c' - * + * * Open the file for writing only. If the file does not exist, it is * created. If it exists, it is neither truncated (as opposed to * 'w'), nor the call to this function fails (as is @@ -716,26 +786,26 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void * was obtained (if truncation is desired, * ftruncate can be used after the lock is * requested). - * - * - * + * + * + * * 'c+' - * + * * Open the file for reading and writing; otherwise it has the same * behavior as 'c'. - * - * - * + * + * + * * 'e' - * + * * Set close-on-exec flag on the opened file descriptor. Only * available in PHP compiled on POSIX.1-2008 conform systems. - * - * - * - * - * - * + * + * + * + * + * + * * Different operating system families have different line-ending * conventions. When you write a text file and want to insert a line * break, you need to use the correct line-ending character(s) for your @@ -743,11 +813,11 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void * line ending character, Windows based systems use \r\n * as the line ending characters and Macintosh based systems (Mac OS Classic) used * \r as the line ending character. - * + * * If you use the wrong line ending characters when writing your files, you * might find that other applications that open those files will "look * funny". - * + * * Windows offers a text-mode translation flag ('t') * which will transparently translate \n to * \r\n when working with the file. In contrast, you @@ -755,18 +825,18 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void * translate your data. To use these flags, specify either * 'b' or 't' as the last character * of the mode parameter. - * + * * The default translation mode is 'b'. * You can use the 't' * mode if you are working with plain-text files and you use * \n to delimit your line endings in your script, but * expect your files to be readable with applications such as old versions of notepad. You * should use the 'b' in all other cases. - * + * * If you specify the 't' flag when working with binary files, you * may experience strange problems with your data, including broken image * files and strange problems with \r\n characters. - * + * * For portability, it is also strongly recommended that * you re-write code that uses or relies upon the 't' * mode so that it uses the correct line endings and @@ -774,19 +844,16 @@ function flock($handle, int $operation, ?int &$wouldblock = null): void * @param bool $use_include_path The optional third use_include_path parameter * can be set to '1' or TRUE if you want to search for the file in the * include_path, too. - * @param resource $context + * @param resource $context A context stream + * resource. * @return resource Returns a file pointer resource on success * @throws FilesystemException - * + * */ -function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) +function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) { error_clear_last(); - if ($context !== null) { - $result = \fopen($filename, $mode, $use_include_path, $context); - } else { - $result = \fopen($filename, $mode, $use_include_path); - } + $result = \fopen($filename, $mode, $use_include_path, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -797,28 +864,30 @@ function fopen(string $filename, string $mode, bool $use_include_path = false, $ /** * fputcsv formats a line (passed as a * fields array) as CSV and writes it (terminated by a - * newline) to the specified file handle. - * - * @param resource $handle The file pointer must be valid, and must point to + * newline) to the specified file stream. + * + * @param resource $stream The file pointer must be valid, and must point to * a file successfully opened by fopen or * fsockopen (and not yet closed by * fclose). * @param array $fields An array of strings. - * @param string $delimiter The optional delimiter parameter sets the field - * delimiter (one character only). + * @param string $separator The optional separator parameter sets the field + * delimiter (one single-byte character only). * @param string $enclosure The optional enclosure parameter sets the field - * enclosure (one character only). - * @param string $escape_char The optional escape_char parameter sets the - * escape character (at most one character). + * enclosure (one single-byte character only). + * @param string $escape The optional escape parameter sets the + * escape character (at most one single-byte character). * An empty string ("") disables the proprietary escape mechanism. + * @param string $eol The optional eol parameter sets + * a custom End of Line sequence. * @return int Returns the length of the written string. * @throws FilesystemException - * + * */ -function fputcsv($handle, array $fields, string $delimiter = ",", string $enclosure = '"', string $escape_char = "\\"): int +function fputcsv( $stream, array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\\", string $eol = "\n"): int { error_clear_last(); - $result = \fputcsv($handle, $fields, $delimiter, $enclosure, $escape_char); + $result = \fputcsv($stream, $fields, $separator, $enclosure, $escape, $eol); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -829,46 +898,71 @@ function fputcsv($handle, array $fields, string $delimiter = ",", string $enclos /** * fread reads up to * length bytes from the file pointer - * referenced by handle. Reading stops as soon as one + * referenced by stream. Reading stops as soon as one * of the following conditions is met: - * - * - * + * + * + * * length bytes have been read - * - * - * - * + * + * + * + * * EOF (end of file) is reached - * - * - * - * - * a packet becomes available or the + * + * + * + * + * a packet becomes available or the * socket timeout occurs (for network streams) - * - * - * - * + * + * + * + * * if the stream is read buffered and it does not represent a plain file, at * most one read of up to a number of bytes equal to the chunk size (usually * 8192) is made; depending on the previously buffered data, the size of the * returned data may be larger than the chunk size. - * - * - * - * - * @param resource $handle A file system pointer resource + * + * + * + * + * @param resource $stream A file system pointer resource * that is typically created using fopen. * @param int $length Up to length number of bytes read. * @return string Returns the read string. * @throws FilesystemException - * + * + */ +function fread( $stream, int $length): string +{ + error_clear_last(); + $result = \fread($stream, $length); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } + return $result; +} + + +/** + * Gathers the statistics of the file opened by the file + * pointer stream. This function is similar to the + * stat function except that it operates + * on an open file pointer instead of a filename. + * + * @param resource $stream A file system pointer resource + * that is typically created using fopen. + * @return array Returns an array with the statistics of the file; the format of the array + * is described in detail on the stat manual page. + * Returns FALSE on failure. + * @throws FilesystemException + * */ -function fread($handle, int $length): string +function fstat( $stream): array { error_clear_last(); - $result = \fread($handle, $length); + $result = \fstat($stream); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -877,26 +971,47 @@ function fread($handle, int $length): string /** - * Takes the filepointer, handle, and truncates the file to + * This function synchronizes changes to the file, including its meta-data. This is similar to fflush, + * but it also instructs the operating system to write to the storage media. + * + * @param resource $stream The file pointer must be valid, and must point to + * a file successfully opened by fopen or + * fsockopen (and not yet closed by + * fclose). + * @throws FilesystemException + * + */ +function fsync( $stream): void +{ + error_clear_last(); + $result = \fsync($stream); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } +} + + +/** + * Takes the filepointer, stream, and truncates the file to * length, size. - * - * @param resource $handle The file pointer. - * - * The handle must be open for writing. + * + * @param resource $stream The file pointer. + * + * The stream must be open for writing. * @param int $size The size to truncate to. - * + * * If size is larger than the file then the file * is extended with null bytes. - * + * * If size is smaller than the file then the file * is truncated to that size. * @throws FilesystemException - * + * */ -function ftruncate($handle, int $size): void +function ftruncate( $stream, int $size): void { error_clear_last(); - $result = \ftruncate($handle, $size); + $result = \ftruncate($stream, $size); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -904,32 +1019,22 @@ function ftruncate($handle, int $size): void /** - * - * - * @param resource $handle A file system pointer resource + * + * + * @param resource $stream A file system pointer resource * that is typically created using fopen. - * @param string $string The string that is to be written. - * @param int $length If the length argument is given, writing will - * stop after length bytes have been written or - * the end of string is reached, whichever comes - * first. - * - * Note that if the length argument is given, - * then the magic_quotes_runtime - * configuration option will be ignored and no slashes will be - * stripped from string. - * @return int + * @param string $data The string that is to be written. + * @param int $length If length is an integer, writing will stop + * after length bytes have been written or the + * end of data is reached, whichever comes first. + * @return int * @throws FilesystemException - * + * */ -function fwrite($handle, string $string, int $length = null): int +function fwrite( $stream, string $data, int $length = null): int { error_clear_last(); - if ($length !== null) { - $result = \fwrite($handle, $string, $length); - } else { - $result = \fwrite($handle, $string); - } + $result = \fwrite($stream, $data, $length); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -942,84 +1047,90 @@ function fwrite($handle, string $string, int $length = null): int * matching pattern according to the rules used by * the libc glob() function, which is similar to the rules used by common * shells. - * + * * @param string $pattern The pattern. No tilde expansion or parameter substitution is done. - * + * * Special characters: - * - * - * + * + * + * * * - Matches zero or more characters. - * - * - * - * + * + * + * + * * ? - Matches exactly one character (any character). - * - * - * - * + * + * + * + * * [...] - Matches one character from a group of * characters. If the first character is !, * matches any character not in the group. - * - * - * - * + * + * + * + * * \ - Escapes the following character, * except when the GLOB_NOESCAPE flag is used. - * - * - * + * + * + * * @param int $flags Valid flags: - * - * - * + * + * + * * GLOB_MARK - Adds a slash (a backslash on Windows) to each directory returned - * - * - * - * + * + * + * + * * GLOB_NOSORT - Return files as they appear in the * directory (no sorting). When this flag is not used, the pathnames are * sorted alphabetically - * - * - * - * + * + * + * + * * GLOB_NOCHECK - Return the search pattern if no * files matching it were found - * - * - * - * + * + * + * + * * GLOB_NOESCAPE - Backslashes do not quote * metacharacters - * - * - * - * + * + * + * + * * GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', * or 'c' - * - * - * - * + * + * + * + * * GLOB_ONLYDIR - Return only directory entries * which match the pattern - * - * - * - * + * + * + * + * * GLOB_ERR - Stop on read errors (like unreadable * directories), by default errors are ignored. - * - * - * + * + * + * + * + * + * The GLOB_BRACE flag is not available on some non GNU + * systems, like Solaris or Alpine Linux. + * + * * @return array Returns an array containing the matched files/directories, an empty array * if no file matched. * @throws FilesystemException - * + * */ function glob(string $pattern, int $flags = 0): array { @@ -1035,17 +1146,17 @@ function glob(string $pattern, int $flags = 0): array /** * Attempts to change the group of the symlink filename * to group. - * + * * Only the superuser may change the group of a symlink arbitrarily; other * users may change the group of a symlink to any group of which that user is * a member. - * + * * @param string $filename Path to the symlink. * @param string|int $group The group specified by name or number. * @throws FilesystemException - * + * */ -function lchgrp(string $filename, $group): void +function lchgrp(string $filename, $group): void { error_clear_last(); $result = \lchgrp($filename, $group); @@ -1058,15 +1169,15 @@ function lchgrp(string $filename, $group): void /** * Attempts to change the owner of the symlink filename * to user user. - * + * * Only the superuser may change the owner of a symlink. - * + * * @param string $filename Path to the file. * @param string|int $user User name or number. * @throws FilesystemException - * + * */ -function lchown(string $filename, $user): void +function lchown(string $filename, $user): void { error_clear_last(); $result = \lchown($filename, $user); @@ -1078,11 +1189,11 @@ function lchown(string $filename, $user): void /** * link creates a hard link. - * + * * @param string $target Target of the link. * @param string $link The link name. * @throws FilesystemException - * + * */ function link(string $target, string $link): void { @@ -1095,33 +1206,57 @@ function link(string $target, string $link): void /** - * Attempts to create the directory specified by pathname. - * - * @param string $pathname The directory path. - * @param int $mode The mode is 0777 by default, which means the widest possible - * access. For more information on modes, read the details + * Gathers the statistics of the file or symbolic link named by + * filename. + * + * @param string $filename Path to a file or a symbolic link. + * @return array See the manual page for stat for information on + * the structure of the array that lstat returns. + * This function is identical to the stat function + * except that if the filename parameter is a symbolic + * link, the status of the symbolic link is returned, not the status of the + * file pointed to by the symbolic link. + * + * On failure, FALSE is returned. + * @throws FilesystemException + * + */ +function lstat(string $filename): array +{ + error_clear_last(); + $result = \lstat($filename); + if ($result === false) { + throw FilesystemException::createFromPhpError(); + } + return $result; +} + + +/** + * Attempts to create the directory specified by directory. + * + * @param string $directory The directory path. + * @param int $permissions The permissions are 0777 by default, which means the widest possible + * access. For more information on permissions, read the details * on the chmod page. - * - * mode is ignored on Windows. - * - * Note that you probably want to specify the mode as an octal number, - * which means it should have a leading zero. The mode is also modified + * + * permissions is ignored on Windows. + * + * Note that you probably want to specify the permissions as an octal number, + * which means it should have a leading zero. The permissions is also modified * by the current umask, which you can change using * umask. - * @param bool $recursive Allows the creation of nested directories specified in the - * pathname. - * @param resource $context + * @param bool $recursive Allows the creation of nested directories specified in the + * directory. + * @param resource $context A context stream + * resource. * @throws FilesystemException - * + * */ -function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): void +function mkdir(string $directory, int $permissions = 0777, bool $recursive = false, $context = null): void { error_clear_last(); - if ($context !== null) { - $result = \mkdir($pathname, $mode, $recursive, $context); - } else { - $result = \mkdir($pathname, $mode, $recursive); - } + $result = \mkdir($directory, $permissions, $recursive, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1132,9 +1267,9 @@ function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $con * parse_ini_file loads in the * ini file specified in filename, * and returns the settings in it in an associative array. - * + * * The structure of the ini file is the same as the php.ini's. - * + * * @param string $filename The filename of the ini file being parsed. If a relative path is used, * it is evaluated relative to the current working directory, then the * include_path. @@ -1142,11 +1277,11 @@ function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $con * parameter to TRUE, you get a multidimensional array, with * the section names and settings included. The default * for process_sections is FALSE - * @param int $scanner_mode Can either be INI_SCANNER_NORMAL (default) or - * INI_SCANNER_RAW. If INI_SCANNER_RAW + * @param int $scanner_mode Can either be INI_SCANNER_NORMAL (default) or + * INI_SCANNER_RAW. If INI_SCANNER_RAW * is supplied, then option values will not be parsed. - * - * + * + * * As of PHP 5.6.1 can also be specified as INI_SCANNER_TYPED. * In this mode boolean, null and integer types are preserved when possible. * String values "true", "on" and "yes" @@ -1155,7 +1290,7 @@ function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $con * in typed mode. Also, all numeric strings are converted to integer type if it is possible. * @return array The settings are returned as an associative array on success. * @throws FilesystemException - * + * */ function parse_ini_file(string $filename, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array { @@ -1170,20 +1305,20 @@ function parse_ini_file(string $filename, bool $process_sections = false, int $s /** * parse_ini_string returns the settings in string - * ini in an associative array. - * + * ini_string in an associative array. + * * The structure of the ini string is the same as the php.ini's. - * - * @param string $ini The contents of the ini file being parsed. + * + * @param string $ini_string The contents of the ini file being parsed. * @param bool $process_sections By setting the process_sections * parameter to TRUE, you get a multidimensional array, with * the section names and settings included. The default * for process_sections is FALSE - * @param int $scanner_mode Can either be INI_SCANNER_NORMAL (default) or - * INI_SCANNER_RAW. If INI_SCANNER_RAW + * @param int $scanner_mode Can either be INI_SCANNER_NORMAL (default) or + * INI_SCANNER_RAW. If INI_SCANNER_RAW * is supplied, then option values will not be parsed. - * - * + * + * * As of PHP 5.6.1 can also be specified as INI_SCANNER_TYPED. * In this mode boolean, null and integer types are preserved when possible. * String values "true", "on" and "yes" @@ -1192,12 +1327,12 @@ function parse_ini_file(string $filename, bool $process_sections = false, int $s * in typed mode. Also, all numeric strings are converted to integer type if it is possible. * @return array The settings are returned as an associative array on success. * @throws FilesystemException - * + * */ -function parse_ini_string(string $ini, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array +function parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array { error_clear_last(); - $result = \parse_ini_string($ini, $process_sections, $scanner_mode); + $result = \parse_ini_string($ini_string, $process_sections, $scanner_mode); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1207,23 +1342,20 @@ function parse_ini_string(string $ini, bool $process_sections = false, int $scan /** * Reads a file and writes it to the output buffer. - * + * * @param string $filename The filename being read. * @param bool $use_include_path You can use the optional second parameter and set it to TRUE, if * you want to search for the file in the include_path, too. - * @param resource $context A context stream resource. + * @param resource $context A context stream + * resource. * @return int Returns the number of bytes read from the file on success * @throws FilesystemException - * + * */ -function readfile(string $filename, bool $use_include_path = false, $context = null): int +function readfile(string $filename, bool $use_include_path = false, $context = null): int { error_clear_last(); - if ($context !== null) { - $result = \readfile($filename, $use_include_path, $context); - } else { - $result = \readfile($filename, $use_include_path); - } + $result = \readfile($filename, $use_include_path, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1233,11 +1365,11 @@ function readfile(string $filename, bool $use_include_path = false, $context = n /** * readlink does the same as the readlink C function. - * + * * @param string $path The symbolic link path. * @return string Returns the contents of the symbolic link path. * @throws FilesystemException - * + * */ function readlink(string $path): string { @@ -1255,25 +1387,25 @@ function readlink(string $path): string * resolves references to /./, /../ and extra / characters in * the input path and returns the canonicalized * absolute pathname. - * + * * @param string $path The path being checked. - * - * + * + * * Whilst a path must be supplied, the value can be an empty string. * In this case, the value is interpreted as the current directory. - * - * - * + * + * + * * Whilst a path must be supplied, the value can be an empty string. * In this case, the value is interpreted as the current directory. - * @return string Returns the canonicalized absolute pathname on success. The resulting path + * @return string Returns the canonicalized absolute pathname on success. The resulting path * will have no symbolic link, /./ or /../ components. Trailing delimiters, * such as \ and /, are also removed. - * + * * realpath returns FALSE on failure, e.g. if * the file does not exist. * @throws FilesystemException - * + * */ function realpath(string $path): string { @@ -1287,31 +1419,34 @@ function realpath(string $path): string /** - * Attempts to rename oldname to - * newname, moving it between directories if necessary. - * If renaming a file and newname exists, + * Attempts to rename from to + * to, moving it between directories if necessary. + * If renaming a file and to exists, * it will be overwritten. If renaming a directory and - * newname exists, + * to exists, * this function will emit a warning. - * - * @param string $oldname The old name. - * - * The wrapper used in oldname + * + * @param string $from The old name. + * + * The wrapper used in from * must match the wrapper used in - * newname. - * @param string $newname The new name. - * @param resource $context + * to. + * @param string $to The new name. + * + * + * On Windows, if to already exists, it must be writable. + * Otherwise rename fails and issues E_WARNING. + * + * + * @param resource $context A context stream + * resource. * @throws FilesystemException - * + * */ -function rename(string $oldname, string $newname, $context = null): void +function rename(string $from, string $to, $context = null): void { error_clear_last(); - if ($context !== null) { - $result = \rename($oldname, $newname, $context); - } else { - $result = \rename($oldname, $newname); - } + $result = \rename($from, $to, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1319,18 +1454,18 @@ function rename(string $oldname, string $newname, $context = null): void /** - * Sets the file position indicator for handle + * Sets the file position indicator for stream * to the beginning of the file stream. - * - * @param resource $handle The file pointer must be valid, and must point to a file + * + * @param resource $stream The file pointer must be valid, and must point to a file * successfully opened by fopen. * @throws FilesystemException - * + * */ -function rewind($handle): void +function rewind( $stream): void { error_clear_last(); - $result = \rewind($handle); + $result = \rewind($stream); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1338,23 +1473,20 @@ function rewind($handle): void /** - * Attempts to remove the directory named by dirname. + * Attempts to remove the directory named by directory. * The directory must be empty, and the relevant permissions must permit this. * A E_WARNING level error will be generated on failure. - * - * @param string $dirname Path to the directory. - * @param resource $context + * + * @param string $directory Path to the directory. + * @param resource $context A context stream + * resource. * @throws FilesystemException - * + * */ -function rmdir(string $dirname, $context = null): void +function rmdir(string $directory, $context = null): void { error_clear_last(); - if ($context !== null) { - $result = \rmdir($dirname, $context); - } else { - $result = \rmdir($dirname); - } + $result = \rmdir($directory, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1365,11 +1497,11 @@ function rmdir(string $dirname, $context = null): void * symlink creates a symbolic link to the existing * target with the specified name * link. - * + * * @param string $target Target of the link. * @param string $link The link name. * @throws FilesystemException - * + * */ function symlink(string $target, string $link): void { @@ -1386,17 +1518,17 @@ function symlink(string $target, string $link): void * If the directory does not exist or is not writable, tempnam may * generate a file in the system's temporary directory, and return * the full path to that file, including its name. - * - * @param string $dir The directory where the temporary filename will be created. + * + * @param string $directory The directory where the temporary filename will be created. * @param string $prefix The prefix of the generated temporary filename. * @return string Returns the new temporary filename (with path). * @throws FilesystemException - * + * */ -function tempnam(string $dir, string $prefix): string +function tempnam(string $directory, string $prefix): string { error_clear_last(); - $result = \tempnam($dir, $prefix); + $result = \tempnam($directory, $prefix); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1407,16 +1539,16 @@ function tempnam(string $dir, string $prefix): string /** * Creates a temporary file with a unique name in read-write (w+) mode and * returns a file handle. - * + * * The file is automatically removed when closed (for example, by calling * fclose, or when there are no remaining references to * the file handle returned by tmpfile), or when the * script ends. - * + * * @return resource Returns a file handle, similar to the one returned by * fopen, for the new file. * @throws FilesystemException - * + * */ function tmpfile() { @@ -1432,32 +1564,26 @@ function tmpfile() /** * Attempts to set the access and modification times of the file named in the * filename parameter to the value given in - * time. + * mtime. * Note that the access time is always modified, regardless of the number * of parameters. - * + * * If the file does not exist, it will be created. - * + * * @param string $filename The name of the file being touched. - * @param int $time The touch time. If time is not supplied, + * @param $mtime The touch time. If mtime is NULL, * the current system time is used. - * @param int $atime If present, the access time of the given filename is set to + * @param int $atime If not NULL, the access time of the given filename is set to * the value of atime. Otherwise, it is set to - * the value passed to the time parameter. - * If neither are present, the current system time is used. + * the value passed to the mtime parameter. + * If both are NULL, the current system time is used. * @throws FilesystemException - * + * */ -function touch(string $filename, int $time = null, int $atime = null): void +function touch(string $filename, $mtime = null, int $atime = null): void { error_clear_last(); - if ($atime !== null) { - $result = \touch($filename, $time, $atime); - } elseif ($time !== null) { - $result = \touch($filename, $time); - } else { - $result = \touch($filename); - } + $result = \touch($filename, $mtime, $atime); if ($result === false) { throw FilesystemException::createFromPhpError(); } @@ -1468,21 +1594,23 @@ function touch(string $filename, int $time = null, int $atime = null): void * Deletes filename. Similar to the Unix C unlink() * function. An E_WARNING level error will be generated on * failure. - * + * * @param string $filename Path to the file. - * @param resource $context + * + * If the file is a symlink, the symlink will be deleted. On Windows, to delete + * a symlink to a directory, rmdir has to be used instead. + * @param resource $context A context stream + * resource. * @throws FilesystemException - * + * */ -function unlink(string $filename, $context = null): void +function unlink(string $filename, $context = null): void { error_clear_last(); - if ($context !== null) { - $result = \unlink($filename, $context); - } else { - $result = \unlink($filename); - } + $result = \unlink($filename, $context); if ($result === false) { throw FilesystemException::createFromPhpError(); } } + + diff --git a/generated/filter.php b/generated/filter.php index 2d836c6c..232162da 100644 --- a/generated/filter.php +++ b/generated/filter.php @@ -7,11 +7,11 @@ /** * This function is useful for retrieving many values without * repetitively calling filter_input. - * + * * @param int $type One of INPUT_GET, INPUT_POST, * INPUT_COOKIE, INPUT_SERVER, or * INPUT_ENV. - * @param int|array $definition An array defining the arguments. A valid key is a string + * @param $options An array defining the arguments. A valid key is a string * containing a variable name and a valid value is either a filter type, or an array * optionally specifying the filter, flags and options. If the value is an * array, valid keys are filter which specifies the @@ -19,7 +19,7 @@ * flags which specifies any flags that apply to the * filter, and options which specifies any options that * apply to the filter. See the example below for a better understanding. - * + * * This parameter can be also an integer holding a filter constant. Then all values in the * input array are filtered by this filter. * @param bool $add_empty Add missing keys as NULL to the return value. @@ -27,25 +27,19 @@ * If the input array designated by type is not populated, * the function returns NULL if the FILTER_NULL_ON_FAILURE * flag is not given, or FALSE otherwise. For other failures, FALSE is returned. - * - * An array value will be FALSE if the filter fails, or NULL if + * + * An array value will be FALSE if the filter fails, or NULL if * the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE - * is used, it returns FALSE if the variable is not set and NULL if the filter + * is used, it returns FALSE if the variable is not set and NULL if the filter * fails. If the add_empty parameter is FALSE, no array * element will be added for unset variables. * @throws FilterException - * + * */ -function filter_input_array(int $type, $definition = null, bool $add_empty = true) +function filter_input_array(int $type, $options = FILTER_DEFAULT, bool $add_empty = true) { error_clear_last(); - if ($add_empty !== true) { - $result = \filter_input_array($type, $definition, $add_empty); - } elseif ($definition !== null) { - $result = \filter_input_array($type, $definition); - } else { - $result = \filter_input_array($type); - } + $result = \filter_input_array($type, $options, $add_empty); if ($result === false) { throw FilterException::createFromPhpError(); } @@ -56,9 +50,9 @@ function filter_input_array(int $type, $definition = null, bool $add_empty = tru /** * This function is useful for retrieving many values without * repetitively calling filter_var. - * - * @param array $data An array with string keys containing the data to filter. - * @param mixed $definition An array defining the arguments. A valid key is a string + * + * @param array $array An array with string keys containing the data to filter. + * @param $options An array defining the arguments. A valid key is a string * containing a variable name and a valid value is either a * filter type, or an * array optionally specifying the filter, flags and options. @@ -67,27 +61,23 @@ function filter_input_array(int $type, $definition = null, bool $add_empty = tru * flags which specifies any flags that apply to the * filter, and options which specifies any options that * apply to the filter. See the example below for a better understanding. - * + * * This parameter can be also an integer holding a filter constant. Then all values in the * input array are filtered by this filter. * @param bool $add_empty Add missing keys as NULL to the return value. - * @return mixed An array containing the values of the requested variables on success. An array value will be FALSE if the filter fails, or NULL if + * @return mixed An array containing the values of the requested variables on success. An array value will be FALSE if the filter fails, or NULL if * the variable is not set. * @throws FilterException - * + * */ -function filter_var_array(array $data, $definition = null, bool $add_empty = true) +function filter_var_array(array $array, $options = FILTER_DEFAULT, bool $add_empty = true) { error_clear_last(); - if ($add_empty !== true) { - $result = \filter_var_array($data, $definition, $add_empty); - } elseif ($definition !== null) { - $result = \filter_var_array($data, $definition); - } else { - $result = \filter_var_array($data); - } + $result = \filter_var_array($array, $options, $add_empty); if ($result === false) { throw FilterException::createFromPhpError(); } return $result; } + + diff --git a/generated/fpm.php b/generated/fpm.php index 08b39410..57d97170 100644 --- a/generated/fpm.php +++ b/generated/fpm.php @@ -8,9 +8,9 @@ * This function flushes all response data to the client and finishes the * request. This allows for time consuming tasks to be performed without * leaving the connection to the client open. - * + * * @throws FpmException - * + * */ function fastcgi_finish_request(): void { @@ -20,3 +20,5 @@ function fastcgi_finish_request(): void throw FpmException::createFromPhpError(); } } + + diff --git a/generated/ftp.php b/generated/ftp.php index 17488265..870da5d4 100644 --- a/generated/ftp.php +++ b/generated/ftp.php @@ -5,20 +5,20 @@ use Safe\Exceptions\FtpException; /** - * Sends an ALLO command to the remote FTP server to + * Sends an ALLO command to the remote FTP server to * allocate space for a file to be uploaded. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param int $filesize The number of bytes to allocate. - * @param string $result A textual representation of the servers response will be returned by - * reference in result if a variable is provided. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param int $size The number of bytes to allocate. + * @param string|null $response A textual representation of the servers response will be returned by + * reference in response if a variable is provided. * @throws FtpException - * + * */ -function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void +function ftp_alloc(\FTP\Connection $ftp, int $size, ?string &$response = null): void { error_clear_last(); - $result = \ftp_alloc($ftp_stream, $filesize, $result); + $result = \ftp_alloc($ftp, $size, $response); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -26,19 +26,19 @@ function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void /** - * - * - * @param resource $ftp - * @param string $remote_file - * @param string $local_file - * @param int $mode + * + * + * @param resource $ftp An FTP\Connection instance. + * @param string $remote_filename + * @param string $local_filename + * @param int $mode * @throws FtpException - * + * */ -function ftp_append($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY): void +function ftp_append( $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): void { error_clear_last(); - $result = \ftp_append($ftp, $remote_file, $local_file, $mode); + $result = \ftp_append($ftp, $remote_filename, $local_filename, $mode); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -47,15 +47,15 @@ function ftp_append($ftp, string $remote_file, string $local_file, int $mode = F /** * Changes to the parent directory. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @throws FtpException - * + * */ -function ftp_cdup($ftp_stream): void +function ftp_cdup(\FTP\Connection $ftp): void { error_clear_last(); - $result = \ftp_cdup($ftp_stream); + $result = \ftp_cdup($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -64,16 +64,16 @@ function ftp_cdup($ftp_stream): void /** * Changes the current directory to the specified one. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $directory The target directory. * @throws FtpException - * + * */ -function ftp_chdir($ftp_stream, string $directory): void +function ftp_chdir(\FTP\Connection $ftp, string $directory): void { error_clear_last(); - $result = \ftp_chdir($ftp_stream, $directory); + $result = \ftp_chdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -81,20 +81,20 @@ function ftp_chdir($ftp_stream, string $directory): void /** - * Sets the permissions on the specified remote file to - * mode. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param int $mode The new permissions, given as an octal value. + * Sets the permissions on the specified remote file to + * permissions. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param int $permissions The new permissions, given as an octal value. * @param string $filename The remote file. * @return int Returns the new file permissions on success. * @throws FtpException - * + * */ -function ftp_chmod($ftp_stream, int $mode, string $filename): int +function ftp_chmod(\FTP\Connection $ftp, int $permissions, string $filename): int { error_clear_last(); - $result = \ftp_chmod($ftp_stream, $mode, $filename); + $result = \ftp_chmod($ftp, $permissions, $filename); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -105,15 +105,15 @@ function ftp_chmod($ftp_stream, int $mode, string $filename): int /** * ftp_close closes the given link identifier * and releases the resource. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @throws FtpException - * + * */ -function ftp_close($ftp_stream): void +function ftp_close(\FTP\Connection $ftp): void { error_clear_last(); - $result = \ftp_close($ftp_stream); + $result = \ftp_close($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -122,9 +122,9 @@ function ftp_close($ftp_stream): void /** * ftp_connect opens an FTP connection to the - * specified host. - * - * @param string $host The FTP server address. This parameter shouldn't have any trailing + * specified hostname. + * + * @param string $hostname The FTP server address. This parameter shouldn't have any trailing * slashes and shouldn't be prefixed with ftp://. * @param int $port This parameter specifies an alternate port to connect to. If it is * omitted or set to zero, then the default FTP port, 21, will be used. @@ -132,14 +132,14 @@ function ftp_close($ftp_stream): void * If omitted, the default value is 90 seconds. The timeout can be changed and * queried at any time with ftp_set_option and * ftp_get_option. - * @return resource Returns a FTP stream on success. + * @return resource Returns an FTP\Connection instance on success. * @throws FtpException - * + * */ -function ftp_connect(string $host, int $port = 21, int $timeout = 90) +function ftp_connect(string $hostname, int $port = 21, int $timeout = 90) { error_clear_last(); - $result = \ftp_connect($host, $port, $timeout); + $result = \ftp_connect($hostname, $port, $timeout); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -149,17 +149,17 @@ function ftp_connect(string $host, int $port = 21, int $timeout = 90) /** * ftp_delete deletes the file specified by - * path from the FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $path The file to delete. + * filename from the FTP server. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $filename The file to delete. * @throws FtpException - * + * */ -function ftp_delete($ftp_stream, string $path): void +function ftp_delete(\FTP\Connection $ftp, string $filename): void { error_clear_last(); - $result = \ftp_delete($ftp_stream, $path); + $result = \ftp_delete($ftp, $filename); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -167,22 +167,22 @@ function ftp_delete($ftp_stream, string $path): void /** - * ftp_fget retrieves remote_file + * ftp_fget retrieves remote_filename * from the FTP server, and writes it to the given file pointer. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param resource $handle An open file pointer in which we store the data. - * @param string $remote_file The remote file path. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param resource $stream An open file pointer in which we store the data. + * @param string $remote_filename The remote file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $resumepos The position in the remote file to start downloading from. + * @param int $offset The position in the remote file to start downloading from. * @throws FtpException - * + * */ -function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void +function ftp_fget(\FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_fget($ftp_stream, $handle, $remote_file, $mode, $resumepos); + $result = \ftp_fget($ftp, $stream, $remote_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -192,20 +192,20 @@ function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = FTP_BIN /** * ftp_fput uploads the data from a file pointer * to a remote file on the FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $remote_file The remote file path. - * @param resource $handle An open file pointer on the local file. Reading stops at end of file. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param resource $stream An open file pointer on the local file. Reading stops at end of file. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $startpos The position in the remote file to start uploading to. + * @param int $offset The position in the remote file to start uploading to. * @throws FtpException - * + * */ -function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = FTP_BINARY, int $startpos = 0): void +function ftp_fput(\FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_fput($ftp_stream, $remote_file, $handle, $mode, $startpos); + $result = \ftp_fput($ftp, $remote_filename, $stream, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -215,20 +215,20 @@ function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = FTP_BIN /** * ftp_get retrieves a remote file from the FTP server, * and saves it into a local file. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $local_file The local file path (will be overwritten if the file already exists). - * @param string $remote_file The remote file path. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $local_filename The local file path (will be overwritten if the file already exists). + * @param string $remote_filename The remote file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $resumepos The position in the remote file to start downloading from. + * @param int $offset The position in the remote file to start downloading from. * @throws FtpException - * + * */ -function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void +function ftp_get(\FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos); + $result = \ftp_get($ftp, $local_filename, $remote_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -236,18 +236,18 @@ function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode /** - * Logs in to the given FTP stream. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * Logs in to the given FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $username The username (USER). * @param string $password The password (PASS). * @throws FtpException - * + * */ -function ftp_login($ftp_stream, string $username, string $password): void +function ftp_login(\FTP\Connection $ftp, string $username, string $password): void { error_clear_last(); - $result = \ftp_login($ftp_stream, $username, $password); + $result = \ftp_login($ftp, $username, $password); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -256,17 +256,17 @@ function ftp_login($ftp_stream, string $username, string $password): void /** * Creates the specified directory on the FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $directory The name of the directory that will be created. * @return string Returns the newly created directory name on success. * @throws FtpException - * + * */ -function ftp_mkdir($ftp_stream, string $directory): string +function ftp_mkdir(\FTP\Connection $ftp, string $directory): string { error_clear_last(); - $result = \ftp_mkdir($ftp_stream, $directory); + $result = \ftp_mkdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -275,18 +275,18 @@ function ftp_mkdir($ftp_stream, string $directory): string /** - * - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $directory The directory to be listed. * @return array Returns an array of arrays with file infos from the specified directory on success. * @throws FtpException - * + * */ -function ftp_mlsd($ftp_stream, string $directory): array +function ftp_mlsd(\FTP\Connection $ftp, string $directory): array { error_clear_last(); - $result = \ftp_mlsd($ftp_stream, $directory); + $result = \ftp_mlsd($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -295,21 +295,50 @@ function ftp_mlsd($ftp_stream, string $directory): array /** - * - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * ftp_nb_put stores a local file on the FTP server. + * + * The difference between this function and the ftp_put + * is that this function uploads the file asynchronously, so your program can + * perform other operations while the file is being uploaded. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param string $local_filename The local file path. + * @param int $mode The transfer mode. Must be either FTP_ASCII or + * FTP_BINARY. + * @param int $offset The position in the remote file to start uploading to. + * @return int Returns FTP_FAILED or FTP_FINISHED + * or FTP_MOREDATA to open the local file. + * @throws FtpException + * + */ +function ftp_nb_put(\FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int +{ + error_clear_last(); + $result = \ftp_nb_put($ftp, $remote_filename, $local_filename, $mode, $offset); + if ($result === false) { + throw FtpException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $directory The directory to be listed. This parameter can also include arguments, eg. - * ftp_nlist($conn_id, "-la /your/dir"); + * ftp_nlist($ftp, "-la /your/dir");. * Note that this parameter isn't escaped so there may be some issues with * filenames containing spaces and other characters. * @return array Returns an array of filenames from the specified directory on success. * @throws FtpException - * + * */ -function ftp_nlist($ftp_stream, string $directory): array +function ftp_nlist(\FTP\Connection $ftp, string $directory): array { error_clear_last(); - $result = \ftp_nlist($ftp_stream, $directory); + $result = \ftp_nlist($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -322,19 +351,19 @@ function ftp_nlist($ftp_stream, string $directory): array * passive mode, data connections are initiated by the client, * rather than by the server. * It may be needed if the client is behind firewall. - * + * * Please note that ftp_pasv can only be called after a * successful login or otherwise it will fail. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param bool $pasv If TRUE, the passive mode is turned on, else it's turned off. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param bool $enable If TRUE, the passive mode is turned on, else it's turned off. * @throws FtpException - * + * */ -function ftp_pasv($ftp_stream, bool $pasv): void +function ftp_pasv(\FTP\Connection $ftp, bool $enable): void { error_clear_last(); - $result = \ftp_pasv($ftp_stream, $pasv); + $result = \ftp_pasv($ftp, $enable); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -343,20 +372,20 @@ function ftp_pasv($ftp_stream, bool $pasv): void /** * ftp_put stores a local file on the FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $remote_file The remote file path. - * @param string $local_file The local file path. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param string $local_filename The local file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $startpos The position in the remote file to start uploading to. + * @param int $offset The position in the remote file to start uploading to. * @throws FtpException - * + * */ -function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): void +function ftp_put(\FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos); + $result = \ftp_put($ftp, $remote_filename, $local_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -364,17 +393,17 @@ function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode /** - * - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @return string Returns the current directory name. * @throws FtpException - * + * */ -function ftp_pwd($ftp_stream): string +function ftp_pwd(\FTP\Connection $ftp): string { error_clear_last(); - $result = \ftp_pwd($ftp_stream); + $result = \ftp_pwd($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -382,20 +411,42 @@ function ftp_pwd($ftp_stream): string } +/** + * Sends an arbitrary command to the FTP server. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $command The command to execute. + * @return array Returns the server's response as an array of strings. + * No parsing is performed on the response string, nor does + * ftp_raw determine if the command succeeded. + * @throws FtpException + * + */ +function ftp_raw(\FTP\Connection $ftp, string $command): array +{ + error_clear_last(); + $result = \ftp_raw($ftp, $command); + if ($result === null) { + throw FtpException::createFromPhpError(); + } + return $result; +} + + /** * ftp_rename renames a file or a directory on the FTP * server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $oldname The old file/directory name. - * @param string $newname The new name. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $from The old file/directory name. + * @param string $to The new name. * @throws FtpException - * + * */ -function ftp_rename($ftp_stream, string $oldname, string $newname): void +function ftp_rename(\FTP\Connection $ftp, string $from, string $to): void { error_clear_last(); - $result = \ftp_rename($ftp_stream, $oldname, $newname); + $result = \ftp_rename($ftp, $from, $to); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -404,17 +455,17 @@ function ftp_rename($ftp_stream, string $oldname, string $newname): void /** * Removes the specified directory on the FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $directory The directory to delete. This must be either an absolute or relative * path to an empty directory. * @throws FtpException - * + * */ -function ftp_rmdir($ftp_stream, string $directory): void +function ftp_rmdir(\FTP\Connection $ftp, string $directory): void { error_clear_last(); - $result = \ftp_rmdir($ftp_stream, $directory); + $result = \ftp_rmdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -422,23 +473,23 @@ function ftp_rmdir($ftp_stream, string $directory): void /** - * ftp_site sends the given SITE + * ftp_site sends the given SITE * command to the FTP server. - * + * * SITE commands are not standardized, and vary from server - * to server. They are useful for handling such things as file permissions and + * to server. They are useful for handling such things as file permissions and * group membership. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $command The SITE command. Note that this parameter isn't escaped so there may * be some issues with filenames containing spaces and other characters. * @throws FtpException - * + * */ -function ftp_site($ftp_stream, string $command): void +function ftp_site(\FTP\Connection $ftp, string $command): void { error_clear_last(); - $result = \ftp_site($ftp_stream, $command); + $result = \ftp_site($ftp, $command); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -447,14 +498,14 @@ function ftp_site($ftp_stream, string $command): void /** * ftp_ssl_connect opens an explicit SSL-FTP connection to the - * specified host. That implies that + * specified hostname. That implies that * ftp_ssl_connect will succeed even if the server is not * configured for SSL-FTP, or its certificate is invalid. Only when * ftp_login is called, the client will send the * appropriate AUTH FTP command, so ftp_login will fail in * the mentioned cases. - * - * @param string $host The FTP server address. This parameter shouldn't have any trailing + * + * @param string $hostname The FTP server address. This parameter shouldn't have any trailing * slashes and shouldn't be prefixed with ftp://. * @param int $port This parameter specifies an alternate port to connect to. If it is * omitted or set to zero, then the default FTP port, 21, will be used. @@ -462,14 +513,14 @@ function ftp_site($ftp_stream, string $command): void * If omitted, the default value is 90 seconds. The timeout can be changed and * queried at any time with ftp_set_option and * ftp_get_option. - * @return resource Returns a SSL-FTP stream on success. + * @return resource Returns an FTP\Connection instance on success. * @throws FtpException - * + * */ -function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) +function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90) { error_clear_last(); - $result = \ftp_ssl_connect($host, $port, $timeout); + $result = \ftp_ssl_connect($hostname, $port, $timeout); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -479,18 +530,20 @@ function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) /** * Returns the system type identifier of the remote FTP server. - * - * @param resource $ftp_stream The link identifier of the FTP connection. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. * @return string Returns the remote system type. * @throws FtpException - * + * */ -function ftp_systype($ftp_stream): string +function ftp_systype(\FTP\Connection $ftp): string { error_clear_last(); - $result = \ftp_systype($ftp_stream); + $result = \ftp_systype($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } return $result; } + + diff --git a/generated/funchand.php b/generated/funchand.php index 64654526..7ccb10b7 100644 --- a/generated/funchand.php +++ b/generated/funchand.php @@ -5,14 +5,16 @@ use Safe\Exceptions\FunchandException; /** - * Creates an anonymous function from the parameters passed, and - * returns a unique name for it. - * - * @param string $args The function arguments. + * Creates a function dynamically from the parameters passed, and returns a unique name for it. + * + * @param string $args The function arguments, as a single comma-separated string. * @param string $code The function code. * @return string Returns a unique function name as a string. + * Note that the name contains a non-printable character ("\0"), + * so care should be taken when printing the name or incorporating it in any other + * string. * @throws FunchandException - * + * */ function create_function(string $args, string $code): string { @@ -26,22 +28,20 @@ function create_function(string $args, string $code): string /** - * - * - * @param callable(): void $function The function to register. - * @param mixed $params + * + * + * @param callable $callback The function to register. + * @param mixed $args * @throws FunchandException - * + * */ -function register_tick_function(callable $function, ...$params): void +function register_tick_function(callable $callback, $args): void { error_clear_last(); - if ($params !== []) { - $result = \register_tick_function($function, ...$params); - } else { - $result = \register_tick_function($function); - } + $result = \register_tick_function($callback, $args); if ($result === false) { throw FunchandException::createFromPhpError(); } } + + diff --git a/generated/functionsList.php b/generated/functionsList.php index a43e7efa..fd08100e 100644 --- a/generated/functionsList.php +++ b/generated/functionsList.php @@ -3,8 +3,8 @@ return [ 'apache_getenv', 'apache_get_version', + 'apache_lookup_uri', 'apache_request_headers', - 'apache_reset_timeout', 'apache_response_headers', 'apache_setenv', 'apcu_cache_info', @@ -14,14 +14,11 @@ 'apcu_inc', 'apcu_sma_info', 'apc_fetch', - 'array_combine', - 'array_flip', 'array_replace', 'array_replace_recursive', 'array_walk_recursive', - 'arsort', - 'asort', 'base64_decode', + 'bindtextdomain', 'bzclose', 'bzflush', 'bzread', @@ -32,30 +29,71 @@ 'chown', 'chroot', 'class_alias', - 'class_implements', - 'class_parents', - 'class_uses', 'cli_set_process_title', 'closelog', + 'com_create_guid', 'com_event_sink', 'com_load_typelib', 'com_print_typeinfo', 'convert_uudecode', - 'convert_uuencode', 'copy', + 'count_chars', 'create_function', + 'cubrid_bind', + 'cubrid_column_names', + 'cubrid_column_types', + 'cubrid_col_size', + 'cubrid_commit', + 'cubrid_connect', + 'cubrid_connect_with_url', + 'cubrid_current_oid', + 'cubrid_disconnect', + 'cubrid_drop', 'cubrid_free_result', 'cubrid_get_charset', + 'cubrid_get_class_name', 'cubrid_get_client_info', 'cubrid_get_db_parameter', + 'cubrid_get_query_timeout', 'cubrid_get_server_info', 'cubrid_insert_id', + 'cubrid_lob2_bind', + 'cubrid_lob2_close', + 'cubrid_lob2_export', + 'cubrid_lob2_import', 'cubrid_lob2_new', + 'cubrid_lob2_read', + 'cubrid_lob2_seek', + 'cubrid_lob2_seek64', 'cubrid_lob2_size', 'cubrid_lob2_size64', 'cubrid_lob2_tell', 'cubrid_lob2_tell64', + 'cubrid_lob2_write', + 'cubrid_lob_close', + 'cubrid_lob_export', + 'cubrid_lob_get', + 'cubrid_lob_send', + 'cubrid_lob_size', + 'cubrid_lock_read', + 'cubrid_lock_write', + 'cubrid_move_cursor', + 'cubrid_next_result', + 'cubrid_pconnect', + 'cubrid_pconnect_with_url', + 'cubrid_prepare', + 'cubrid_put', + 'cubrid_rollback', + 'cubrid_schema', + 'cubrid_seq_drop', + 'cubrid_seq_insert', + 'cubrid_seq_put', + 'cubrid_set_add', + 'cubrid_set_autocommit', 'cubrid_set_db_parameter', + 'cubrid_set_drop', + 'cubrid_set_query_timeout', + 'curl_copy_handle', 'curl_escape', 'curl_exec', 'curl_getinfo', @@ -67,7 +105,6 @@ 'curl_share_errno', 'curl_share_setopt', 'curl_unescape', - 'date', 'date_parse', 'date_parse_from_format', 'date_sunrise', @@ -93,6 +130,7 @@ 'disk_total_space', 'dl', 'dns_get_record', + 'dom_import_simplexml', 'eio_busy', 'eio_chmod', 'eio_chown', @@ -102,6 +140,7 @@ 'eio_event_loop', 'eio_fallocate', 'eio_fchmod', + 'eio_fchown', 'eio_fdatasync', 'eio_fstat', 'eio_fstatvfs', @@ -131,16 +170,20 @@ 'eio_utime', 'eio_write', 'error_log', + 'exec', 'fastcgi_finish_request', 'fbird_blob_cancel', 'fclose', + 'fdatasync', 'fflush', + 'fgetcsv', 'file', 'fileatime', 'filectime', 'fileinode', 'filemtime', 'fileowner', + 'fileperms', 'filesize', 'file_get_contents', 'file_put_contents', @@ -153,6 +196,8 @@ 'fputcsv', 'fread', 'fsockopen', + 'fstat', + 'fsync', 'ftp_alloc', 'ftp_append', 'ftp_cdup', @@ -167,10 +212,12 @@ 'ftp_login', 'ftp_mkdir', 'ftp_mlsd', + 'ftp_nb_put', 'ftp_nlist', 'ftp_pasv', 'ftp_put', 'ftp_pwd', + 'ftp_raw', 'ftp_rename', 'ftp_rmdir', 'ftp_site', @@ -190,19 +237,25 @@ 'getopt', 'getprotobyname', 'getprotobynumber', + 'getrusage', + 'getservbyport', 'get_headers', + 'get_include_path', + 'get_meta_tags', 'glob', - 'gmdate', + 'gmmktime', 'gmp_binomial', 'gmp_export', 'gmp_import', 'gmp_random_seed', + 'gmstrftime', 'gnupg_adddecryptkey', 'gnupg_addencryptkey', 'gnupg_addsignkey', 'gnupg_cleardecryptkeys', 'gnupg_clearencryptkeys', 'gnupg_clearsignkeys', + 'gnupg_deletekey', 'gnupg_setarmor', 'gnupg_setsignmode', 'gzclose', @@ -210,18 +263,22 @@ 'gzdecode', 'gzdeflate', 'gzencode', + 'gzfile', 'gzgets', 'gzgetss', 'gzinflate', 'gzpassthru', + 'gzread', 'gzrewind', 'gzuncompress', + 'gzwrite', 'hash_hkdf', 'hash_update_file', 'header_register_callback', 'hex2bin', 'highlight_file', 'highlight_string', + 'hrtime', 'ibase_add_user', 'ibase_backup', 'ibase_blob_cancel', @@ -248,6 +305,7 @@ 'iconv', 'iconv_get_encoding', 'iconv_set_encoding', + 'idate', 'image2wbmp', 'imageaffine', 'imageaffinematrixconcat', @@ -255,12 +313,14 @@ 'imagealphablending', 'imageantialias', 'imagearc', + 'imageavif', 'imagebmp', 'imagechar', 'imagecharup', 'imagecolorat', 'imagecolordeallocate', 'imagecolormatch', + 'imagecolorset', 'imageconvolution', 'imagecopy', 'imagecopymerge', @@ -268,6 +328,7 @@ 'imagecopyresampled', 'imagecopyresized', 'imagecreate', + 'imagecreatefromavif', 'imagecreatefrombmp', 'imagecreatefromgd', 'imagecreatefromgd2', @@ -275,6 +336,7 @@ 'imagecreatefromgif', 'imagecreatefromjpeg', 'imagecreatefrompng', + 'imagecreatefromtga', 'imagecreatefromwbmp', 'imagecreatefromwebp', 'imagecreatefromxbm', @@ -288,11 +350,12 @@ 'imagefill', 'imagefilledarc', 'imagefilledellipse', - 'imagefilledpolygon', 'imagefilledrectangle', 'imagefilltoborder', 'imagefilter', 'imageflip', + 'imageftbbox', + 'imagefttext', 'imagegammacorrect', 'imagegd', 'imagegd2', @@ -303,10 +366,9 @@ 'imagelayereffect', 'imageline', 'imageloadfont', - 'imageopenpolygon', 'imagepng', - 'imagepolygon', 'imagerectangle', + 'imageresolution', 'imagerotate', 'imagesavealpha', 'imagescale', @@ -327,29 +389,49 @@ 'imagewbmp', 'imagewebp', 'imagexbm', + 'image_type_to_extension', + 'imap_8bit', 'imap_append', + 'imap_base64', + 'imap_binary', + 'imap_body', + 'imap_bodystruct', 'imap_check', 'imap_clearflag_full', 'imap_close', 'imap_createmailbox', 'imap_deletemailbox', + 'imap_fetchbody', + 'imap_fetchheader', + 'imap_fetchmime', 'imap_fetchstructure', + 'imap_fetch_overview', 'imap_gc', + 'imap_getacl', + 'imap_getmailboxes', + 'imap_getsubscribed', 'imap_headerinfo', + 'imap_headers', + 'imap_listscan', + 'imap_lsub', 'imap_mail', 'imap_mailboxmsginfo', 'imap_mail_compose', 'imap_mail_copy', 'imap_mail_move', + 'imap_mime_header_decode', 'imap_mutf7_to_utf8', 'imap_num_msg', 'imap_open', + 'imap_qprint', 'imap_renamemailbox', + 'imap_rfc822_write_address', 'imap_savebody', 'imap_setacl', 'imap_setflag_full', 'imap_set_quota', 'imap_sort', + 'imap_status', 'imap_subscribe', 'imap_thread', 'imap_timeout', @@ -361,18 +443,6 @@ 'inflate_get_read_len', 'inflate_get_status', 'inflate_init', - 'ingres_autocommit', - 'ingres_close', - 'ingres_commit', - 'ingres_connect', - 'ingres_execute', - 'ingres_field_name', - 'ingres_field_type', - 'ingres_free_result', - 'ingres_pconnect', - 'ingres_result_seek', - 'ingres_rollback', - 'ingres_set_environment', 'ini_get', 'ini_set', 'inotify_init', @@ -383,20 +453,16 @@ 'jpeg2wbmp', 'json_decode', 'json_encode', - 'json_last_error_msg', - 'krsort', - 'ksort', 'lchgrp', 'lchown', + 'ldap_8859_to_t61', 'ldap_add', - 'ldap_add_ext', 'ldap_bind', - 'ldap_bind_ext', 'ldap_control_paged_result', 'ldap_control_paged_result_response', 'ldap_count_entries', 'ldap_delete', - 'ldap_delete_ext', + 'ldap_dn2ufn', 'ldap_exop', 'ldap_exop_passwd', 'ldap_exop_whoami', @@ -410,27 +476,21 @@ 'ldap_get_option', 'ldap_get_values', 'ldap_get_values_len', - 'ldap_list', 'ldap_modify_batch', 'ldap_mod_add', - 'ldap_mod_add_ext', 'ldap_mod_del', - 'ldap_mod_del_ext', 'ldap_mod_replace', - 'ldap_mod_replace_ext', 'ldap_next_attribute', 'ldap_parse_exop', 'ldap_parse_result', - 'ldap_read', 'ldap_rename', - 'ldap_rename_ext', 'ldap_sasl_bind', - 'ldap_search', 'ldap_set_option', 'ldap_unbind', 'libxml_get_last_error', - 'libxml_set_external_entity_loader', 'link', + 'long2ip', + 'lstat', 'lzf_compress', 'lzf_decompress', 'mailparse_msg_extract_part_file', @@ -439,6 +499,7 @@ 'mailparse_msg_parse_file', 'mailparse_stream_encode', 'mb_chr', + 'mb_convert_encoding', 'mb_detect_order', 'mb_encoding_aliases', 'mb_eregi_replace', @@ -448,6 +509,7 @@ 'mb_ereg_search_init', 'mb_ereg_search_regs', 'mb_ereg_search_setpos', + 'mb_get_info', 'mb_http_output', 'mb_internal_encoding', 'mb_ord', @@ -461,36 +523,13 @@ 'mime_content_type', 'mkdir', 'mktime', + 'msg_get_queue', 'msg_queue_exists', 'msg_receive', 'msg_remove_queue', 'msg_send', 'msg_set_queue', - 'msql_affected_rows', - 'msql_close', - 'msql_connect', - 'msql_create_db', - 'msql_data_seek', - 'msql_db_query', - 'msql_drop_db', - 'msql_field_len', - 'msql_field_name', - 'msql_field_seek', - 'msql_field_table', - 'msql_field_type', - 'msql_free_result', - 'msql_pconnect', - 'msql_query', - 'msql_select_db', - 'mysqli_get_cache_stats', - 'mysqli_get_client_stats', - 'mysqlnd_ms_dump_servers', - 'mysqlnd_ms_fabric_select_global', - 'mysqlnd_ms_fabric_select_shard', - 'mysqlnd_ms_get_last_used_connection', - 'mysqlnd_qc_clear_cache', - 'mysqlnd_qc_set_is_select', - 'mysqlnd_qc_set_storage_handler', + 'msg_stat_queue', 'mysql_close', 'mysql_connect', 'mysql_create_db', @@ -522,19 +561,18 @@ 'mysql_tablename', 'mysql_thread_id', 'mysql_unbuffered_query', - 'natcasesort', - 'natsort', + 'net_get_interfaces', + 'ob_clean', 'ob_end_clean', 'ob_end_flush', + 'ob_flush', 'oci_bind_array_by_name', 'oci_bind_by_name', 'oci_cancel', - 'oci_close', 'oci_commit', 'oci_connect', 'oci_define_by_name', 'oci_execute', - 'oci_fetch_all', 'oci_field_name', 'oci_field_precision', 'oci_field_scale', @@ -547,7 +585,6 @@ 'oci_new_connect', 'oci_new_cursor', 'oci_new_descriptor', - 'oci_num_fields', 'oci_num_rows', 'oci_parse', 'oci_pconnect', @@ -562,6 +599,7 @@ 'oci_set_edition', 'oci_set_module_name', 'oci_set_prefetch', + 'oci_set_prefetch_lob', 'oci_statement_type', 'oci_unregister_taf_callback', 'odbc_autocommit', @@ -569,6 +607,8 @@ 'odbc_columnprivileges', 'odbc_columns', 'odbc_commit', + 'odbc_connect', + 'odbc_cursor', 'odbc_data_source', 'odbc_exec', 'odbc_execute', @@ -581,8 +621,11 @@ 'odbc_foreignkeys', 'odbc_gettypeinfo', 'odbc_longreadlen', + 'odbc_pconnect', 'odbc_prepare', 'odbc_primarykeys', + 'odbc_procedurecolumns', + 'odbc_procedures', 'odbc_result', 'odbc_result_all', 'odbc_rollback', @@ -596,8 +639,14 @@ 'opendir', 'openlog', 'openssl_cipher_iv_length', + 'openssl_cms_decrypt', + 'openssl_cms_encrypt', + 'openssl_cms_read', + 'openssl_cms_sign', + 'openssl_cms_verify', 'openssl_csr_export', 'openssl_csr_export_to_file', + 'openssl_csr_get_public_key', 'openssl_csr_get_subject', 'openssl_csr_new', 'openssl_csr_sign', @@ -605,6 +654,7 @@ 'openssl_dh_compute_key', 'openssl_digest', 'openssl_encrypt', + 'openssl_get_curve_names', 'openssl_open', 'openssl_pbkdf2', 'openssl_pkcs7_decrypt', @@ -614,6 +664,7 @@ 'openssl_pkcs12_export', 'openssl_pkcs12_export_to_file', 'openssl_pkcs12_read', + 'openssl_pkey_derive', 'openssl_pkey_export', 'openssl_pkey_export_to_file', 'openssl_pkey_get_private', @@ -626,6 +677,11 @@ 'openssl_random_pseudo_bytes', 'openssl_seal', 'openssl_sign', + 'openssl_spki_export', + 'openssl_spki_export_challenge', + 'openssl_spki_new', + 'openssl_spki_verify', + 'openssl_verify', 'openssl_x509_export', 'openssl_x509_export_to_file', 'openssl_x509_fingerprint', @@ -636,123 +692,42 @@ 'parse_ini_file', 'parse_ini_string', 'parse_url', + 'passthru', 'password_hash', - 'pcntl_exec', 'pcntl_getpriority', 'pcntl_setpriority', 'pcntl_signal_dispatch', 'pcntl_sigprocmask', - 'pcntl_strerror', - 'PDF_activate_item', - 'PDF_add_locallink', - 'PDF_add_nameddest', - 'PDF_add_note', - 'PDF_add_pdflink', - 'PDF_add_thumbnail', - 'PDF_add_weblink', - 'PDF_attach_file', - 'PDF_begin_layer', - 'PDF_begin_page', - 'PDF_begin_page_ext', - 'PDF_circle', - 'PDF_clip', - 'PDF_close', - 'PDF_closepath', - 'PDF_closepath_fill_stroke', - 'PDF_closepath_stroke', - 'PDF_close_pdi', - 'PDF_close_pdi_page', - 'PDF_concat', - 'PDF_continue_text', - 'PDF_curveto', - 'PDF_delete', - 'PDF_end_layer', - 'PDF_end_page', - 'PDF_end_page_ext', - 'PDF_end_pattern', - 'PDF_end_template', - 'PDF_fill', - 'PDF_fill_stroke', - 'PDF_fit_image', - 'PDF_fit_pdi_page', - 'PDF_fit_textline', - 'PDF_initgraphics', - 'PDF_lineto', - 'PDF_makespotcolor', - 'PDF_moveto', - 'PDF_open_file', - 'PDF_place_image', - 'PDF_place_pdi_page', - 'PDF_rect', - 'PDF_restore', - 'PDF_rotate', - 'PDF_save', - 'PDF_scale', - 'PDF_setcolor', - 'PDF_setdash', - 'PDF_setdashpattern', - 'PDF_setflat', - 'PDF_setfont', - 'PDF_setgray', - 'PDF_setgray_fill', - 'PDF_setgray_stroke', - 'PDF_setlinejoin', - 'PDF_setlinewidth', - 'PDF_setmatrix', - 'PDF_setmiterlimit', - 'PDF_setrgbcolor', - 'PDF_setrgbcolor_fill', - 'PDF_setrgbcolor_stroke', - 'PDF_set_border_color', - 'PDF_set_border_dash', - 'PDF_set_border_style', - 'PDF_set_info', - 'PDF_set_layer_dependency', - 'PDF_set_parameter', - 'PDF_set_text_pos', - 'PDF_set_value', - 'PDF_show', - 'PDF_show_xy', - 'PDF_skew', - 'PDF_stroke', + 'pcntl_sigtimedwait', + 'pcntl_sigwaitinfo', + 'pfsockopen', 'pg_cancel_query', - 'pg_client_encoding', - 'pg_close', 'pg_connect', 'pg_connection_reset', 'pg_convert', 'pg_copy_from', 'pg_copy_to', - 'pg_dbname', 'pg_delete', 'pg_end_copy', 'pg_execute', - 'pg_field_name', 'pg_field_table', - 'pg_field_type', 'pg_flush', 'pg_free_result', - 'pg_host', 'pg_insert', - 'pg_last_error', - 'pg_last_notice', 'pg_last_oid', 'pg_lo_close', 'pg_lo_export', 'pg_lo_import', 'pg_lo_open', 'pg_lo_read', - 'pg_lo_read_all', 'pg_lo_seek', 'pg_lo_truncate', 'pg_lo_unlink', 'pg_lo_write', 'pg_meta_data', - 'pg_options', 'pg_parameter_status', 'pg_pconnect', 'pg_ping', - 'pg_port', 'pg_prepare', 'pg_put_line', 'pg_query', @@ -760,21 +735,22 @@ 'pg_result_error_field', 'pg_result_seek', 'pg_select', - 'pg_send_execute', - 'pg_send_prepare', - 'pg_send_query', - 'pg_send_query_params', 'pg_socket', 'pg_trace', - 'pg_tty', 'pg_update', - 'pg_version', 'phpcredits', 'phpinfo', + 'php_sapi_name', 'png2wbmp', 'posix_access', + 'posix_getgrgid', 'posix_getgrnam', + 'posix_getgroups', + 'posix_getlogin', 'posix_getpgid', + 'posix_getpwuid', + 'posix_getrlimit', + 'posix_getsid', 'posix_initgroups', 'posix_kill', 'posix_mkfifo', @@ -785,11 +761,13 @@ 'posix_setpgid', 'posix_setrlimit', 'posix_setuid', + 'posix_times', + 'posix_uname', + 'preg_grep', 'preg_match', 'preg_match_all', 'preg_replace', 'preg_split', - 'proc_get_status', 'proc_nice', 'pspell_add_to_personal', 'pspell_add_to_session', @@ -805,6 +783,7 @@ 'pspell_config_save_repl', 'pspell_new', 'pspell_new_config', + 'pspell_new_personal', 'pspell_save_wordlist', 'pspell_store_replacement', 'ps_add_launchlink', @@ -886,11 +865,17 @@ 'register_tick_function', 'rename', 'rewind', - 'rewinddir', 'rmdir', 'rpmaddtag', 'rrd_create', - 'rsort', + 'rrd_first', + 'rrd_graph', + 'rrd_info', + 'rrd_lastupdate', + 'rrd_restore', + 'rrd_tune', + 'rrd_update', + 'rrd_xport', 'sapi_windows_cp_conv', 'sapi_windows_cp_set', 'sapi_windows_generate_ctrl_event', @@ -901,19 +886,27 @@ 'sem_release', 'sem_remove', 'session_abort', + 'session_create_id', 'session_decode', 'session_destroy', + 'session_encode', + 'session_id', + 'session_module_name', + 'session_name', 'session_regenerate_id', 'session_reset', + 'session_save_path', 'session_unset', 'session_write_close', 'settype', 'set_include_path', 'set_time_limit', 'sha1_file', + 'shell_exec', 'shmop_delete', 'shmop_read', - 'shmop_write', + 'shm_attach', + 'shm_detach', 'shm_put_var', 'shm_remove', 'shm_remove_var', @@ -925,6 +918,7 @@ 'socket_accept', 'socket_addrinfo_bind', 'socket_addrinfo_connect', + 'socket_addrinfo_lookup', 'socket_bind', 'socket_connect', 'socket_create', @@ -948,12 +942,21 @@ 'socket_wsaprotocol_info_export', 'socket_wsaprotocol_info_import', 'socket_wsaprotocol_info_release', - 'sodium_crypto_pwhash', - 'sodium_crypto_pwhash_str', + 'sodium_crypto_aead_aes256gcm_decrypt', + 'sodium_crypto_aead_chacha20poly1305_decrypt', + 'sodium_crypto_aead_chacha20poly1305_encrypt', + 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt', + 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt', + 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt', + 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt', + 'sodium_crypto_auth_verify', + 'sodium_crypto_box_open', + 'sodium_crypto_box_seal_open', + 'sodium_crypto_generichash_update', + 'sodium_crypto_secretbox_open', + 'sodium_crypto_sign_open', + 'sodium_crypto_sign_verify_detached', 'solr_get_version', - 'sort', - 'soundex', - 'spl_autoload_register', 'spl_autoload_unregister', 'sprintf', 'sqlsrv_begin_transaction', @@ -981,11 +984,14 @@ 'ssh2_connect', 'ssh2_disconnect', 'ssh2_exec', + 'ssh2_forward_accept', + 'ssh2_forward_listen', 'ssh2_publickey_add', 'ssh2_publickey_init', 'ssh2_publickey_remove', 'ssh2_scp_recv', 'ssh2_scp_send', + 'ssh2_send_eof', 'ssh2_sftp', 'ssh2_sftp_chmod', 'ssh2_sftp_mkdir', @@ -993,6 +999,7 @@ 'ssh2_sftp_rmdir', 'ssh2_sftp_symlink', 'ssh2_sftp_unlink', + 'ssh2_shell', 'stream_context_set_params', 'stream_copy_to_stream', 'stream_filter_append', @@ -1000,13 +1007,17 @@ 'stream_filter_register', 'stream_filter_remove', 'stream_get_contents', + 'stream_get_line', 'stream_isatty', 'stream_resolve_include_path', 'stream_set_blocking', 'stream_set_timeout', 'stream_socket_accept', 'stream_socket_client', + 'stream_socket_get_name', 'stream_socket_pair', + 'stream_socket_recvfrom', + 'stream_socket_sendto', 'stream_socket_server', 'stream_socket_shutdown', 'stream_supports_lock', @@ -1015,7 +1026,6 @@ 'stream_wrapper_unregister', 'strptime', 'strtotime', - 'substr', 'swoole_async_write', 'swoole_async_writefile', 'swoole_event_defer', @@ -1024,19 +1034,20 @@ 'symlink', 'syslog', 'system', + 'sys_getloadavg', 'tempnam', 'timezone_name_from_abbr', 'time_nanosleep', 'time_sleep_until', 'tmpfile', 'touch', - 'uasort', - 'uksort', + 'unixtojd', 'unlink', 'unpack', 'uopz_extend', 'uopz_implement', - 'usort', + 'variant_date_to_timestamp', + 'variant_round', 'virtual', 'vsprintf', 'xdiff_file_bdiff', @@ -1051,6 +1062,7 @@ 'xmlrpc_set_type', 'xml_parser_create', 'xml_parser_create_ns', + 'xml_parser_free', 'xml_set_object', 'yaml_parse', 'yaml_parse_file', @@ -1064,6 +1076,10 @@ 'yaz_search', 'yaz_wait', 'zip_entry_close', + 'zip_entry_compressedsize', + 'zip_entry_compressionmethod', + 'zip_entry_filesize', + 'zip_entry_name', 'zip_entry_open', 'zip_entry_read', 'zlib_decode', diff --git a/generated/gettext.php b/generated/gettext.php new file mode 100644 index 00000000..b34cf03b --- /dev/null +++ b/generated/gettext.php @@ -0,0 +1,29 @@ + - * - * - * + * + * + * * channels will be 3 for RGB pictures and 4 for CMYK * pictures. - * + * * bits is the number of bits for each color. - * + * * For some image types, the presence of channels and * bits values can be a bit * confusing. As an example, GIF always uses 3 channels * per pixel, but the number of bits per pixel cannot be calculated for an * animated GIF with a global color table. - * + * * On failure, FALSE is returned. * @throws ImageException - * + * */ -function getimagesize(string $filename, array &$imageinfo = null): array +function getimagesize(string $filename, array &$image_info = null): array { error_clear_last(); - $result = \getimagesize($filename, $imageinfo); + $result = \getimagesize($filename, $image_info); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns the extension for the given IMAGETYPE_XXX + * constant. + * + * @param int $image_type One of the IMAGETYPE_XXX constant. + * @param bool $include_dot Whether to prepend a dot to the extension or not. Default to TRUE. + * @return string A string with the extension corresponding to the given image type. + * @throws ImageException + * + */ +function image_type_to_extension(int $image_type, bool $include_dot = true): string +{ + error_clear_last(); + $result = \image_type_to_extension($image_type, $include_dot); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -80,7 +101,7 @@ function getimagesize(string $filename, array &$imageinfo = null): array /** * image2wbmp outputs or save a WBMP * version of the given image. - * + * * @param resource $image An image resource, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param string|null $filename Path to the saved file. If not given, the raw image stream will be @@ -89,16 +110,16 @@ function getimagesize(string $filename, array &$imageinfo = null): array * identifier obtained from imagecolorallocate. * The default foreground color is black. * @throws ImageException - * + * */ -function image2wbmp($image, ?string $filename = null, int $foreground = null): void +function image2wbmp( $image, ?string $filename = null, int $foreground = null): void { error_clear_last(); if ($foreground !== null) { $result = \image2wbmp($image, $filename, $foreground); } elseif ($filename !== null) { $result = \image2wbmp($image, $filename); - } else { + }else { $result = \image2wbmp($image); } if ($result === false) { @@ -108,24 +129,20 @@ function image2wbmp($image, ?string $filename = null, int $foreground = null): v /** - * - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param array $affine Array with keys 0 to 5. - * @param array $clip Array with keys "x", "y", "width" and "height". - * @return resource Return affined image resource on success. + * @param array $clip Array with keys "x", "y", "width" and "height"; or NULL. + * @return resource Return affined image object on success. * @throws ImageException - * + * */ -function imageaffine($image, array $affine, array $clip = null) +function imageaffine(\GdImage $image, array $affine, array $clip = null) { error_clear_last(); - if ($clip !== null) { - $result = \imageaffine($image, $affine, $clip); - } else { - $result = \imageaffine($image, $affine); - } + $result = \imageaffine($image, $affine, $clip); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -137,20 +154,20 @@ function imageaffine($image, array $affine, array $clip = null) * Returns the concatenation of two affine transformation matrices, * what is useful if multiple transformations should be applied to the same * image in one go. - * - * @param array $m1 An affine transformation matrix (an array with keys + * + * @param array $matrix1 An affine transformation matrix (an array with keys * 0 to 5 and float values). - * @param array $m2 An affine transformation matrix (an array with keys + * @param array $matrix2 An affine transformation matrix (an array with keys * 0 to 5 and float values). * @return array{0:float,1:float,2:float,3:float,4:float,5:float} An affine transformation matrix (an array with keys * 0 to 5 and float values). * @throws ImageException - * + * */ -function imageaffinematrixconcat(array $m1, array $m2): array +function imageaffinematrixconcat(array $matrix1, array $matrix2): array { error_clear_last(); - $result = \imageaffinematrixconcat($m1, $m2); + $result = \imageaffinematrixconcat($matrix1, $matrix2); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -160,29 +177,25 @@ function imageaffinematrixconcat(array $m1, array $m2): array /** * Returns an affine transformation matrix. - * + * * @param int $type One of the IMG_AFFINE_* constants. * @param array|float $options If type is IMG_AFFINE_TRANSLATE * or IMG_AFFINE_SCALE, * options has to be an array with keys x * and y, both having float values. - * + * * If type is IMG_AFFINE_ROTATE, * IMG_AFFINE_SHEAR_HORIZONTAL or IMG_AFFINE_SHEAR_VERTICAL, * options has to be a float specifying the angle. * @return array{0:float,1:float,2:float,3:float,4:float,5:float} An affine transformation matrix (an array with keys * 0 to 5 and float values). * @throws ImageException - * + * */ -function imageaffinematrixget(int $type, $options = null): array +function imageaffinematrixget(int $type, $options): array { error_clear_last(); - if ($options !== null) { - $result = \imageaffinematrixget($type, $options); - } else { - $result = \imageaffinematrixget($type); - } + $result = \imageaffinematrixget($type, $options); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -201,18 +214,18 @@ function imageaffinematrixget(int $type, $options = null): array * non-blending mode, the drawing color is copied literally with its alpha channel * information, replacing the destination pixel. Blending mode is not available * when drawing on palette images. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param bool $blendmode Whether to enable the blending mode or not. On true color images + * @param bool $enable Whether to enable the blending mode or not. On true color images * the default value is TRUE otherwise the default value is FALSE * @throws ImageException - * + * */ -function imagealphablending($image, bool $blendmode): void +function imagealphablending(\GdImage $image, bool $enable): void { error_clear_last(); - $result = \imagealphablending($image, $blendmode); + $result = \imagealphablending($image, $enable); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -223,24 +236,24 @@ function imagealphablending($image, bool $blendmode): void * Activate the fast drawing antialiased methods for lines and wired polygons. * It does not support alpha components. It works using a direct blend * operation. It works only with truecolor images. - * + * * Thickness and styled are not supported. - * + * * Using antialiased primitives with transparent background color can end with * some unexpected results. The blend method uses the background color as any * other colors. The lack of alpha component support does not allow an alpha * based antialiasing method. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param bool $enabled Whether to enable antialiasing or not. + * @param bool $enable Whether to enable antialiasing or not. * @throws ImageException - * + * */ -function imageantialias($image, bool $enabled): void +function imageantialias(\GdImage $image, bool $enable): void { error_clear_last(); - $result = \imageantialias($image, $enabled); + $result = \imageantialias($image, $enable); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -250,25 +263,50 @@ function imageantialias($image, bool $enabled): void /** * imagearc draws an arc of circle centered at the given * coordinates. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $cx x-coordinate of the center. - * @param int $cy y-coordinate of the center. + * @param int $center_x x-coordinate of the center. + * @param int $center_y y-coordinate of the center. * @param int $width The arc width. * @param int $height The arc height. - * @param int $start The arc start angle, in degrees. - * @param int $end The arc end angle, in degrees. + * @param int $start_angle The arc start angle, in degrees. + * @param int $end_angle The arc end angle, in degrees. * 0° is located at the three-o'clock position, and the arc is drawn * clockwise. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * + */ +function imagearc(\GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color): void +{ + error_clear_last(); + $result = \imagearc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color); + if ($result === false) { + throw ImageException::createFromPhpError(); + } +} + + +/** + * Outputs or saves a AVIF Raster image from the given image. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, + * such as imagecreatetruecolor. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. + * @param int $quality quality is optional, and ranges from 0 (worst quality, smaller file) + * to 100 (best quality, larger file). + * If -1 is provided, the default value 30 is used. + * @param int $speed speed is optional, and ranges from 0 (slow, smaller file) + * to 10 (fast, larger file). + * If -1 is provided, the default value 6 is used. + * @throws ImageException + * */ -function imagearc($image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color): void +function imageavif(\GdImage $image, $file = null, int $quality = -1, int $speed = -1): void { error_clear_last(); - $result = \imagearc($image, $cx, $cy, $width, $height, $start, $end, $color); + $result = \imageavif($image, $file, $quality, $speed); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -277,21 +315,21 @@ function imagearc($image, int $cx, int $cy, int $width, int $height, int $start, /** * Outputs or saves a BMP version of the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param resource $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. - * + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. + * * NULL is invalid if the compressed arguments is * not used. * @param bool $compressed Whether the BMP should be compressed with run-length encoding (RLE), or not. * @throws ImageException - * + * */ -function imagebmp($image, $to = null, bool $compressed = true): void +function imagebmp( $image, $file = null, bool $compressed = true): void { error_clear_last(); - $result = \imagebmp($image, $to, $compressed); + $result = \imagebmp($image, $file, $compressed); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -300,27 +338,27 @@ function imagebmp($image, $to = null, bool $compressed = true): void /** * imagechar draws the first character of - * c in the image identified by + * char in the image identified by * image with its upper-left at * x,y (top left is 0, * 0) with the color color. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $font Can be 1, 2, 3, 4, 5 for built-in - * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or any of your - * own font identifiers registered with imageloadfont. + * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, + * returned by imageloadfont. * @param int $x x-coordinate of the start. * @param int $y y-coordinate of the start. - * @param string $c The character to draw. + * @param string $char The character to draw. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagechar($image, int $font, int $x, int $y, string $c, int $color): void +function imagechar(\GdImage $image, int $font, int $x, int $y, string $char, int $color): void { error_clear_last(); - $result = \imagechar($image, $font, $x, $y, $c, $color); + $result = \imagechar($image, $font, $x, $y, $char, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -328,25 +366,25 @@ function imagechar($image, int $font, int $x, int $y, string $c, int $color): vo /** - * Draws the character c vertically at the specified + * Draws the character char vertically at the specified * coordinate on the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $font Can be 1, 2, 3, 4, 5 for built-in - * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or any of your - * own font identifiers registered with imageloadfont. + * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, + * returned by imageloadfont. * @param int $x x-coordinate of the start. * @param int $y y-coordinate of the start. - * @param string $c The character to draw. + * @param string $char The character to draw. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagecharup($image, int $font, int $x, int $y, string $c, int $color): void +function imagecharup(\GdImage $image, int $font, int $x, int $y, string $char, int $color): void { error_clear_last(); - $result = \imagecharup($image, $font, $x, $y, $c, $color); + $result = \imagecharup($image, $font, $x, $y, $char, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -356,21 +394,21 @@ function imagecharup($image, int $font, int $x, int $y, string $c, int $color): /** * Returns the index of the color of the pixel at the * specified location in the image specified by image. - * + * * If the image is a * truecolor image, this function returns the RGB value of that pixel as * integer. Use bitshifting and masking to access the distinct red, green and blue * component values: - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x x-coordinate of the point. * @param int $y y-coordinate of the point. * @return int Returns the index of the color. * @throws ImageException - * + * */ -function imagecolorat($image, int $x, int $y): int +function imagecolorat(\GdImage $image, int $x, int $y): int { error_clear_last(); $result = \imagecolorat($image, $x, $y); @@ -382,17 +420,17 @@ function imagecolorat($image, int $x, int $y): int /** - * De-allocates a color previously allocated with + * De-allocates a color previously allocated with * imagecolorallocate or * imagecolorallocatealpha. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $color The color identifier. * @throws ImageException - * + * */ -function imagecolordeallocate($image, int $color): void +function imagecolordeallocate(\GdImage $image, int $color): void { error_clear_last(); $result = \imagecolordeallocate($image, $color); @@ -404,14 +442,14 @@ function imagecolordeallocate($image, int $color): void /** * Makes the colors of the palette version of an image more closely match the true color version. - * - * @param resource $image1 A truecolor image resource. - * @param resource $image2 A palette image resource pointing to an image that has the same + * + * @param \GdImage $image1 A truecolor image object. + * @param \GdImage $image2 A palette image object pointing to an image that has the same * size as image1. * @throws ImageException - * + * */ -function imagecolormatch($image1, $image2): void +function imagecolormatch(\GdImage $image1, \GdImage $image2): void { error_clear_last(); $result = \imagecolormatch($image1, $image2); @@ -421,22 +459,48 @@ function imagecolormatch($image1, $image2): void } +/** + * This sets the specified index in the palette to the specified + * color. This is useful for creating flood-fill-like effects in + * palleted images without the overhead of performing the actual + * flood-fill. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, + * such as imagecreatetruecolor. + * @param int $color An index in the palette. + * @param int $red Value of red component. + * @param int $green Value of green component. + * @param int $blue Value of blue component. + * @param int $alpha Value of alpha component. + * @throws ImageException + * + */ +function imagecolorset(\GdImage $image, int $color, int $red, int $green, int $blue, int $alpha = 0): void +{ + error_clear_last(); + $result = \imagecolorset($image, $color, $red, $green, $blue, $alpha); + if ($result === false) { + throw ImageException::createFromPhpError(); + } +} + + /** * Applies a convolution matrix on the image, using the given coefficient and * offset. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param array $matrix A 3x3 matrix: an array of three arrays of three floats. - * @param float $div The divisor of the result of the convolution, used for normalization. + * @param float $divisor The divisor of the result of the convolution, used for normalization. * @param float $offset Color offset. * @throws ImageException - * + * */ -function imageconvolution($image, array $matrix, float $div, float $offset): void +function imageconvolution(\GdImage $image, array $matrix, float $divisor, float $offset): void { error_clear_last(); - $result = \imageconvolution($image, $matrix, $div, $offset); + $result = \imageconvolution($image, $matrix, $divisor, $offset); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -444,29 +508,29 @@ function imageconvolution($image, array $matrix, float $div, float $offset): voi /** - * Copy a part of src_im onto - * dst_im starting at the x,y coordinates + * Copy a part of src_image onto + * dst_image starting at the x,y coordinates * src_x, src_y with - * a width of src_w and a height of - * src_h. The portion defined will be copied + * a width of src_width and a height of + * src_height. The portion defined will be copied * onto the x,y coordinates, dst_x and * dst_y. - * - * @param resource $dst_im Destination image resource. - * @param resource $src_im Source image resource. + * + * @param \GdImage $dst_image Destination image resource. + * @param \GdImage $src_image Source image resource. * @param int $dst_x x-coordinate of destination point. * @param int $dst_y y-coordinate of destination point. * @param int $src_x x-coordinate of source point. * @param int $src_y y-coordinate of source point. - * @param int $src_w Source width. - * @param int $src_h Source height. + * @param int $src_width Source width. + * @param int $src_height Source height. * @throws ImageException - * + * */ -function imagecopy($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): void +function imagecopy(\GdImage $dst_image, \GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height): void { error_clear_last(); - $result = \imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); + $result = \imagecopy($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_width, $src_height); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -474,22 +538,22 @@ function imagecopy($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $sr /** - * Copy a part of src_im onto - * dst_im starting at the x,y coordinates + * Copy a part of src_image onto + * dst_image starting at the x,y coordinates * src_x, src_y with - * a width of src_w and a height of - * src_h. The portion defined will be copied + * a width of src_width and a height of + * src_height. The portion defined will be copied * onto the x,y coordinates, dst_x and * dst_y. - * - * @param resource $dst_im Destination image resource. - * @param resource $src_im Source image resource. + * + * @param \GdImage $dst_image Destination image resource. + * @param \GdImage $src_image Source image resource. * @param int $dst_x x-coordinate of destination point. * @param int $dst_y y-coordinate of destination point. * @param int $src_x x-coordinate of source point. * @param int $src_y y-coordinate of source point. - * @param int $src_w Source width. - * @param int $src_h Source height. + * @param int $src_width Source width. + * @param int $src_height Source height. * @param int $pct The two images will be merged according to pct * which can range from 0 to 100. When pct = 0, * no action is taken, when 100 this function behaves identically @@ -497,12 +561,12 @@ function imagecopy($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $sr * ignoring alpha components, while it implements alpha transparency * for true colour images. * @throws ImageException - * + * */ -function imagecopymerge($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): void +function imagecopymerge(\GdImage $dst_image, \GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): void { error_clear_last(); - $result = \imagecopymerge($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct); + $result = \imagecopymerge($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_width, $src_height, $pct); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -510,39 +574,39 @@ function imagecopymerge($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, in /** - * imagecopymergegray copy a part of src_im onto - * dst_im starting at the x,y coordinates + * imagecopymergegray copy a part of src_image onto + * dst_image starting at the x,y coordinates * src_x, src_y with - * a width of src_w and a height of - * src_h. The portion defined will be copied + * a width of src_width and a height of + * src_height. The portion defined will be copied * onto the x,y coordinates, dst_x and * dst_y. - * + * * This function is identical to imagecopymerge except * that when merging it preserves the hue of the source by converting * the destination pixels to gray scale before the copy operation. - * - * @param resource $dst_im Destination image resource. - * @param resource $src_im Source image resource. + * + * @param \GdImage $dst_image Destination image resource. + * @param \GdImage $src_image Source image resource. * @param int $dst_x x-coordinate of destination point. * @param int $dst_y y-coordinate of destination point. * @param int $src_x x-coordinate of source point. * @param int $src_y y-coordinate of source point. - * @param int $src_w Source width. - * @param int $src_h Source height. - * @param int $pct The src_im will be changed to grayscale according - * to pct where 0 is fully grayscale and 100 is - * unchanged. When pct = 100 this function behaves + * @param int $src_width Source width. + * @param int $src_height Source height. + * @param int $pct The src_image will be changed to grayscale according + * to pct where 0 is fully grayscale and 100 is + * unchanged. When pct = 100 this function behaves * identically to imagecopy for pallete images, except for * ignoring alpha components, while * it implements alpha transparency for true colour images. * @throws ImageException - * + * */ -function imagecopymergegray($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): void +function imagecopymergegray(\GdImage $dst_image, \GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): void { error_clear_last(); - $result = \imagecopymergegray($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct); + $result = \imagecopymergegray($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_width, $src_height, $pct); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -554,15 +618,15 @@ function imagecopymergegray($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x * portion of one image to another image, smoothly interpolating pixel * values so that, in particular, reducing the size of an image still * retains a great deal of clarity. - * - * In other words, imagecopyresampled will take a - * rectangular area from src_image of width - * src_w and height src_h at - * position (src_x,src_y) - * and place it in a rectangular area of dst_image - * of width dst_w and height dst_h + * + * In other words, imagecopyresampled will take a + * rectangular area from src_image of width + * src_width and height src_height at + * position (src_x,src_y) + * and place it in a rectangular area of dst_image + * of width dst_width and height dst_height * at position (dst_x,dst_y). - * + * * If the source and destination coordinates and width and heights * differ, appropriate stretching or shrinking of the image fragment * will be performed. The coordinates refer to the upper left @@ -570,24 +634,24 @@ function imagecopymergegray($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x * same image (if dst_image is the same as * src_image) but if the regions overlap the * results will be unpredictable. - * - * @param resource $dst_image Destination image resource. - * @param resource $src_image Source image resource. + * + * @param \GdImage $dst_image Destination image resource. + * @param \GdImage $src_image Source image resource. * @param int $dst_x x-coordinate of destination point. * @param int $dst_y y-coordinate of destination point. * @param int $src_x x-coordinate of source point. * @param int $src_y y-coordinate of source point. - * @param int $dst_w Destination width. - * @param int $dst_h Destination height. - * @param int $src_w Source width. - * @param int $src_h Source height. + * @param int $dst_width Destination width. + * @param int $dst_height Destination height. + * @param int $src_width Source width. + * @param int $src_height Source height. * @throws ImageException - * + * */ -function imagecopyresampled($dst_image, $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): void +function imagecopyresampled(\GdImage $dst_image, \GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): void { error_clear_last(); - $result = \imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + $result = \imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_width, $dst_height, $src_width, $src_height); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -599,15 +663,15 @@ function imagecopyresampled($dst_image, $src_image, int $dst_x, int $dst_y, int * portion of one image to another image. * dst_image is the destination image, * src_image is the source image identifier. - * - * In other words, imagecopyresized will take a - * rectangular area from src_image of width - * src_w and height src_h at - * position (src_x,src_y) - * and place it in a rectangular area of dst_image - * of width dst_w and height dst_h + * + * In other words, imagecopyresized will take a + * rectangular area from src_image of width + * src_width and height src_height at + * position (src_x,src_y) + * and place it in a rectangular area of dst_image + * of width dst_width and height dst_height * at position (dst_x,dst_y). - * + * * If the source and destination coordinates and width and heights * differ, appropriate stretching or shrinking of the image fragment * will be performed. The coordinates refer to the upper left @@ -615,24 +679,24 @@ function imagecopyresampled($dst_image, $src_image, int $dst_x, int $dst_y, int * same image (if dst_image is the same as * src_image) but if the regions overlap the * results will be unpredictable. - * - * @param resource $dst_image Destination image resource. - * @param resource $src_image Source image resource. + * + * @param \GdImage $dst_image Destination image resource. + * @param \GdImage $src_image Source image resource. * @param int $dst_x x-coordinate of destination point. * @param int $dst_y y-coordinate of destination point. * @param int $src_x x-coordinate of source point. * @param int $src_y y-coordinate of source point. - * @param int $dst_w Destination width. - * @param int $dst_h Destination height. - * @param int $src_w Source width. - * @param int $src_h Source height. + * @param int $dst_width Destination width. + * @param int $dst_height Destination height. + * @param int $src_width Source width. + * @param int $src_height Source height. * @throws ImageException - * + * */ -function imagecopyresized($dst_image, $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): void +function imagecopyresized(\GdImage $dst_image, \GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): void { error_clear_last(); - $result = \imagecopyresized($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + $result = \imagecopyresized($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_width, $dst_height, $src_width, $src_height); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -642,7 +706,7 @@ function imagecopyresized($dst_image, $src_image, int $dst_x, int $dst_y, int $s /** * imagecreate returns an image identifier * representing a blank image of specified size. - * + * * In general, we recommend the use of * imagecreatetruecolor instead of * imagecreate so that image processing occurs on the @@ -650,12 +714,12 @@ function imagecopyresized($dst_image, $src_image, int $dst_x, int $dst_y, int $s * imagetruecolortopalette should be called immediately * before saving the image with imagepng or * imagegif. - * + * * @param int $width The image width. * @param int $height The image height. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreate(int $width, int $height) { @@ -668,14 +732,34 @@ function imagecreate(int $width, int $height) } +/** + * imagecreatefromavif returns an image object + * representing the image obtained from the given filename. + * + * @param string $filename Path to the AVIF raster image. + * @return Returns an image object on success, FALSE on errors. + * @throws ImageException + * + */ +function imagecreatefromavif(string $filename) +{ + error_clear_last(); + $result = \imagecreatefromavif($filename); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + /** * imagecreatefrombmp returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the BMP image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefrombmp(string $filename) { @@ -690,11 +774,11 @@ function imagecreatefrombmp(string $filename) /** * Create a new image from GD file or URL. - * + * * @param string $filename Path to the GD file. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromgd(string $filename) { @@ -709,11 +793,11 @@ function imagecreatefromgd(string $filename) /** * Create a new image from GD2 file or URL. - * + * * @param string $filename Path to the GD2 image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromgd2(string $filename) { @@ -728,20 +812,20 @@ function imagecreatefromgd2(string $filename) /** * Create a new image from a given part of GD2 file or URL. - * + * * @param string $filename Path to the GD2 image. - * @param int $srcX x-coordinate of source point. - * @param int $srcY y-coordinate of source point. + * @param int $x x-coordinate of source point. + * @param int $y y-coordinate of source point. * @param int $width Source width. * @param int $height Source height. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ -function imagecreatefromgd2part(string $filename, int $srcX, int $srcY, int $width, int $height) +function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, int $height) { error_clear_last(); - $result = \imagecreatefromgd2part($filename, $srcX, $srcY, $width, $height); + $result = \imagecreatefromgd2part($filename, $x, $y, $width, $height); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -752,11 +836,11 @@ function imagecreatefromgd2part(string $filename, int $srcX, int $srcY, int $wid /** * imagecreatefromgif returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the GIF image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromgif(string $filename) { @@ -772,11 +856,11 @@ function imagecreatefromgif(string $filename) /** * imagecreatefromjpeg returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the JPEG image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromjpeg(string $filename) { @@ -792,11 +876,11 @@ function imagecreatefromjpeg(string $filename) /** * imagecreatefrompng returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the PNG image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefrompng(string $filename) { @@ -809,14 +893,34 @@ function imagecreatefrompng(string $filename) } +/** + * imagecreatefromtga returns an image object + * representing the image obtained from the given filename. + * + * @param string $filename Path to the Truevision TGA image. + * @return Returns an image object on success, FALSE on errors. + * @throws ImageException + * + */ +function imagecreatefromtga(string $filename) +{ + error_clear_last(); + $result = \imagecreatefromtga($filename); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + /** * imagecreatefromwbmp returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the WBMP image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromwbmp(string $filename) { @@ -832,11 +936,12 @@ function imagecreatefromwbmp(string $filename) /** * imagecreatefromwebp returns an image identifier * representing the image obtained from the given filename. - * + * Note that animated WebP files cannot be read. + * * @param string $filename Path to the WebP image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromwebp(string $filename) { @@ -852,11 +957,11 @@ function imagecreatefromwebp(string $filename) /** * imagecreatefromxbm returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the XBM image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromxbm(string $filename) { @@ -872,11 +977,11 @@ function imagecreatefromxbm(string $filename) /** * imagecreatefromxpm returns an image identifier * representing the image obtained from the given filename. - * + * * @param string $filename Path to the XPM image. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatefromxpm(string $filename) { @@ -890,14 +995,14 @@ function imagecreatefromxpm(string $filename) /** - * imagecreatetruecolor returns an image identifier + * imagecreatetruecolor returns an image object * representing a black image of the specified size. - * + * * @param int $width Image width. * @param int $height Image height. - * @return resource Returns an image resource identifier on success, FALSE on errors. + * @return resource Returns an image object on success, FALSE on errors. * @throws ImageException - * + * */ function imagecreatetruecolor(int $width, int $height) { @@ -913,20 +1018,20 @@ function imagecreatetruecolor(int $width, int $height) /** * Crops an image to the given rectangular area and returns the resulting image. * The given image is not modified. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param array $rect The cropping rectangle as array with keys + * @param array $rectangle The cropping rectangle as array with keys * x, y, width and * height. - * @return resource Return cropped image resource on success. + * @return resource Return cropped image object on success. * @throws ImageException - * + * */ -function imagecrop($image, array $rect) +function imagecrop(\GdImage $image, array $rectangle) { error_clear_last(); - $result = \imagecrop($image, $rect); + $result = \imagecrop($image, $rectangle); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -937,18 +1042,18 @@ function imagecrop($image, array $rect) /** * Automatically crops an image according to the given * mode. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $mode One of the following constants: - * @param float $threshold - * @param int $color - * @return resource Returns a cropped image resource on success. + * @param float $threshold + * @param int $color + * @return resource Returns a cropped image object on success. * If the complete image was cropped, imagecrop returns FALSE. * @throws ImageException - * + * */ -function imagecropauto($image, int $mode = IMG_CROP_DEFAULT, float $threshold = .5, int $color = -1) +function imagecropauto(\GdImage $image, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) { error_clear_last(); $result = \imagecropauto($image, $mode, $threshold, $color); @@ -963,8 +1068,8 @@ function imagecropauto($image, int $mode = IMG_CROP_DEFAULT, float $threshold = * This function is deprecated. Use combination of * imagesetstyle and imageline * instead. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x1 Upper left x coordinate. * @param int $y1 Upper left y coordinate 0, 0 is the top left corner of the image. @@ -972,9 +1077,9 @@ function imagecropauto($image, int $mode = IMG_CROP_DEFAULT, float $threshold = * @param int $y2 Bottom right y coordinate. * @param int $color The fill color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagedashedline($image, int $x1, int $y1, int $x2, int $y2, int $color): void +function imagedashedline(\GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void { error_clear_last(); $result = \imagedashedline($image, $x1, $y1, $x2, $y2, $color); @@ -985,15 +1090,15 @@ function imagedashedline($image, int $x1, int $y1, int $x2, int $y2, int $color) /** - * imagedestroy frees any memory associated + * Prior to PHP 8.0.0, imagedestroy freed any memory associated * with image image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @throws ImageException - * + * */ -function imagedestroy($image): void +function imagedestroy(\GdImage $image): void { error_clear_last(); $result = \imagedestroy($image); @@ -1005,21 +1110,21 @@ function imagedestroy($image): void /** * Draws an ellipse centered at the specified coordinates. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $cx x-coordinate of the center. - * @param int $cy y-coordinate of the center. + * @param int $center_x x-coordinate of the center. + * @param int $center_y y-coordinate of the center. * @param int $width The ellipse width. * @param int $height The ellipse height. * @param int $color The color of the ellipse. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imageellipse($image, int $cx, int $cy, int $width, int $height, int $color): void +function imageellipse(\GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): void { error_clear_last(); - $result = \imageellipse($image, $cx, $cy, $width, $height, $color); + $result = \imageellipse($image, $center_x, $center_y, $width, $height, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1030,16 +1135,16 @@ function imageellipse($image, int $cx, int $cy, int $width, int $height, int $co * Performs a flood fill starting at the given coordinate (top left is 0, 0) * with the given color in the * image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x x-coordinate of start point. * @param int $y y-coordinate of start point. * @param int $color The fill color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagefill($image, int $x, int $y, int $color): void +function imagefill(\GdImage $image, int $x, int $y, int $color): void { error_clear_last(); $result = \imagefill($image, $x, $y, $color); @@ -1052,25 +1157,25 @@ function imagefill($image, int $x, int $y, int $color): void /** * Draws a partial arc centered at the specified coordinate in the * given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $cx x-coordinate of the center. - * @param int $cy y-coordinate of the center. + * @param int $center_x x-coordinate of the center. + * @param int $center_y y-coordinate of the center. * @param int $width The arc width. * @param int $height The arc height. - * @param int $start The arc start angle, in degrees. - * @param int $end The arc end angle, in degrees. + * @param int $start_angle The arc start angle, in degrees. + * @param int $end_angle The arc end angle, in degrees. * 0° is located at the three-o'clock position, and the arc is drawn * clockwise. * @param int $color A color identifier created with imagecolorallocate. * @param int $style A bitwise OR of the following possibilities: - * + * * IMG_ARC_PIE * IMG_ARC_CHORD * IMG_ARC_NOFILL * IMG_ARC_EDGED - * + * * IMG_ARC_PIE and IMG_ARC_CHORD are * mutually exclusive; IMG_ARC_CHORD just * connects the starting and ending angles with a straight line, while @@ -1081,12 +1186,12 @@ function imagefill($image, int $x, int $y, int $color): void * beginning and ending angles should be connected to the center - this is a * good way to outline (rather than fill) a 'pie slice'. * @throws ImageException - * + * */ -function imagefilledarc($image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color, int $style): void +function imagefilledarc(\GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color, int $style): void { error_clear_last(); - $result = \imagefilledarc($image, $cx, $cy, $width, $height, $start, $end, $color, $style); + $result = \imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1096,44 +1201,21 @@ function imagefilledarc($image, int $cx, int $cy, int $width, int $height, int $ /** * Draws an ellipse centered at the specified coordinate on the given * image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $cx x-coordinate of the center. - * @param int $cy y-coordinate of the center. + * @param int $center_x x-coordinate of the center. + * @param int $center_y y-coordinate of the center. * @param int $width The ellipse width. * @param int $height The ellipse height. * @param int $color The fill color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagefilledellipse($image, int $cx, int $cy, int $width, int $height, int $color): void +function imagefilledellipse(\GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): void { error_clear_last(); - $result = \imagefilledellipse($image, $cx, $cy, $width, $height, $color); - if ($result === false) { - throw ImageException::createFromPhpError(); - } -} - - -/** - * imagefilledpolygon creates a filled polygon - * in the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, - * such as imagecreatetruecolor. - * @param array $points An array containing the x and y - * coordinates of the polygons vertices consecutively. - * @param int $num_points Total number of points (vertices), which must be at least 3. - * @param int $color A color identifier created with imagecolorallocate. - * @throws ImageException - * - */ -function imagefilledpolygon($image, array $points, int $num_points, int $color): void -{ - error_clear_last(); - $result = \imagefilledpolygon($image, $points, $num_points, $color); + $result = \imagefilledellipse($image, $center_x, $center_y, $width, $height, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1144,8 +1226,8 @@ function imagefilledpolygon($image, array $points, int $num_points, int $color): * Creates a rectangle filled with color in the given * image starting at point 1 and ending at point 2. * 0, 0 is the top left corner of the image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x1 x-coordinate for point 1. * @param int $y1 y-coordinate for point 1. @@ -1153,9 +1235,9 @@ function imagefilledpolygon($image, array $points, int $num_points, int $color): * @param int $y2 y-coordinate for point 2. * @param int $color The fill color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagefilledrectangle($image, int $x1, int $y1, int $x2, int $y2, int $color): void +function imagefilledrectangle(\GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void { error_clear_last(); $result = \imagefilledrectangle($image, $x1, $y1, $x2, $y2, $color); @@ -1167,24 +1249,24 @@ function imagefilledrectangle($image, int $x1, int $y1, int $x2, int $y2, int $c /** * imagefilltoborder performs a flood fill - * whose border color is defined by border. + * whose border color is defined by border_color. * The starting point for the fill is x, * y (top left is 0, 0) and the region is * filled with color color. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x x-coordinate of start. * @param int $y y-coordinate of start. - * @param int $border The border color. A color identifier created with imagecolorallocate. + * @param int $border_color The border color. A color identifier created with imagecolorallocate. * @param int $color The fill color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagefilltoborder($image, int $x, int $y, int $border, int $color): void +function imagefilltoborder(\GdImage $image, int $x, int $y, int $border_color, int $color): void { error_clear_last(); - $result = \imagefilltoborder($image, $x, $y, $border, $color); + $result = \imagefilltoborder($image, $x, $y, $border_color, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1193,194 +1275,144 @@ function imagefilltoborder($image, int $x, int $y, int $border, int $color): voi /** * imagefilter applies the given filter - * filtertype on the image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * filter on the image. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $filtertype filtertype can be one of the following: - * - * - * + * @param int $filter filter can be one of the following: + * + * + * * IMG_FILTER_NEGATE: Reverses all colors of * the image. - * - * - * - * + * + * + * + * * IMG_FILTER_GRAYSCALE: Converts the image into * grayscale by changing the red, green and blue components to their * weighted sum using the same coefficients as the REC.601 luma (Y') * calculation. The alpha components are retained. For palette images the * result may differ due to palette limitations. - * - * - * - * + * + * + * + * * IMG_FILTER_BRIGHTNESS: Changes the brightness - * of the image. Use arg1 to set the level of + * of the image. Use args to set the level of * brightness. The range for the brightness is -255 to 255. - * - * - * - * + * + * + * + * * IMG_FILTER_CONTRAST: Changes the contrast of - * the image. Use arg1 to set the level of + * the image. Use args to set the level of * contrast. - * - * - * - * + * + * + * + * * IMG_FILTER_COLORIZE: Like * IMG_FILTER_GRAYSCALE, except you can specify the - * color. Use arg1, arg2 and + * color. Use args, arg2 and * arg3 in the form of * red, green, * blue and arg4 for the * alpha channel. The range for each color is 0 to 255. - * - * - * - * + * + * + * + * * IMG_FILTER_EDGEDETECT: Uses edge detection to * highlight the edges in the image. - * - * - * - * + * + * + * + * * IMG_FILTER_EMBOSS: Embosses the image. - * - * - * - * + * + * + * + * * IMG_FILTER_GAUSSIAN_BLUR: Blurs the image using * the Gaussian method. - * - * - * - * + * + * + * + * * IMG_FILTER_SELECTIVE_BLUR: Blurs the image. - * - * - * - * + * + * + * + * * IMG_FILTER_MEAN_REMOVAL: Uses mean removal to * achieve a "sketchy" effect. - * - * - * - * + * + * + * + * * IMG_FILTER_SMOOTH: Makes the image smoother. - * Use arg1 to set the level of smoothness. - * - * - * - * - * IMG_FILTER_PIXELATE: Applies pixelation effect - * to the image, use arg1 to set the block size + * Use args to set the level of smoothness. + * + * + * + * + * IMG_FILTER_PIXELATE: Applies pixelation effect + * to the image, use args to set the block size * and arg2 to set the pixelation effect mode. - * - * - * - * - * IMG_FILTER_SCATTER: Applies scatter effect - * to the image, use arg1 and - * arg2 to define the effect strength and - * additionally arg3 to only apply the + * + * + * + * + * IMG_FILTER_SCATTER: Applies scatter effect + * to the image, use args and + * arg2 to define the effect strength and + * additionally arg3 to only apply the * on select pixel colors. - * - * - * - * @param int $arg1 - * - * + * + * + * + * @param $args + * + * * IMG_FILTER_BRIGHTNESS: Brightness level. - * - * - * - * + * + * + * + * * IMG_FILTER_CONTRAST: Contrast level. - * - * - * - * + * + * + * + * * IMG_FILTER_COLORIZE: Value of red component. - * - * - * - * + * + * + * + * * IMG_FILTER_SMOOTH: Smoothness level. - * - * - * - * + * + * + * + * * IMG_FILTER_PIXELATE: Block size in pixels. - * - * - * - * - * IMG_FILTER_SCATTER: Effect substraction level. - * This must not be higher or equal to the addition level set with + * + * + * + * + * IMG_FILTER_SCATTER: Effect substraction level. + * This must not be higher or equal to the addition level set with * arg2. - * - * - * - * @param int $arg2 - * - * - * IMG_FILTER_COLORIZE: Value of green component. - * - * - * - * - * IMG_FILTER_PIXELATE: Whether to use advanced pixelation - * effect or not (defaults to FALSE). - * - * - * - * - * IMG_FILTER_SCATTER: Effect addition level. - * - * - * - * @param int $arg3 - * - * - * IMG_FILTER_COLORIZE: Value of blue component. - * - * - * - * - * IMG_FILTER_SCATTER: Optional array indexed color values - * to apply effect at. - * - * - * - * @param int $arg4 - * - * - * IMG_FILTER_COLORIZE: Alpha channel, A value - * between 0 and 127. 0 indicates completely opaque while 127 indicates - * completely transparent. - * - * - * - * @throws ImageException - * - */ -function imagefilter($image, int $filtertype, int $arg1 = null, int $arg2 = null, int $arg3 = null, int $arg4 = null): void -{ - error_clear_last(); - if ($arg4 !== null) { - $result = \imagefilter($image, $filtertype, $arg1, $arg2, $arg3, $arg4); - } elseif ($arg3 !== null) { - $result = \imagefilter($image, $filtertype, $arg1, $arg2, $arg3); - } elseif ($arg2 !== null) { - $result = \imagefilter($image, $filtertype, $arg1, $arg2); - } elseif ($arg1 !== null) { - $result = \imagefilter($image, $filtertype, $arg1); - } else { - $result = \imagefilter($image, $filtertype); - } + * + * + * + * @throws ImageException + * + */ +function imagefilter(\GdImage $image, int $filter, $args): void +{ + error_clear_last(); + $result = \imagefilter($image, $filter, $args); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1390,45 +1422,45 @@ function imagefilter($image, int $filtertype, int $arg1 = null, int $arg2 = null /** * Flips the image image using the given * mode. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $mode Flip mode, this can be one of the IMG_FLIP_* constants: - * - * - * - * - * + * + * + * + * + * * Constant * Meaning - * - * - * - * + * + * + * + * * IMG_FLIP_HORIZONTAL - * + * * Flips the image horizontally. - * - * - * + * + * + * * IMG_FLIP_VERTICAL - * + * * Flips the image vertically. - * - * - * + * + * + * * IMG_FLIP_BOTH - * + * * Flips the image both horizontally and vertically. - * - * - * - * - * + * + * + * + * + * * @throws ImageException - * + * */ -function imageflip($image, int $mode): void +function imageflip(\GdImage $image, int $mode): void { error_clear_last(); $result = \imageflip($image, $mode); @@ -1439,20 +1471,221 @@ function imageflip($image, int $mode): void /** - * Applies gamma correction to the given gd image + * This function calculates and returns the bounding box in pixels + * for a FreeType text. + * + * @param float $size The font size in points. + * @param float $angle Angle in degrees in which string will be + * measured. + * @param string $font_filename The name of the TrueType font file (can be a URL). Depending on + * which version of the GD library that PHP is using, it may attempt to + * search for files that do not begin with a leading '/' by appending + * '.ttf' to the filename and searching along a library-defined font path. + * @param string $string The string to be measured. + * @param array $options + * Possible array indexes for options + * + * + * + * Key + * Type + * Meaning + * + * + * + * + * linespacing + * float + * Defines drawing linespacing + * + * + * + * + * @return array imageftbbox returns an array with 8 + * elements representing four points making the bounding box of the + * text: + * + * + * + * + * 0 + * lower left corner, X position + * + * + * 1 + * lower left corner, Y position + * + * + * 2 + * lower right corner, X position + * + * + * 3 + * lower right corner, Y position + * + * + * 4 + * upper right corner, X position + * + * + * 5 + * upper right corner, Y position + * + * + * 6 + * upper left corner, X position + * + * + * 7 + * upper left corner, Y position + * + * + * + * + * + * The points are relative to the text regardless of the + * angle, so "upper left" means in the top left-hand + * corner seeing the text horizontally. + * + * On failure, FALSE is returned. + * @throws ImageException + * + */ +function imageftbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array +{ + error_clear_last(); + $result = \imageftbbox($size, $angle, $font_filename, $string, $options); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, + * such as imagecreatetruecolor. + * @param float $size The font size to use in points. + * @param float $angle The angle in degrees, with 0 degrees being left-to-right reading text. + * Higher values represent a counter-clockwise rotation. For example, a + * value of 90 would result in bottom-to-top reading text. + * @param int $x The coordinates given by x and + * y will define the basepoint of the first + * character (roughly the lower-left corner of the character). This + * is different from the imagestring, where + * x and y define the + * upper-left corner of the first character. For example, "top left" + * is 0, 0. + * @param int $y The y-ordinate. This sets the position of the fonts baseline, not the + * very bottom of the character. + * @param int $color The index of the desired color for the text, see + * imagecolorexact. + * @param string $font_filename The path to the TrueType font you wish to use. + * + * Depending on which version of the GD library PHP is using, when + * font_filename does not begin with a leading + * / then .ttf will be appended + * to the filename and the library will attempt to search for that + * filename along a library-defined font path. + * + * In many cases where a font resides in the same directory as the script using it + * the following trick will alleviate any include problems. + * + * + * ]]> + * + * @param string $text Text to be inserted into image. + * @param array $options + * Possible array indexes for options + * + * + * + * Key + * Type + * Meaning + * + * + * + * + * linespacing + * float + * Defines drawing linespacing + * + * + * + * + * @return array This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise: + * + * + * + * + * 0 + * lower left x-coordinate + * + * + * 1 + * lower left y-coordinate + * + * + * 2 + * lower right x-coordinate + * + * + * 3 + * lower right y-coordinate + * + * + * 4 + * upper right x-coordinate + * + * + * 5 + * upper right y-coordinate + * + * + * 6 + * upper left x-coordinate + * + * + * 7 + * upper left y-coordinate + * + * + * + * + * + * On failure, FALSE is returned. + * @throws ImageException + * + */ +function imagefttext(\GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array +{ + error_clear_last(); + $result = \imagefttext($image, $size, $angle, $x, $y, $color, $font_filename, $text, $options); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + +/** + * Applies gamma correction to the given gd image * given an input and an output gamma. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param float $inputgamma The input gamma. - * @param float $outputgamma The output gamma. + * @param float $input_gamma The input gamma. + * @param float $output_gamma The output gamma. * @throws ImageException - * + * */ -function imagegammacorrect($image, float $inputgamma, float $outputgamma): void +function imagegammacorrect(\GdImage $image, float $input_gamma, float $output_gamma): void { error_clear_last(); - $result = \imagegammacorrect($image, $inputgamma, $outputgamma); + $result = \imagegammacorrect($image, $input_gamma, $output_gamma); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1460,18 +1693,18 @@ function imagegammacorrect($image, float $inputgamma, float $outputgamma): void /** - * Outputs a GD image to the given to. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * Outputs a GD image to the given file. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. * @throws ImageException - * + * */ -function imagegd($image, $to = null): void +function imagegd(\GdImage $image, $file = null): void { error_clear_last(); - $result = \imagegd($image, $to); + $result = \imagegd($image, $file); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1479,22 +1712,22 @@ function imagegd($image, $to = null): void /** - * Outputs a GD2 image to the given to. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * Outputs a GD2 image to the given file. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. * @param int $chunk_size Chunk size. - * @param int $type Either IMG_GD2_RAW or - * IMG_GD2_COMPRESSED. Default is + * @param int $mode Either IMG_GD2_RAW or + * IMG_GD2_COMPRESSED. Default is * IMG_GD2_RAW. * @throws ImageException - * + * */ -function imagegd2($image, $to = null, int $chunk_size = 128, int $type = IMG_GD2_RAW): void +function imagegd2(\GdImage $image, $file = null, int $chunk_size = 128, int $mode = IMG_GD2_RAW): void { error_clear_last(); - $result = \imagegd2($image, $to, $chunk_size, $type); + $result = \imagegd2($image, $file, $chunk_size, $mode); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1503,26 +1736,26 @@ function imagegd2($image, $to = null, int $chunk_size = 128, int $type = IMG_GD2 /** * imagegif creates the GIF - * file in to from the image image. The + * file in file from the image image. The * image argument is the return from the * imagecreate or imagecreatefrom* * function. - * + * * The image format will be GIF87a unless the * image has been made transparent with * imagecolortransparent, in which case the * image format will be GIF89a. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. * @throws ImageException - * + * */ -function imagegif($image, $to = null): void +function imagegif(\GdImage $image, $file = null): void { error_clear_last(); - $result = \imagegif($image, $to); + $result = \imagegif($image, $file); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1531,10 +1764,10 @@ function imagegif($image, $to = null): void /** * Grabs a screenshot of the whole screen. - * - * @return resource Returns an image resource identifier on success, FALSE on failure. + * + * @return resource Returns an image object on success, FALSE on failure. * @throws ImageException - * + * */ function imagegrabscreen() { @@ -1549,17 +1782,17 @@ function imagegrabscreen() /** * Grabs a window or its client area using a windows handle (HWND property in COM instance) - * - * @param int $window_handle The HWND window ID. + * + * @param int $handle The HWND window ID. * @param int $client_area Include the client area of the application window. - * @return resource Returns an image resource identifier on success, FALSE on failure. + * @return resource Returns an image object on success, FALSE on failure. * @throws ImageException - * + * */ -function imagegrabwindow(int $window_handle, int $client_area = 0) +function imagegrabwindow(int $handle, int $client_area = false) { error_clear_last(); - $result = \imagegrabwindow($window_handle, $client_area); + $result = \imagegrabwindow($handle, $client_area); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1570,20 +1803,20 @@ function imagegrabwindow(int $window_handle, int $client_area = 0) /** * imagejpeg creates a JPEG file from * the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. * @param int $quality quality is optional, and ranges from 0 (worst - * quality, smaller file) to 100 (best quality, biggest file). The + * quality, smaller file) to 100 (best quality, biggest file). The * default (-1) uses the default IJG quality value (about 75). * @throws ImageException - * + * */ -function imagejpeg($image, $to = null, int $quality = -1): void +function imagejpeg(\GdImage $image, $file = null, int $quality = -1): void { error_clear_last(); - $result = \imagejpeg($image, $to, $quality); + $result = \imagejpeg($image, $file, $quality); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1592,60 +1825,60 @@ function imagejpeg($image, $to = null, int $quality = -1): void /** * Set the alpha blending flag to use layering effects. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $effect One of the following constants: - * - * + * + * * IMG_EFFECT_REPLACE - * - * + * + * * Use pixel replacement (equivalent of passing TRUE to * imagealphablending) - * - * - * - * + * + * + * + * * IMG_EFFECT_ALPHABLEND - * - * + * + * * Use normal pixel blending (equivalent of passing FALSE to * imagealphablending) - * - * - * - * + * + * + * + * * IMG_EFFECT_NORMAL - * - * + * + * * Same as IMG_EFFECT_ALPHABLEND. - * - * - * - * + * + * + * + * * IMG_EFFECT_OVERLAY - * - * + * + * * Overlay has the effect that black background pixels will remain * black, white background pixels will remain white, but grey * background pixels will take the colour of the foreground pixel. - * - * - * - * + * + * + * + * * IMG_EFFECT_MULTIPLY - * - * + * + * * Overlays with a multiply effect. - * - * - * - * + * + * + * + * * @throws ImageException - * + * */ -function imagelayereffect($image, int $effect): void +function imagelayereffect(\GdImage $image, int $effect): void { error_clear_last(); $result = \imagelayereffect($image, $effect); @@ -1657,8 +1890,8 @@ function imagelayereffect($image, int $effect): void /** * Draws a line between the two given points. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x1 x-coordinate for first point. * @param int $y1 y-coordinate for first point. @@ -1666,9 +1899,9 @@ function imagelayereffect($image, int $effect): void * @param int $y2 y-coordinate for second point. * @param int $color The line color. A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imageline($image, int $x1, int $y1, int $x2, int $y2, int $color): void +function imageline(\GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void { error_clear_last(); $result = \imageline($image, $x1, $y1, $x2, $y2, $color); @@ -1681,64 +1914,63 @@ function imageline($image, int $x1, int $y1, int $x2, int $y2, int $color): void /** * imageloadfont loads a user-defined bitmap and returns * its identifier. - * - * @param string $file The font file format is currently binary and architecture + * + * @param string $filename The font file format is currently binary and architecture * dependent. This means you should generate the font files on the * same type of CPU as the machine you are running PHP on. - * - * + * + * * Font file format - * - * - * + * + * + * * byte position * C data type * description - * - * - * - * + * + * + * + * * byte 0-3 * int * number of characters in the font - * - * + * + * * byte 4-7 * int - * + * * value of first character in the font (often 32 for space) - * - * - * + * + * + * * byte 8-11 * int * pixel width of each character - * - * + * + * * byte 12-15 * int * pixel height of each character - * - * + * + * * byte 16- * char - * + * * array with character data, one byte per pixel in each * character, for a total of (nchars*width*height) bytes. - * - * - * - * - * - * @return int The font identifier which is always bigger than 5 to avoid conflicts with - * built-in fontss. + * + * + * + * + * + * @return int Returns an GdFont instance. * @throws ImageException - * + * */ -function imageloadfont(string $file): int +function imageloadfont(string $filename): int { error_clear_last(); - $result = \imageloadfont($file); + $result = \imageloadfont($filename); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1747,76 +1979,31 @@ function imageloadfont(string $file): int /** - * imageopenpolygon draws an open polygon on the given - * image. Contrary to imagepolygon, - * no line is drawn between the last and the first point. - * - * @param resource $image An image resource, returned by one of the image creation functions, - * such as imagecreatetruecolor. - * @param array $points An array containing the polygon's vertices, e.g.: - * - * - * - * - * points[0] - * = x0 - * - * - * points[1] - * = y0 - * - * - * points[2] - * = x1 - * - * - * points[3] - * = y1 - * - * - * - * - * @param int $num_points Total number of points (vertices), which must be at least 3. - * @param int $color A color identifier created with imagecolorallocate. - * @throws ImageException - * - */ -function imageopenpolygon($image, array $points, int $num_points, int $color): void -{ - error_clear_last(); - $result = \imageopenpolygon($image, $points, $num_points, $color); - if ($result === false) { - throw ImageException::createFromPhpError(); - } -} - - -/** - * Outputs or saves a PNG image from the given + * Outputs or saves a PNG image from the given * image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. - * + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. + * * NULL is invalid if the quality and * filters arguments are not used. * @param int $quality Compression level: from 0 (no compression) to 9. * The default (-1) uses the zlib compression default. * For more information see the zlib manual. * @param int $filters Allows reducing the PNG file size. It is a bitmask field which may be - * set to any combination of the PNG_FILTER_XXX - * constants. PNG_NO_FILTER or + * set to any combination of the PNG_FILTER_XXX + * constants. PNG_NO_FILTER or * PNG_ALL_FILTERS may also be used to respectively * disable or activate all filters. * The default value (-1) disables filtering. * @throws ImageException - * + * */ -function imagepng($image, $to = null, int $quality = -1, int $filters = -1): void +function imagepng(\GdImage $image, $file = null, int $quality = -1, int $filters = -1): void { error_clear_last(); - $result = \imagepng($image, $to, $quality, $filters); + $result = \imagepng($image, $file, $quality, $filters); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1824,43 +2011,24 @@ function imagepng($image, $to = null, int $quality = -1, int $filters = -1): voi /** - * imagepolygon creates a polygon in the given - * image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * imagerectangle creates a rectangle starting at + * the specified coordinates. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param array $points An array containing the polygon's vertices, e.g.: - * - * - * - * - * points[0] - * = x0 - * - * - * points[1] - * = y0 - * - * - * points[2] - * = x1 - * - * - * points[3] - * = y1 - * - * - * - * - * @param int $num_points Total number of points (vertices), which must be at least 3. + * @param int $x1 Upper left x coordinate. + * @param int $y1 Upper left y coordinate + * 0, 0 is the top left corner of the image. + * @param int $x2 Bottom right x coordinate. + * @param int $y2 Bottom right y coordinate. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagepolygon($image, array $points, int $num_points, int $color): void +function imagerectangle(\GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void { error_clear_last(); - $result = \imagepolygon($image, $points, $num_points, $color); + $result = \imagerectangle($image, $x1, $y1, $x2, $y2, $color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1868,51 +2036,62 @@ function imagepolygon($image, array $points, int $num_points, int $color): void /** - * imagerectangle creates a rectangle starting at - * the specified coordinates. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * imageresolution allows to set and get the resolution of + * an image in DPI (dots per inch). If the optional parameters are NULL, + * the current resolution is returned as an indexed array. If only + * resolution_x is not NULL, the horizontal and vertical resolution + * are set to this value. If none of the optional parameters are NULL, the horizontal + * and vertical resolution are set to these values, respectively. + * + * The resolution is only used as meta information when images are read from and + * written to formats supporting this kind of information (curently PNG and + * JPEG). It does not affect any drawing operations. The default resolution + * for new images is 96 DPI. + * + * @param resource $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $x1 Upper left x coordinate. - * @param int $y1 Upper left y coordinate - * 0, 0 is the top left corner of the image. - * @param int $x2 Bottom right x coordinate. - * @param int $y2 Bottom right y coordinate. - * @param int $color A color identifier created with imagecolorallocate. + * @param $resolution_x The horizontal resolution in DPI. + * @param $resolution_y The vertical resolution in DPI. + * @return mixed When used as getter, + * it returns an indexed array of the horizontal and vertical resolution on + * success. + * When used as setter, it returns + * TRUE on success. * @throws ImageException - * + * */ -function imagerectangle($image, int $x1, int $y1, int $x2, int $y2, int $color): void +function imageresolution( $image, $resolution_x = null, $resolution_y = null) { error_clear_last(); - $result = \imagerectangle($image, $x1, $y1, $x2, $y2, $color); + $result = \imageresolution($image, $resolution_x, $resolution_y); if ($result === false) { throw ImageException::createFromPhpError(); } + return $result; } /** * Rotates the image image using the given * angle in degrees. - * + * * The center of rotation is the center of the image, and the rotated * image may have different dimensions than the original image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param float $angle Rotation angle, in degrees. The rotation angle is interpreted as the * number of degrees to rotate the image anticlockwise. - * @param int $bgd_color Specifies the color of the uncovered zone after the rotation - * @param int $dummy This parameter is unused. - * @return resource Returns an image resource for the rotated image. + * @param int $background_color Specifies the color of the uncovered zone after the rotation + * @param bool $ignore_transparent This parameter is unused. + * @return resource Returns an image object for the rotated image. * @throws ImageException - * + * */ -function imagerotate($image, float $angle, int $bgd_color, int $dummy = 0) +function imagerotate(\GdImage $image, float $angle, int $background_color, bool $ignore_transparent = false) { error_clear_last(); - $result = \imagerotate($image, $angle, $bgd_color, $dummy); + $result = \imagerotate($image, $angle, $background_color, $ignore_transparent); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1924,20 +2103,20 @@ function imagerotate($image, float $angle, int $bgd_color, int $dummy = 0) * imagesavealpha sets the flag which determines whether to retain * full alpha channel information (as opposed to single-color transparency) * when saving PNG images. - * + * * Alphablending has to be disabled (imagealphablending($im, false)) * to retain the alpha-channel in the first place. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param bool $saveflag Whether to save the alpha channel or not. Defaults to FALSE. + * @param bool $enable Whether to save the alpha channel or not. Defaults to FALSE. * @throws ImageException - * + * */ -function imagesavealpha($image, bool $saveflag): void +function imagesavealpha(\GdImage $image, bool $enable): void { error_clear_last(); - $result = \imagesavealpha($image, $saveflag); + $result = \imagesavealpha($image, $enable); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1947,30 +2126,30 @@ function imagesavealpha($image, bool $saveflag): void /** * imagescale scales an image using the given * interpolation algorithm. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param int $new_width The width to scale the image to. - * @param int $new_height The height to scale the image to. If omitted or negative, the aspect + * @param int $width The width to scale the image to. + * @param int $height The height to scale the image to. If omitted or negative, the aspect * ratio will be preserved. * @param int $mode One of IMG_NEAREST_NEIGHBOUR, * IMG_BILINEAR_FIXED, * IMG_BICUBIC, * IMG_BICUBIC_FIXED or anything else (will use two * pass). - * - * + * + * * IMG_WEIGHTED4 is not yet supported. - * - * - * @return resource Return the scaled image resource on success. + * + * + * @return resource Return the scaled image object on success. * @throws ImageException - * + * */ -function imagescale($image, int $new_width, int $new_height = -1, int $mode = IMG_BILINEAR_FIXED) +function imagescale(\GdImage $image, int $width, int $height = -1, int $mode = IMG_BILINEAR_FIXED) { error_clear_last(); - $result = \imagescale($image, $new_width, $new_height, $mode); + $result = \imagescale($image, $width, $height, $mode); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -1984,14 +2163,14 @@ function imagescale($image, int $new_width, int $new_height = -1, int $mode = IM * and imagepolygon) when drawing with the special * colors IMG_COLOR_BRUSHED or * IMG_COLOR_STYLEDBRUSHED. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param resource $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param resource $brush An image resource. + * @param resource $brush An image object. * @throws ImageException - * + * */ -function imagesetbrush($image, $brush): void +function imagesetbrush( $image, $brush): void { error_clear_last(); $result = \imagesetbrush($image, $brush); @@ -2004,20 +2183,20 @@ function imagesetbrush($image, $brush): void /** * imagesetclip sets the current clipping rectangle, i.e. * the area beyond which no pixels will be drawn. - * - * @param resource $im An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x1 The x-coordinate of the upper left corner. * @param int $y1 The y-coordinate of the upper left corner. * @param int $x2 The x-coordinate of the lower right corner. * @param int $y2 The y-coordinate of the lower right corner. * @throws ImageException - * + * */ -function imagesetclip($im, int $x1, int $y1, int $x2, int $y2): void +function imagesetclip(\GdImage $image, int $x1, int $y1, int $x2, int $y2): void { error_clear_last(); - $result = \imagesetclip($im, $x1, $y1, $x2, $y2); + $result = \imagesetclip($image, $x1, $y1, $x2, $y2); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2025,123 +2204,123 @@ function imagesetclip($im, int $x1, int $y1, int $x2, int $y2): void /** - * Sets the interpolation method, setting an interpolation method affects the rendering + * Sets the interpolation method, setting an interpolation method affects the rendering * of various functions in GD, such as the imagerotate function. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $method The interpolation method, which can be one of the following: - * - * - * + * + * + * * IMG_BELL: Bell filter. - * - * - * - * + * + * + * + * * IMG_BESSEL: Bessel filter. - * - * - * - * + * + * + * + * * IMG_BICUBIC: Bicubic interpolation. - * - * - * - * + * + * + * + * * IMG_BICUBIC_FIXED: Fixed point implementation of the bicubic interpolation. - * - * - * - * + * + * + * + * * IMG_BILINEAR_FIXED: Fixed point implementation of the bilinear interpolation (default (also on image creation)). - * - * - * - * + * + * + * + * * IMG_BLACKMAN: Blackman window function. - * - * - * - * + * + * + * + * * IMG_BOX: Box blur filter. - * - * - * - * + * + * + * + * * IMG_BSPLINE: Spline interpolation. - * - * - * - * + * + * + * + * * IMG_CATMULLROM: Cubic Hermite spline interpolation. - * - * - * - * + * + * + * + * * IMG_GAUSSIAN: Gaussian function. - * - * - * - * + * + * + * + * * IMG_GENERALIZED_CUBIC: Generalized cubic spline fractal interpolation. - * - * - * - * + * + * + * + * * IMG_HERMITE: Hermite interpolation. - * - * - * - * + * + * + * + * * IMG_HAMMING: Hamming filter. - * - * - * - * + * + * + * + * * IMG_HANNING: Hanning filter. - * - * - * - * + * + * + * + * * IMG_MITCHELL: Mitchell filter. - * - * - * - * + * + * + * + * * IMG_POWER: Power interpolation. - * - * - * - * + * + * + * + * * IMG_QUADRATIC: Inverse quadratic interpolation. - * - * - * - * + * + * + * + * * IMG_SINC: Sinc function. - * - * - * - * + * + * + * + * * IMG_NEAREST_NEIGHBOUR: Nearest neighbour interpolation. - * - * - * - * + * + * + * + * * IMG_WEIGHTED4: Weighting filter. - * - * - * - * + * + * + * + * * IMG_TRIANGLE: Triangle interpolation. - * - * - * + * + * + * * @throws ImageException - * + * */ -function imagesetinterpolation($image, int $method = IMG_BILINEAR_FIXED): void +function imagesetinterpolation(\GdImage $image, int $method = IMG_BILINEAR_FIXED): void { error_clear_last(); $result = \imagesetinterpolation($image, $method); @@ -2154,16 +2333,16 @@ function imagesetinterpolation($image, int $method = IMG_BILINEAR_FIXED): void /** * imagesetpixel draws a pixel at the specified * coordinate. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $x x-coordinate. * @param int $y y-coordinate. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagesetpixel($image, int $x, int $y, int $color): void +function imagesetpixel(\GdImage $image, int $x, int $y, int $color): void { error_clear_last(); $result = \imagesetpixel($image, $x, $y, $color); @@ -2179,17 +2358,17 @@ function imagesetpixel($image, int $x, int $y, int $color): void * and imagepolygon) when drawing with the special * color IMG_COLOR_STYLED or lines of images with color * IMG_COLOR_STYLEDBRUSHED. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param array $style An array of pixel colors. You can use the - * IMG_COLOR_TRANSPARENT constant to add a + * @param array $style An array of pixel colors. You can use the + * IMG_COLOR_TRANSPARENT constant to add a * transparent pixel. * Note that style must not be an empty array. * @throws ImageException - * + * */ -function imagesetstyle($image, array $style): void +function imagesetstyle(\GdImage $image, array $style): void { error_clear_last(); $result = \imagesetstyle($image, $style); @@ -2203,14 +2382,14 @@ function imagesetstyle($image, array $style): void * imagesetthickness sets the thickness of the lines * drawn when drawing rectangles, polygons, arcs etc. to * thickness pixels. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $thickness Thickness, in pixels. * @throws ImageException - * + * */ -function imagesetthickness($image, int $thickness): void +function imagesetthickness(\GdImage $image, int $thickness): void { error_clear_last(); $result = \imagesetthickness($image, $thickness); @@ -2225,19 +2404,19 @@ function imagesetthickness($image, int $thickness): void * used by all region filling functions (such as imagefill * and imagefilledpolygon) when filling with the special * color IMG_COLOR_TILED. - * + * * A tile is an image used to fill an area with a repeated pattern. Any * GD image can be used as a tile, and by setting the transparent color index of the tile * image with imagecolortransparent, a tile allows certain parts * of the underlying area to shine through can be created. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param resource $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param resource $tile The image resource to be used as a tile. + * @param resource $tile The image object to be used as a tile. * @throws ImageException - * + * */ -function imagesettile($image, $tile): void +function imagesettile( $image, $tile): void { error_clear_last(); $result = \imagesettile($image, $tile); @@ -2249,20 +2428,20 @@ function imagesettile($image, $tile): void /** * Draws a string at the given coordinates. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $font Can be 1, 2, 3, 4, 5 for built-in - * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or any of your - * own font identifiers registered with imageloadfont. + * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, + * returned by imageloadfont. * @param int $x x-coordinate of the upper left corner. * @param int $y y-coordinate of the upper left corner. * @param string $string The string to be written. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagestring($image, int $font, int $x, int $y, string $string, int $color): void +function imagestring(\GdImage $image, int $font, int $x, int $y, string $string, int $color): void { error_clear_last(); $result = \imagestring($image, $font, $x, $y, $string, $color); @@ -2275,20 +2454,20 @@ function imagestring($image, int $font, int $x, int $y, string $string, int $col /** * Draws a string vertically at the given * coordinates. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param int $font Can be 1, 2, 3, 4, 5 for built-in - * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or any of your - * own font identifiers registered with imageloadfont. + * fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or GdFont instance, + * returned by imageloadfont. * @param int $x x-coordinate of the bottom left corner. * @param int $y y-coordinate of the bottom left corner. * @param string $string The string to be written. * @param int $color A color identifier created with imagecolorallocate. * @throws ImageException - * + * */ -function imagestringup($image, int $font, int $x, int $y, string $string, int $color): void +function imagestringup(\GdImage $image, int $font, int $x, int $y, string $string, int $color): void { error_clear_last(); $result = \imagestringup($image, $font, $x, $y, $string, $color); @@ -2299,15 +2478,15 @@ function imagestringup($image, int $font, int $x, int $y, string $string, int $c /** - * Returns the width of the given image resource. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * Returns the width of the given image object. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @return int Return the width of the images. * @throws ImageException - * + * */ -function imagesx($image): int +function imagesx(\GdImage $image): int { error_clear_last(); $result = \imagesx($image); @@ -2319,15 +2498,15 @@ function imagesx($image): int /** - * Returns the height of the given image resource. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * Returns the height of the given image object. + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @return int Return the height of the images. * @throws ImageException - * + * */ -function imagesy($image): int +function imagesy(\GdImage $image): int { error_clear_last(); $result = \imagesy($image); @@ -2347,20 +2526,20 @@ function imagesy($image): int * well as possible. This does not work as well as might be hoped. It is * usually best to simply produce a truecolor output image instead, which * guarantees the highest output quality. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param bool $dither Indicates if the image should be dithered - if it is TRUE then * dithering will be used which will result in a more speckled image but * with better color approximation. - * @param int $ncolors Sets the maximum number of colors that should be retained in the palette. + * @param int $num_colors Sets the maximum number of colors that should be retained in the palette. * @throws ImageException - * + * */ -function imagetruecolortopalette($image, bool $dither, int $ncolors): void +function imagetruecolortopalette(\GdImage $image, bool $dither, int $num_colors): void { error_clear_last(); - $result = \imagetruecolortopalette($image, $dither, $ncolors); + $result = \imagetruecolortopalette($image, $dither, $num_colors); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2370,91 +2549,92 @@ function imagetruecolortopalette($image, bool $dither, int $ncolors): void /** * This function calculates and returns the bounding box in pixels * for a TrueType text. - * + * * @param float $size The font size in points. - * @param float $angle Angle in degrees in which text will be measured. - * @param string $fontfile The path to the TrueType font you wish to use. - * + * @param float $angle Angle in degrees in which string will be measured. + * @param string $font_filename The path to the TrueType font you wish to use. + * * Depending on which version of the GD library PHP is using, when * fontfile does not begin with a leading * / then .ttf will be appended * to the filename and the library will attempt to search for that * filename along a library-defined font path. - * + * * When using versions of the GD library lower than 2.0.18, a space character, * rather than a semicolon, was used as the 'path separator' for different font files. * Unintentional use of this feature will result in the warning message: * Warning: Could not find/open font. For these affected versions, the * only solution is moving the font to a path which does not contain spaces. - * + * * In many cases where a font resides in the same directory as the script using it * the following trick will alleviate any include problems. - * - * + * + * * ]]> - * - * + * + * * Note that open_basedir does * not apply to fontfile. - * @param string $text The string to be measured. + * @param string $string The string to be measured. + * @param array $options * @return array imagettfbbox returns an array with 8 * elements representing four points making the bounding box of the * text on success and FALSE on error. - * - * - * - * + * + * + * + * * key * contents - * - * - * - * + * + * + * + * * 0 * lower left corner, X position - * - * + * + * * 1 * lower left corner, Y position - * - * + * + * * 2 * lower right corner, X position - * - * + * + * * 3 * lower right corner, Y position - * - * + * + * * 4 * upper right corner, X position - * - * + * + * * 5 * upper right corner, Y position - * - * + * + * * 6 * upper left corner, X position - * - * + * + * * 7 * upper left corner, Y position - * - * - * - * - * + * + * + * + * + * * The points are relative to the text regardless of the - * angle, so "upper left" means in the top left-hand + * angle, so "upper left" means in the top left-hand * corner seeing the text horizontally. * @throws ImageException - * + * */ -function imagettfbbox(float $size, float $angle, string $fontfile, string $text): array +function imagettfbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array { error_clear_last(); - $result = \imagettfbbox($size, $angle, $fontfile, $text); + $result = \imagettfbbox($size, $angle, $font_filename, $string, $options); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2465,12 +2645,12 @@ function imagettfbbox(float $size, float $angle, string $fontfile, string $text) /** * Writes the given text into the image using TrueType * fonts. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param float $size The font size in points. * @param float $angle The angle in degrees, with 0 degrees being left-to-right reading text. - * Higher values represent a counter-clockwise rotation. For example, a + * Higher values represent a counter-clockwise rotation. For example, a * value of 90 would result in bottom-to-top reading text. * @param int $x The coordinates given by x and * y will define the basepoint of the first @@ -2483,54 +2663,55 @@ function imagettfbbox(float $size, float $angle, string $fontfile, string $text) * very bottom of the character. * @param int $color The color index. Using the negative of a color index has the effect of * turning off antialiasing. See imagecolorallocate. - * @param string $fontfile The path to the TrueType font you wish to use. - * + * @param string $font_filename The path to the TrueType font you wish to use. + * * Depending on which version of the GD library PHP is using, when * fontfile does not begin with a leading * / then .ttf will be appended * to the filename and the library will attempt to search for that * filename along a library-defined font path. - * + * * When using versions of the GD library lower than 2.0.18, a space character, * rather than a semicolon, was used as the 'path separator' for different font files. * Unintentional use of this feature will result in the warning message: * Warning: Could not find/open font. For these affected versions, the * only solution is moving the font to a path which does not contain spaces. - * + * * In many cases where a font resides in the same directory as the script using it * the following trick will alleviate any include problems. - * - * + * + * * ]]> - * - * + * + * * Note that open_basedir does * not apply to fontfile. * @param string $text The text string in UTF-8 encoding. - * + * * May include decimal numeric character references (of the form: * &#8364;) to access characters in a font beyond position 127. * The hexadecimal format (like &#xA9;) is supported. * Strings in UTF-8 encoding can be passed directly. - * - * Named entities, such as &copy;, are not supported. Consider using + * + * Named entities, such as &copy;, are not supported. Consider using * html_entity_decode * to decode these named entities into UTF-8 strings. - * + * * If a character is used in the string which is not supported by the * font, a hollow rectangle will replace the character. + * @param array $options * @return array Returns an array with 8 elements representing four points making the - * bounding box of the text. The order of the points is lower left, lower + * bounding box of the text. The order of the points is lower left, lower * right, upper right, upper left. The points are relative to the text - * regardless of the angle, so "upper left" means in the top left-hand + * regardless of the angle, so "upper left" means in the top left-hand * corner when you see the text horizontally. * @throws ImageException - * + * */ -function imagettftext($image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text): array +function imagettftext(\GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array { error_clear_last(); - $result = \imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text); + $result = \imagettftext($image, $size, $angle, $x, $y, $color, $font_filename, $text, $options); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2541,24 +2722,20 @@ function imagettftext($image, float $size, float $angle, int $x, int $y, int $co /** * imagewbmp outputs or save a WBMP * version of the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. - * @param int $foreground You can set the foreground color with this parameter by setting an + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. + * @param $foreground_color You can set the foreground color with this parameter by setting an * identifier obtained from imagecolorallocate. * The default foreground color is black. * @throws ImageException - * + * */ -function imagewbmp($image, $to = null, int $foreground = null): void +function imagewbmp(\GdImage $image, $file = null, $foreground_color = null): void { error_clear_last(); - if ($foreground !== null) { - $result = \imagewbmp($image, $to, $foreground); - } else { - $result = \imagewbmp($image, $to); - } + $result = \imagewbmp($image, $file, $foreground_color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2567,19 +2744,19 @@ function imagewbmp($image, $to = null, int $foreground = null): void /** * Outputs or saves a WebP version of the given image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. - * @param mixed $to The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be outputted directly. + * @param $file The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or NULL, the raw image stream will be output directly. * @param int $quality quality ranges from 0 (worst * quality, smaller file) to 100 (best quality, biggest file). * @throws ImageException - * + * */ -function imagewebp($image, $to = null, int $quality = 80): void +function imagewebp(\GdImage $image, $file = null, int $quality = -1): void { error_clear_last(); - $result = \imagewebp($image, $to, $quality); + $result = \imagewebp($image, $file, $quality); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2587,33 +2764,29 @@ function imagewebp($image, $to = null, int $quality = 80): void /** - * Outputs or save an XBM version of the given + * Outputs or save an XBM version of the given * image. - * - * @param resource $image An image resource, returned by one of the image creation functions, + * + * @param \GdImage $image A GdImage object, returned by one of the image creation functions, * such as imagecreatetruecolor. * @param string|null $filename The path to save the file to, given as string. If NULL, the raw image stream will be output directly. - * + * * The filename (without the .xbm extension) is also * used for the C identifiers of the XBM, whereby non * alphanumeric characters of the current locale are substituted by * underscores. If filename is set to NULL, * image is used to build the C identifiers. - * @param int $foreground You can set the foreground color with this parameter by setting an + * @param $foreground_color You can set the foreground color with this parameter by setting an * identifier obtained from imagecolorallocate. * The default foreground color is black. All other colors are treated as * background. * @throws ImageException - * + * */ -function imagexbm($image, ?string $filename, int $foreground = null): void +function imagexbm(\GdImage $image, ?string $filename, $foreground_color = null): void { error_clear_last(); - if ($foreground !== null) { - $result = \imagexbm($image, $filename, $foreground); - } else { - $result = \imagexbm($image, $filename); - } + $result = \imagexbm($image, $filename, $foreground_color); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2622,19 +2795,19 @@ function imagexbm($image, ?string $filename, int $foreground = null): void /** * Embeds binary IPTC data into a JPEG image. - * - * @param string $iptcdata The data to be written. - * @param string $jpeg_file_name Path to the JPEG image. - * @param int $spool Spool flag. If the spool flag is less than 2 then the JPEG will be + * + * @param string $iptc_data The data to be written. + * @param string $filename Path to the JPEG image. + * @param int $spool Spool flag. If the spool flag is less than 2 then the JPEG will be * returned as a string. Otherwise the JPEG will be printed to STDOUT. * @return string|bool If spool is less than 2, the JPEG will be returned. Otherwise returns TRUE on success. * @throws ImageException - * + * */ -function iptcembed(string $iptcdata, string $jpeg_file_name, int $spool = 0) +function iptcembed(string $iptc_data, string $filename, int $spool = 0) { error_clear_last(); - $result = \iptcembed($iptcdata, $jpeg_file_name, $spool); + $result = \iptcembed($iptc_data, $filename, $spool); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2644,17 +2817,17 @@ function iptcembed(string $iptcdata, string $jpeg_file_name, int $spool = 0) /** * Parses an IPTC block into its single tags. - * - * @param string $iptcblock A binary IPTC block. + * + * @param string $iptc_block A binary IPTC block. * @return array Returns an array using the tagmarker as an index and the value as the * value. It returns FALSE on error or if no IPTC data was found. * @throws ImageException - * + * */ -function iptcparse(string $iptcblock): array +function iptcparse(string $iptc_block): array { error_clear_last(); - $result = \iptcparse($iptcblock); + $result = \iptcparse($iptc_block); if ($result === false) { throw ImageException::createFromPhpError(); } @@ -2664,14 +2837,14 @@ function iptcparse(string $iptcblock): array /** * Converts a JPEG file into a WBMP file. - * + * * @param string $jpegname Path to JPEG file. * @param string $wbmpname Path to destination WBMP file. * @param int $dest_height Destination image height. * @param int $dest_width Destination image width. * @param int $threshold Threshold value, between 0 and 8 (inclusive). * @throws ImageException - * + * */ function jpeg2wbmp(string $jpegname, string $wbmpname, int $dest_height, int $dest_width, int $threshold): void { @@ -2685,14 +2858,14 @@ function jpeg2wbmp(string $jpegname, string $wbmpname, int $dest_height, int $de /** * Converts a PNG file into a WBMP file. - * + * * @param string $pngname Path to PNG file. * @param string $wbmpname Path to destination WBMP file. * @param int $dest_height Destination image height. * @param int $dest_width Destination image width. * @param int $threshold Threshold value, between 0 and 8 (inclusive). * @throws ImageException - * + * */ function png2wbmp(string $pngname, string $wbmpname, int $dest_height, int $dest_width, int $threshold): void { @@ -2702,3 +2875,5 @@ function png2wbmp(string $pngname, string $wbmpname, int $dest_height, int $dest throw ImageException::createFromPhpError(); } } + + diff --git a/generated/imap.php b/generated/imap.php index acd8672c..123e44a8 100644 --- a/generated/imap.php +++ b/generated/imap.php @@ -5,76 +5,204 @@ use Safe\Exceptions\ImapException; /** - * Appends a string message to the specified mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param string $mailbox The mailbox name, see imap_open for more + * Convert an 8bit string to a quoted-printable string (according to + * RFC2045, section 6.7). + * + * @param string $string The 8bit string to convert + * @return string Returns a quoted-printable string. + * @throws ImapException + * + */ +function imap_8bit(string $string): string +{ + error_clear_last(); + $result = \imap_8bit($string); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Appends a string message to the specified folder. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $folder The mailbox name, see imap_open for more * information * @param string $message The message to be append, as a string - * + * * When talking to the Cyrus IMAP server, you must use "\r\n" as * your end-of-line terminator instead of "\n" or the operation will * fail * @param string $options If provided, the options will also be written - * to the mailbox + * to the folder * @param string $internal_date If this parameter is set, it will set the INTERNALDATE on the appended message. The parameter should be a date string that conforms to the rfc2060 specifications for a date_time value. * @throws ImapException - * + * + */ +function imap_append(\IMAP\Connection $imap, string $folder, string $message, string $options = null, string $internal_date = null): void +{ + error_clear_last(); + $result = \imap_append($imap, $folder, $message, $options, $internal_date); + if ($result === false) { + throw ImapException::createFromPhpError(); + } +} + + +/** + * Decodes the given BASE-64 encoded string. + * + * @param string $string The encoded text + * @return string Returns the decoded message as a string. + * @throws ImapException + * + */ +function imap_base64(string $string): string +{ + error_clear_last(); + $result = \imap_base64($string); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Convert an 8bit string to a base64 string according to RFC2045, Section 6.8. + * + * @param string $string The 8bit string + * @return string Returns a base64 encoded string. + * @throws ImapException + * */ -function imap_append($imap_stream, string $mailbox, string $message, string $options = null, string $internal_date = null): void +function imap_binary(string $string): string { error_clear_last(); - $result = \imap_append($imap_stream, $mailbox, $message, $options, $internal_date); + $result = \imap_binary($string); if ($result === false) { throw ImapException::createFromPhpError(); } + return $result; +} + + +/** + * imap_body returns the body of the message, + * numbered message_num in the current + * mailbox. + * + * imap_body will only return a verbatim copy of the + * message body. To extract single parts of a multipart MIME-encoded + * message you have to use imap_fetchstructure to + * analyze its structure and imap_fetchbody to + * extract a copy of a single body component. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param int $flags The optional flags are a bit mask + * with one or more of the following: + * + * + * + * FT_UID - The message_num is a UID + * + * + * + * + * FT_PEEK - Do not set the \Seen flag if not already set + * + * + * + * + * FT_INTERNAL - The return string is in internal format, will + * not canonicalize to CRLF. + * + * + * + * @return string Returns the body of the specified message, as a string. + * @throws ImapException + * + */ +function imap_body(\IMAP\Connection $imap, int $message_num, int $flags = 0): string +{ + error_clear_last(); + $result = \imap_body($imap, $message_num, $flags); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Read the structure of a specified body section of a specific message. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param string $section The body section to read + * @return \stdClass Returns the information in an object. + * For a detailed description + * of the object structure and properties see + * imap_fetchstructure. + * @throws ImapException + * + */ +function imap_bodystruct(\IMAP\Connection $imap, int $message_num, string $section): \stdClass +{ + error_clear_last(); + $result = \imap_bodystruct($imap, $message_num, $section); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; } /** * Checks information about the current mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @return \stdClass Returns the information in an object with following properties: - * - * - * + * + * + * * Date - current system time formatted according to RFC2822 - * - * - * - * + * + * + * + * * Driver - protocol used to access this mailbox: * POP3, IMAP, NNTP - * - * - * - * + * + * + * + * * Mailbox - the mailbox name - * - * - * - * + * + * + * + * * Nmsgs - number of messages in the mailbox - * - * - * - * + * + * + * + * * Recent - number of recent messages in the mailbox - * - * - * - * + * + * + * + * * Returns FALSE on failure. * @throws ImapException - * + * */ -function imap_check($imap_stream): \stdClass +function imap_check(\IMAP\Connection $imap): \stdClass { error_clear_last(); - $result = \imap_check($imap_stream); + $result = \imap_check($imap); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -86,31 +214,30 @@ function imap_check($imap_stream): \stdClass * This function causes a store to delete the specified * flag to the flags set for the * messages in the specified sequence. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $sequence A sequence of message numbers. You can enumerate desired messages - * with the X,Y syntax, or retrieve all messages + * with the X,Y syntax, or retrieve all messages * within an interval with the X:Y syntax * @param string $flag The flags which you can unset are "\\Seen", "\\Answered", "\\Flagged", * "\\Deleted", and "\\Draft" (as defined by RFC2060) * @param int $options options are a bit mask and may contain * the single option: - * - * - * + * + * + * * ST_UID - The sequence argument contains UIDs * instead of sequence numbers - * - * - * + * + * + * * @throws ImapException - * + * */ -function imap_clearflag_full($imap_stream, string $sequence, string $flag, int $options = 0): void +function imap_clearflag_full(\IMAP\Connection $imap, string $sequence, string $flag, int $options = 0): void { error_clear_last(); - $result = \imap_clearflag_full($imap_stream, $sequence, $flag, $options); + $result = \imap_clearflag_full($imap, $sequence, $flag, $options); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -119,20 +246,19 @@ function imap_clearflag_full($imap_stream, string $sequence, string $flag, int $ /** * Closes the imap stream. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $flag If set to CL_EXPUNGE, the function will silently + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $flags If set to CL_EXPUNGE, the function will silently * expunge the mailbox before closing, removing all messages marked for * deletion. You can achieve the same thing by using * imap_expunge * @throws ImapException - * + * */ -function imap_close($imap_stream, int $flag = 0): void +function imap_close(\IMAP\Connection $imap, int $flags = 0): void { error_clear_last(); - $result = \imap_close($imap_stream, $flag); + $result = \imap_close($imap, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -141,19 +267,18 @@ function imap_close($imap_stream, int $flag = 0): void /** * Creates a new mailbox specified by mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $mailbox The mailbox name, see imap_open for more * information. Names containing international characters should be * encoded by imap_utf7_encode * @throws ImapException - * + * */ -function imap_createmailbox($imap_stream, string $mailbox): void +function imap_createmailbox(\IMAP\Connection $imap, string $mailbox): void { error_clear_last(); - $result = \imap_createmailbox($imap_stream, $mailbox); + $result = \imap_createmailbox($imap, $mailbox); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -162,129 +287,376 @@ function imap_createmailbox($imap_stream, string $mailbox): void /** * Deletes the specified mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $mailbox The mailbox name, see imap_open for more * information * @throws ImapException - * + * + */ +function imap_deletemailbox(\IMAP\Connection $imap, string $mailbox): void +{ + error_clear_last(); + $result = \imap_deletemailbox($imap, $mailbox); + if ($result === false) { + throw ImapException::createFromPhpError(); + } +} + + +/** + * This function fetches mail headers for the given + * sequence and returns an overview of their + * contents. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $sequence A message sequence description. You can enumerate desired messages + * with the X,Y syntax, or retrieve all messages + * within an interval with the X:Y syntax + * @param int $flags sequence will contain a sequence of message + * indices or UIDs, if this parameter is set to + * FT_UID. + * @return array Returns an array of objects describing one message header each. + * The object will only define a property if it exists. The possible + * properties are: + * + * + * + * subject - the messages subject + * + * + * + * + * from - who sent it + * + * + * + * + * to - recipient + * + * + * + * + * date - when was it sent + * + * + * + * + * message_id - Message-ID + * + * + * + * + * references - is a reference to this message id + * + * + * + * + * in_reply_to - is a reply to this message id + * + * + * + * + * size - size in bytes + * + * + * + * + * uid - UID the message has in the mailbox + * + * + * + * + * msgno - message sequence number in the mailbox + * + * + * + * + * recent - this message is flagged as recent + * + * + * + * + * flagged - this message is flagged + * + * + * + * + * answered - this message is flagged as answered + * + * + * + * + * deleted - this message is flagged for deletion + * + * + * + * + * seen - this message is flagged as already read + * + * + * + * + * draft - this message is flagged as being a draft + * + * + * + * + * udate - the UNIX timestamp of the arrival date + * + * + * + * The function returns FALSE on failure. + * @throws ImapException + * + */ +function imap_fetch_overview(\IMAP\Connection $imap, string $sequence, int $flags = 0): array +{ + error_clear_last(); + $result = \imap_fetch_overview($imap, $sequence, $flags); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Fetch of a particular section of the body of the specified messages. + * Body parts are not decoded by this function. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param string $section The part number. It is a string of integers delimited by period which + * index into a body part list as per the IMAP4 specification + * @param int $flags A bitmask with one or more of the following: + * + * + * + * FT_UID - The message_num is a UID + * + * + * + * + * FT_PEEK - Do not set the \Seen flag if + * not already set + * + * + * + * + * FT_INTERNAL - The return string is in + * internal format, will not canonicalize to CRLF. + * + * + * + * @return string Returns a particular section of the body of the specified messages as a + * text string. + * @throws ImapException + * + */ +function imap_fetchbody(\IMAP\Connection $imap, int $message_num, string $section, int $flags = 0): string +{ + error_clear_last(); + $result = \imap_fetchbody($imap, $message_num, $section, $flags); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * This function causes a fetch of the complete, unfiltered RFC2822 format header of the specified + * message. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param int $flags The possible flags are: + * + * + * + * FT_UID - The message_num + * argument is a UID + * + * + * + * + * FT_INTERNAL - The return string + * is in "internal" format, without any attempt to + * canonicalize to CRLF newlines + * + * + * + * + * FT_PREFETCHTEXT - The RFC822.TEXT + * should be pre-fetched at the same time. This avoids an + * extra RTT on an IMAP connection if a full message text is + * desired (e.g. in a "save to local file" operation) + * + * + * + * @return string Returns the header of the specified message as a text string. + * @throws ImapException + * */ -function imap_deletemailbox($imap_stream, string $mailbox): void +function imap_fetchheader(\IMAP\Connection $imap, int $message_num, int $flags = 0): string { error_clear_last(); - $result = \imap_deletemailbox($imap_stream, $mailbox); + $result = \imap_fetchheader($imap, $message_num, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } + return $result; +} + + +/** + * Fetch the MIME headers of a particular section of the body of the specified messages. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param string $section The part number. It is a string of integers delimited by period which + * index into a body part list as per the IMAP4 specification + * @param int $flags A bitmask with one or more of the following: + * + * + * + * FT_UID - The message_num is a UID + * + * + * + * + * FT_PEEK - Do not set the \Seen flag if + * not already set + * + * + * + * + * FT_INTERNAL - The return string is in + * internal format, will not canonicalize to CRLF. + * + * + * + * @return string Returns the MIME headers of a particular section of the body of the specified messages as a + * text string. + * @throws ImapException + * + */ +function imap_fetchmime(\IMAP\Connection $imap, int $message_num, string $section, int $flags = 0): string +{ + error_clear_last(); + $result = \imap_fetchmime($imap, $message_num, $section, $flags); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; } /** * Fetches all the structured information for a given message. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $msg_number The message number - * @param int $options This optional parameter only has a single option, + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param int $flags This optional parameter only has a single option, * FT_UID, which tells the function to treat the - * msg_number argument as a + * message_num argument as a * UID. * @return \stdClass Returns an object with properties listed in the table below. - * - * - * + * + * + * * Returned Object for imap_fetchstructure - * - * - * - * + * + * + * + * * type * Primary body type - * - * + * + * * encoding * Body transfer encoding - * - * + * + * * ifsubtype * TRUE if there is a subtype string - * - * + * + * * subtype * MIME subtype - * - * + * + * * ifdescription * TRUE if there is a description string - * - * + * + * * description * Content description string - * - * + * + * * ifid * TRUE if there is an identification string - * - * + * + * * id * Identification string - * - * + * + * * lines * Number of lines - * - * + * + * * bytes * Number of bytes - * - * + * + * * ifdisposition * TRUE if there is a disposition string - * - * + * + * * disposition * Disposition string - * - * + * + * * ifdparameters * TRUE if the dparameters array exists - * - * + * + * * dparameters * An array of objects where each object has an * "attribute" and a "value" * property corresponding to the parameters on the * Content-disposition MIME * header. - * - * + * + * * ifparameters * TRUE if the parameters array exists - * - * + * + * * parameters * An array of objects where each object has an * "attribute" and a "value" * property. - * - * + * + * * parts * An array of objects identical in structure to the top-level * object, each of which corresponds to a MIME body * part. - * - * - * - * - * - * + * + * + * + * + * + * * Primary body type (value may vary with used library, use of constants is recommended) - * - * + * + * * ValueTypeConstant - * - * + * + * * 0textTYPETEXT * 1multipartTYPEMULTIPART * 2messageTYPEMESSAGE @@ -294,33 +666,33 @@ function imap_deletemailbox($imap_stream, string $mailbox): void * 6videoTYPEVIDEO * 7modelTYPEMODEL * 8otherTYPEOTHER - * - * - * - * - * + * + * + * + * + * * Transfer encodings (value may vary with used library, use of constants is recommended) - * - * + * + * * ValueTypeConstant - * - * + * + * * 07bitENC7BIT * 18bitENC8BIT * 2BinaryENCBINARY * 3Base64ENCBASE64 * 4Quoted-PrintableENCQUOTEDPRINTABLE * 5otherENCOTHER - * - * - * + * + * + * * @throws ImapException - * + * */ -function imap_fetchstructure($imap_stream, int $msg_number, int $options = 0): \stdClass +function imap_fetchstructure(\IMAP\Connection $imap, int $message_num, int $flags = 0): \stdClass { error_clear_last(); - $result = \imap_fetchstructure($imap_stream, $msg_number, $options); + $result = \imap_fetchstructure($imap, $message_num, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -330,247 +702,535 @@ function imap_fetchstructure($imap_stream, int $msg_number, int $options = 0): \ /** * Purges the cache of entries of a specific type. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $caches Specifies the cache to purge. It may one or a combination - * of the following constants: - * IMAP_GC_ELT (message cache elements), + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $flags Specifies the cache to purge. It may one or a combination + * of the following constants: + * IMAP_GC_ELT (message cache elements), * IMAP_GC_ENV (envelope and bodies), * IMAP_GC_TEXTS (texts). * @throws ImapException - * + * + */ +function imap_gc(\IMAP\Connection $imap, int $flags): void +{ + error_clear_last(); + $result = \imap_gc($imap, $flags); + if ($result === false) { + throw ImapException::createFromPhpError(); + } +} + + +/** + * Gets the ACL for a given mailbox. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $mailbox The mailbox name, see imap_open for more + * information + * @return array Returns an associative array of "folder" => "acl" pairs. + * @throws ImapException + * + */ +function imap_getacl(\IMAP\Connection $imap, string $mailbox): array +{ + error_clear_last(); + $result = \imap_getacl($imap, $mailbox); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets information on the mailboxes. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $reference reference should normally be just the server + * specification as described in imap_open + * @param string $pattern Specifies where in the mailbox hierarchy + * to start searching. + * + * There are two special characters you can + * pass as part of the pattern: + * '*' and '%'. + * '*' means to return all mailboxes. If you pass + * pattern as '*', you will + * get a list of the entire mailbox hierarchy. + * '%' + * means to return the current level only. + * '%' as the pattern + * parameter will return only the top level + * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. + * @return array Returns an array of objects containing mailbox information. Each + * object has the attributes name, specifying + * the full name of the mailbox; delimiter, + * which is the hierarchy delimiter for the part of the hierarchy + * this mailbox is in; and + * attributes. Attributes + * is a bitmask that can be tested against: + * + * + * + * LATT_NOINFERIORS - This mailbox not contains, and may not contain any + * "children" (there are no mailboxes below this one). Calling + * imap_createmailbox will not work on this mailbox. + * + * + * + * + * LATT_NOSELECT - This is only a container, + * not a mailbox - you cannot open it. + * + * + * + * + * LATT_MARKED - This mailbox is marked. This means that it may + * contain new messages since the last time it was checked. Not provided by all IMAP + * servers. + * + * + * + * + * LATT_UNMARKED - This mailbox is not marked, does not contain new + * messages. If either MARKED or UNMARKED is + * provided, you can assume the IMAP server supports this feature for this mailbox. + * + * + * + * + * LATT_REFERRAL - This container has a referral to a remote mailbox. + * + * + * + * + * LATT_HASCHILDREN - This mailbox has selectable inferiors. + * + * + * + * + * LATT_HASNOCHILDREN - This mailbox has no selectable inferiors. + * + * + * + * The function returns FALSE on failure. + * @throws ImapException + * + */ +function imap_getmailboxes(\IMAP\Connection $imap, string $reference, string $pattern): array +{ + error_clear_last(); + $result = \imap_getmailboxes($imap, $reference, $pattern); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets information about the subscribed mailboxes. + * + * Identical to imap_getmailboxes, except that it only + * returns mailboxes that the user is subscribed to. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $reference reference should normally be just the server + * specification as described in imap_open + * @param string $pattern Specifies where in the mailbox hierarchy + * to start searching. + * + * There are two special characters you can + * pass as part of the pattern: + * '*' and '%'. + * '*' means to return all mailboxes. If you pass + * pattern as '*', you will + * get a list of the entire mailbox hierarchy. + * '%' + * means to return the current level only. + * '%' as the pattern + * parameter will return only the top level + * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. + * @return array Returns an array of objects containing mailbox information. Each + * object has the attributes name, specifying + * the full name of the mailbox; delimiter, + * which is the hierarchy delimiter for the part of the hierarchy + * this mailbox is in; and + * attributes. Attributes + * is a bitmask that can be tested against: + * + * + * + * LATT_NOINFERIORS - This mailbox has no + * "children" (there are no mailboxes below this one). + * + * + * + * + * LATT_NOSELECT - This is only a container, + * not a mailbox - you cannot open it. + * + * + * + * + * LATT_MARKED - This mailbox is marked. + * Only used by UW-IMAPD. + * + * + * + * + * LATT_UNMARKED - This mailbox is not marked. + * Only used by UW-IMAPD. + * + * + * + * + * LATT_REFERRAL - This container has a referral to a remote mailbox. + * + * + * + * + * LATT_HASCHILDREN - This mailbox has selectable inferiors. + * + * + * + * + * LATT_HASNOCHILDREN - This mailbox has no selectable inferiors. + * + * + * + * The function returns FALSE on failure. + * @throws ImapException + * */ -function imap_gc($imap_stream, int $caches): void +function imap_getsubscribed(\IMAP\Connection $imap, string $reference, string $pattern): array { error_clear_last(); - $result = \imap_gc($imap_stream, $caches); + $result = \imap_getsubscribed($imap, $reference, $pattern); if ($result === false) { throw ImapException::createFromPhpError(); } + return $result; } /** * Gets information about the given message number by reading its headers. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $msg_number The message number - * @param int $fromlength Number of characters for the fetchfrom property. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $message_num The message number + * @param int $from_length Number of characters for the fetchfrom property. * Must be greater than or equal to zero. - * @param int $subjectlength Number of characters for the fetchsubject property + * @param int $subject_length Number of characters for the fetchsubject property * Must be greater than or equal to zero. - * @param string $defaulthost * @return \stdClass Returns FALSE on error or, if successful, the information in an object with following properties: - * - * - * + * + * + * * toaddress - full to: line, up to 1024 characters - * - * - * - * - * to - an array of objects from the To: line, with the following + * + * + * + * + * to - an array of objects from the To: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * fromaddress - full from: line, up to 1024 characters - * - * - * - * - * from - an array of objects from the From: line, with the following + * + * + * + * + * from - an array of objects from the From: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * ccaddress - full cc: line, up to 1024 characters - * - * - * - * - * cc - an array of objects from the Cc: line, with the following + * + * + * + * + * cc - an array of objects from the Cc: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * bccaddress - full bcc: line, up to 1024 characters - * - * - * - * - * bcc - an array of objects from the Bcc: line, with the following + * + * + * + * + * bcc - an array of objects from the Bcc: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * reply_toaddress - full Reply-To: line, up to 1024 characters - * - * - * - * + * + * + * + * * reply_to - an array of objects from the Reply-To: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * senderaddress - full sender: line, up to 1024 characters - * - * - * - * - * sender - an array of objects from the Sender: line, with the following + * + * + * + * + * sender - an array of objects from the Sender: line, with the following * properties: personal, adl, * mailbox, and host - * - * - * - * + * + * + * + * * return_pathaddress - full Return-Path: line, up to 1024 characters - * - * - * - * + * + * + * + * * return_path - an array of objects from the Return-Path: line, with the - * following properties: personal, - * adl, mailbox, and + * following properties: personal, + * adl, mailbox, and * host - * - * - * - * - * remail - - * - * - * - * + * + * + * + * + * remail - + * + * + * + * * date - The message date as found in its headers - * - * - * - * + * + * + * + * * Date - Same as date - * - * - * - * + * + * + * + * * subject - The message subject - * - * - * - * - * Subject - Same as subject - * - * - * - * - * in_reply_to - - * - * - * - * - * message_id - - * - * - * - * - * newsgroups - - * - * - * - * - * followup_to - - * - * - * - * - * references - - * - * - * - * + * + * + * + * + * Subject - Same as subject + * + * + * + * + * in_reply_to - + * + * + * + * + * message_id - + * + * + * + * + * newsgroups - + * + * + * + * + * followup_to - + * + * + * + * + * references - + * + * + * + * * Recent - R if recent and seen, N * if recent and not seen, ' ' if not recent. - * - * - * - * + * + * + * + * * Unseen - U if not seen AND not recent, ' ' if seen * OR not seen and recent - * - * - * - * + * + * + * + * * Flagged - F if flagged, ' ' if not flagged - * - * - * - * + * + * + * + * * Answered - A if answered, ' ' if unanswered - * - * - * - * + * + * + * + * * Deleted - D if deleted, ' ' if not deleted - * - * - * - * + * + * + * + * * Draft - X if draft, ' ' if not draft - * - * - * - * + * + * + * + * * Msgno - The message number - * - * - * - * - * MailDate - - * - * - * - * + * + * + * + * + * MailDate - + * + * + * + * * Size - The message size - * - * - * - * + * + * + * + * * udate - mail message date in Unix time - * - * - * - * - * fetchfrom - from line formatted to fit fromlength + * + * + * + * + * fetchfrom - from line formatted to fit from_length * characters - * - * - * - * - * fetchsubject - subject line formatted to fit - * subjectlength characters - * - * - * + * + * + * + * + * fetchsubject - subject line formatted to fit + * subject_length characters + * + * + * + * @throws ImapException + * + */ +function imap_headerinfo(\IMAP\Connection $imap, int $message_num, int $from_length = 0, int $subject_length = 0): \stdClass +{ + error_clear_last(); + $result = \imap_headerinfo($imap, $message_num, $from_length, $subject_length); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns headers for all messages in a mailbox. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @return array Returns an array of string formatted with header info. One + * element per mail message. + * Returns FALSE on failure. + * @throws ImapException + * + */ +function imap_headers(\IMAP\Connection $imap): array +{ + error_clear_last(); + $result = \imap_headers($imap); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns an array containing the names of the mailboxes that have + * content in the text of the mailbox. + * + * This function is similar to imap_listmailbox, + * but it will additionally check for the presence of the string + * content inside the mailbox data. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $reference reference should normally be just the server + * specification as described in imap_open + * @param string $pattern Specifies where in the mailbox hierarchy + * to start searching. + * + * There are two special characters you can + * pass as part of the pattern: + * '*' and '%'. + * '*' means to return all mailboxes. If you pass + * pattern as '*', you will + * get a list of the entire mailbox hierarchy. + * '%' + * means to return the current level only. + * '%' as the pattern + * parameter will return only the top level + * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. + * @param string $content The searched string + * @return array Returns an array containing the names of the mailboxes that have + * content in the text of the mailbox. + * @throws ImapException + * + */ +function imap_listscan(\IMAP\Connection $imap, string $reference, string $pattern, string $content): array +{ + error_clear_last(); + $result = \imap_listscan($imap, $reference, $pattern, $content); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets an array of all the mailboxes that you have subscribed. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $reference reference should normally be just the server + * specification as described in imap_open + * @param string $pattern Specifies where in the mailbox hierarchy + * to start searching. + * + * There are two special characters you can + * pass as part of the pattern: + * '*' and '%'. + * '*' means to return all mailboxes. If you pass + * pattern as '*', you will + * get a list of the entire mailbox hierarchy. + * '%' + * means to return the current level only. + * '%' as the pattern + * parameter will return only the top level + * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. + * @return array Returns an array of all the subscribed mailboxes. * @throws ImapException - * + * */ -function imap_headerinfo($imap_stream, int $msg_number, int $fromlength = 0, int $subjectlength = 0, string $defaulthost = null): \stdClass +function imap_lsub(\IMAP\Connection $imap, string $reference, string $pattern): array { error_clear_last(); - $result = \imap_headerinfo($imap_stream, $msg_number, $fromlength, $subjectlength, $defaulthost); + $result = \imap_lsub($imap, $reference, $pattern); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -580,115 +1240,115 @@ function imap_headerinfo($imap_stream, int $msg_number, int $fromlength = 0, int /** * Create a MIME message based on the given envelope - * and body sections. - * + * and bodies sections. + * * @param array $envelope An associative array of header fields. Valid keys are: "remail", * "return_path", "date", "from", "reply_to", "in_reply_to", "subject", * "to", "cc", "bcc" and "message_id", which set the respective message headers to the given string. * To set additional headers, the key "custom_headers" is supported, which expects * an array of those headers, e.g. ["User-Agent: My Mail Client"]. - * @param array $body An indexed array of bodies. The first body is the main body of the message; + * @param array $bodies An indexed array of bodies. The first body is the main body of the message; * only if it has a type of TYPEMULTIPART, further bodies * are processed; these bodies constitute the bodies of the parts. - * - * + * + * * Body Array Structure - * - * - * + * + * + * * Key * Type * Description - * - * - * - * + * + * + * + * * type * int - * + * * The MIME type. * One of TYPETEXT (default), TYPEMULTIPART, * TYPEMESSAGE, TYPEAPPLICATION, * TYPEAUDIO, TYPEIMAGE, * TYPEMODEL or TYPEOTHER. - * - * - * + * + * + * * encoding * int - * + * * The Content-Transfer-Encoding. * One of ENC7BIT (default), ENC8BIT, * ENCBINARY, ENCBASE64, * ENCQUOTEDPRINTABLE or ENCOTHER. - * - * - * + * + * + * * charset * string * The charset parameter of the MIME type. - * - * + * + * * type.parameters * array * An associative array of Content-Type parameter names and their values. - * - * + * + * * subtype * string * The MIME subtype, e.g. 'jpeg' for TYPEIMAGE. - * - * + * + * * id * string * The Content-ID. - * - * + * + * * description * string * The Content-Description. - * - * + * + * * disposition.type * string * The Content-Disposition, e.g. 'attachment'. - * - * + * + * * disposition * array * An associative array of Content-Disposition parameter names and values. - * - * + * + * * contents.data * string * The payload. - * - * + * + * * lines * int * The size of the payload in lines. - * - * + * + * * bytes * int * The size of the payload in bytes. - * - * + * + * * md5 * string * The MD5 checksum of the payload. - * - * - * - * + * + * + * + * * @return string Returns the MIME message as string. * @throws ImapException - * + * */ -function imap_mail_compose(array $envelope, array $body): string +function imap_mail_compose(array $envelope, array $bodies): string { error_clear_last(); - $result = \imap_mail_compose($envelope, $body); + $result = \imap_mail_compose($envelope, $bodies); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -697,36 +1357,36 @@ function imap_mail_compose(array $envelope, array $body): string /** - * Copies mail messages specified by msglist + * Copies mail messages specified by message_nums * to specified mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param string $msglist msglist is a range not just message + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $message_nums message_nums is a range not just message * numbers (as described in RFC2060). * @param string $mailbox The mailbox name, see imap_open for more * information - * @param int $options options is a bitmask of one or more of - * - * - * + * @param int $flags flags is a bitmask of one or more of + * + * + * * CP_UID - the sequence numbers contain UIDS - * - * - * - * + * + * + * + * * CP_MOVE - Delete the messages from - * the current mailbox after copying - * - * - * + * the current mailbox after copying. If this flag is set, the function + * behaves identically to imap_mail_move. + * + * + * * @throws ImapException - * + * */ -function imap_mail_copy($imap_stream, string $msglist, string $mailbox, int $options = 0): void +function imap_mail_copy(\IMAP\Connection $imap, string $message_nums, string $mailbox, int $flags = 0): void { error_clear_last(); - $result = \imap_mail_copy($imap_stream, $msglist, $mailbox, $options); + $result = \imap_mail_copy($imap, $message_nums, $mailbox, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -734,30 +1394,32 @@ function imap_mail_copy($imap_stream, string $msglist, string $mailbox, int $opt /** - * Moves mail messages specified by msglist to the + * Moves mail messages specified by message_nums to the * specified mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param string $msglist msglist is a range not just message numbers + * Note that the mail messages are actually copied to the + * mailbox, and the original messages are flagged for deletion. + * That implies that the messages in mailbox are assigned new UIDs. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $message_nums message_nums is a range not just message numbers * (as described in RFC2060). * @param string $mailbox The mailbox name, see imap_open for more * information - * @param int $options options is a bitmask and may contain the single option: - * - * - * + * @param int $flags flags is a bitmask and may contain the single option: + * + * + * * CP_UID - the sequence numbers contain UIDS - * - * - * + * + * + * * @throws ImapException - * + * */ -function imap_mail_move($imap_stream, string $msglist, string $mailbox, int $options = 0): void +function imap_mail_move(\IMAP\Connection $imap, string $message_nums, string $mailbox, int $flags = 0): void { error_clear_last(); - $result = \imap_mail_move($imap_stream, $msglist, $mailbox, $options); + $result = \imap_mail_move($imap, $message_nums, $mailbox, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -767,27 +1429,27 @@ function imap_mail_move($imap_stream, string $msglist, string $mailbox, int $opt /** * This function allows sending of emails with correct handling of * Cc and Bcc receivers. - * + * * The parameters to, cc * and bcc are all strings and are all parsed * as RFC822 address lists. - * + * * @param string $to The receiver * @param string $subject The mail subject * @param string $message The mail body, see imap_mail_compose * @param string $additional_headers As string with additional headers to be set on the mail - * @param string $cc + * @param string $cc * @param string $bcc The receivers specified in bcc will get the * mail, but are excluded from the headers. - * @param string $rpath Use this parameter to specify return path upon mail delivery failure. + * @param $return_path Use this parameter to specify return path upon mail delivery failure. * This is useful when using PHP as a mail client for multiple users. * @throws ImapException - * + * */ -function imap_mail(string $to, string $subject, string $message, string $additional_headers = null, string $cc = null, string $bcc = null, string $rpath = null): void +function imap_mail(string $to, string $subject, string $message, string $additional_headers = null, string $cc = null, string $bcc = null, $return_path = null): void { error_clear_last(); - $result = \imap_mail($to, $subject, $message, $additional_headers, $cc, $bcc, $rpath); + $result = \imap_mail($to, $subject, $message, $additional_headers, $cc, $bcc, $return_path); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -797,60 +1459,86 @@ function imap_mail(string $to, string $subject, string $message, string $additio /** * Checks the current mailbox status on the server. It is similar to * imap_status, but will additionally sum up the size of - * all messages in the mailbox, which will take some additional time to + * all messages in the mailbox, which will take some additional time to * execute. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @return \stdClass Returns the information in an object with following properties: - * + * * Mailbox properties - * - * - * + * + * + * * Date * date of last change (current datetime) - * - * + * + * * Driver * driver - * - * + * + * * Mailbox * name of the mailbox - * - * + * + * * Nmsgs * number of messages - * - * + * + * * Recent * number of recent messages - * - * + * + * * Unread * number of unread messages - * - * + * + * * Deleted * number of deleted messages - * - * + * + * * Size * mailbox size - * - * - * - * - * + * + * + * + * + * * Returns FALSE on failure. * @throws ImapException - * + * */ -function imap_mailboxmsginfo($imap_stream): \stdClass +function imap_mailboxmsginfo(\IMAP\Connection $imap): \stdClass { error_clear_last(); - $result = \imap_mailboxmsginfo($imap_stream); + $result = \imap_mailboxmsginfo($imap); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Decodes MIME message header extensions that are non ASCII text (see RFC2047). + * + * @param string $string The MIME text + * @return array The decoded elements are returned in an array of objects, where each + * object has two properties, charset and + * text. + * + * If the element hasn't been encoded, and in other words is in + * plain US-ASCII, the charset property of that element is + * set to default. + * + * The function returns FALSE on failure. + * @throws ImapException + * + */ +function imap_mime_header_decode(string $string): array +{ + error_clear_last(); + $result = \imap_mime_header_decode($string); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -860,16 +1548,16 @@ function imap_mailboxmsginfo($imap_stream): \stdClass /** * Decode a modified UTF-7 (as specified in RFC 2060, section 5.1.3) string to UTF-8. - * - * @param string $in A string encoded in modified UTF-7. - * @return string Returns in converted to UTF-8. + * + * @param string $string A string encoded in modified UTF-7. + * @return string Returns string converted to UTF-8. * @throws ImapException - * + * */ -function imap_mutf7_to_utf8(string $in): string +function imap_mutf7_to_utf8(string $string): string { error_clear_last(); - $result = \imap_mutf7_to_utf8($in); + $result = \imap_mutf7_to_utf8($string); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -879,17 +1567,16 @@ function imap_mutf7_to_utf8(string $in): string /** * Gets the number of messages in the current mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @return int Return the number of messages in the current mailbox, as an integer. * @throws ImapException - * + * */ -function imap_num_msg($imap_stream): int +function imap_num_msg(\IMAP\Connection $imap): int { error_clear_last(); - $result = \imap_num_msg($imap_stream); + $result = \imap_num_msg($imap); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -899,212 +1586,231 @@ function imap_num_msg($imap_stream): int /** * Opens an IMAP stream to a mailbox. - * + * * This function can also be used to open streams to POP3 and * NNTP servers, but some functions and features are only * available on IMAP servers. - * + * * @param string $mailbox A mailbox name consists of a server and a mailbox path on this server. * The special name INBOX stands for the current users * personal mailbox. Mailbox names that contain international characters * besides those in the printable ASCII space have to be encoded with * imap_utf7_encode. - * + * * The server part, which is enclosed in '{' and '}', consists of the servers * name or ip address, an optional port (prefixed by ':'), and an optional * protocol specification (prefixed by '/'). - * + * * The server part is mandatory in all mailbox * parameters. - * + * * All names which start with { are remote names, and are * in the form "{" remote_system_name [":" port] [flags] "}" * [mailbox_name] where: - * - * - * + * + * + * * remote_system_name - Internet domain name or * bracketed IP address of server. - * - * - * - * + * + * + * + * * port - optional TCP port number, default is the * default port for that service - * - * - * - * + * + * + * + * * flags - optional flags, see following table. - * - * - * - * + * + * + * + * * mailbox_name - remote mailbox name, default is INBOX - * - * - * - * - * + * + * + * + * + * * Optional flags for names - * - * - * + * + * + * * Flag * Description - * - * - * - * + * + * + * + * * /service=service * mailbox access service, default is "imap" - * - * + * + * * /user=user * remote user name for login on the server - * - * + * + * * /authuser=user * remote authentication user; if specified this is the user name * whose password is used (e.g. administrator) - * - * + * + * * /anonymous * remote access as anonymous user - * - * + * + * * /debug * record protocol telemetry in application's debug log - * - * + * + * * /secure * do not transmit a plaintext password over the network - * - * + * + * * /imap, /imap2, * /imap2bis, /imap4, * /imap4rev1 * equivalent to /service=imap - * - * + * + * * /pop3 * equivalent to /service=pop3 - * - * + * + * * /nntp * equivalent to /service=nntp - * - * + * + * * /norsh * do not use rsh or ssh to establish a preauthenticated IMAP * session - * - * + * + * * /ssl * use the Secure Socket Layer to encrypt the session - * - * + * + * * /validate-cert * validate certificates from TLS/SSL server (this is the default * behavior) - * - * + * + * * /novalidate-cert * do not validate certificates from TLS/SSL server, needed if * server uses self-signed certificates - * - * + * + * * /tls * force use of start-TLS to encrypt the session, and reject * connection to servers that do not support it - * - * + * + * * /notls * do not do start-TLS to encrypt the session, even with servers * that support it - * - * + * + * * /readonly * request read-only mailbox open (IMAP only; ignored on NNTP, and * an error with SMTP and POP3) - * - * - * - * - * @param string $username The user name - * @param string $password The password associated with the username - * @param int $options The options are a bit mask with one or more of + * + * + * + * + * @param string $user The user name + * @param string $password The password associated with the user + * @param int $flags The flags are a bit mask with one or more of * the following: - * - * - * + * + * + * * OP_READONLY - Open mailbox read-only - * - * - * - * + * + * + * + * * OP_ANONYMOUS - Don't use or update a * .newsrc for news (NNTP only) - * - * - * - * + * + * + * + * * OP_HALFOPEN - For IMAP * and NNTP names, open a connection but * don't open a mailbox. - * - * - * - * + * + * + * + * * CL_EXPUNGE - Expunge mailbox automatically upon mailbox close * (see also imap_delete and * imap_expunge) - * - * - * - * + * + * + * + * * OP_DEBUG - Debug protocol negotiations - * - * - * - * + * + * + * + * * OP_SHORTCACHE - Short (elt-only) caching - * - * - * - * + * + * + * + * * OP_SILENT - Don't pass up events (internal use) - * - * - * - * + * + * + * + * * OP_PROTOTYPE - Return driver prototype - * - * - * - * + * + * + * + * * OP_SECURE - Don't do non-secure authentication - * - * - * - * @param int $n_retries Number of maximum connect attempts - * @param array|null $params Connection parameters, the following (string) keys maybe used + * + * + * + * @param int $retries Number of maximum connect attempts + * @param int $options Connection parameters, the following (string) keys maybe used * to set one or more connection parameters: - * - * - * + * + * + * * DISABLE_AUTHENTICATOR - Disable authentication properties - * - * - * - * @return resource Returns an IMAP stream on success. + * + * + * + * @return resource Returns an IMAP\Connection instance on success. + * @throws ImapException + * + */ +function imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, int $options = []) +{ + error_clear_last(); + $result = \imap_open($mailbox, $user, $password, $flags, $retries, $options); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Convert a quoted-printable string to an 8 bit string according to RFC2045, section 6.7. + * + * @param string $string A quoted-printable string + * @return string Returns an 8 bits string. * @throws ImapException - * + * */ -function imap_open(string $mailbox, string $username, string $password, int $options = 0, int $n_retries = 0, ?array $params = null) +function imap_qprint(string $string): string { error_clear_last(); - $result = \imap_open($mailbox, $username, $password, $options, $n_retries, $params); + $result = \imap_qprint($string); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1116,63 +1822,83 @@ function imap_open(string $mailbox, string $username, string $password, int $opt * This function renames on old mailbox to new mailbox (see * imap_open for the format of * mbox names). - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param string $old_mbox The old mailbox name, see imap_open for more + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $from The old mailbox name, see imap_open for more * information - * @param string $new_mbox The new mailbox name, see imap_open for more + * @param string $to The new mailbox name, see imap_open for more + * information + * @throws ImapException + * + */ +function imap_renamemailbox(\IMAP\Connection $imap, string $from, string $to): void +{ + error_clear_last(); + $result = \imap_renamemailbox($imap, $from, $to); + if ($result === false) { + throw ImapException::createFromPhpError(); + } +} + + +/** + * Returns a properly formatted email address as defined in RFC2822 given the needed information. + * + * @param string|null $mailbox The mailbox name, see imap_open for more * information + * @param string $hostname The email host part + * @param string|null $personal The name of the account owner + * @return string Returns a string properly formatted email address as defined in RFC2822. * @throws ImapException - * + * */ -function imap_renamemailbox($imap_stream, string $old_mbox, string $new_mbox): void +function imap_rfc822_write_address(?string $mailbox, string $hostname, ?string $personal): string { error_clear_last(); - $result = \imap_renamemailbox($imap_stream, $old_mbox, $new_mbox); + $result = \imap_rfc822_write_address($mailbox, $hostname, $personal); if ($result === false) { throw ImapException::createFromPhpError(); } + return $result; } /** * Saves a part or the whole body of the specified message. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string|resource $file The path to the saved file as a string, or a valid file descriptor * returned by fopen. - * @param int $msg_number The message number - * @param string $part_number The part number. It is a string of integers delimited by period which + * @param int $message_num The message number + * @param string $section The part number. It is a string of integers delimited by period which * index into a body part list as per the IMAP4 specification - * @param int $options A bitmask with one or more of the following: - * - * - * - * FT_UID - The msg_number is a UID - * - * - * - * + * @param int $flags A bitmask with one or more of the following: + * + * + * + * FT_UID - The message_num is a UID + * + * + * + * * FT_PEEK - Do not set the \Seen flag if * not already set - * - * - * - * + * + * + * + * * FT_INTERNAL - The return string is in * internal format, will not canonicalize to CRLF. - * - * - * + * + * + * * @throws ImapException - * + * */ -function imap_savebody($imap_stream, $file, int $msg_number, string $part_number = "", int $options = 0): void +function imap_savebody(\IMAP\Connection $imap, $file, int $message_num, string $section = "", int $flags = 0): void { error_clear_last(); - $result = \imap_savebody($imap_stream, $file, $msg_number, $part_number, $options); + $result = \imap_savebody($imap, $file, $message_num, $section, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1181,19 +1907,18 @@ function imap_savebody($imap_stream, $file, int $msg_number, string $part_number /** * Sets an upper limit quota on a per mailbox basis. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $quota_root The mailbox to have a quota set. This should follow the IMAP standard * format for a mailbox: user.name. - * @param int $quota_limit The maximum size (in KB) for the quota_root + * @param int $mailbox_size The maximum size (in KB) for the quota_root * @throws ImapException - * + * */ -function imap_set_quota($imap_stream, string $quota_root, int $quota_limit): void +function imap_set_quota(\IMAP\Connection $imap, string $quota_root, int $mailbox_size): void { error_clear_last(); - $result = \imap_set_quota($imap_stream, $quota_root, $quota_limit); + $result = \imap_set_quota($imap, $quota_root, $mailbox_size); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1202,21 +1927,20 @@ function imap_set_quota($imap_stream, string $quota_root, int $quota_limit): voi /** * Sets the ACL for a giving mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $mailbox The mailbox name, see imap_open for more * information - * @param string $id The user to give the rights to. + * @param string $user_id The user to give the rights to. * @param string $rights The rights to give to the user. Passing an empty string will delete * acl. * @throws ImapException - * + * */ -function imap_setacl($imap_stream, string $mailbox, string $id, string $rights): void +function imap_setacl(\IMAP\Connection $imap, string $mailbox, string $user_id, string $rights): void { error_clear_last(); - $result = \imap_setacl($imap_stream, $mailbox, $id, $rights); + $result = \imap_setacl($imap, $mailbox, $user_id, $rights); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1225,34 +1949,33 @@ function imap_setacl($imap_stream, string $mailbox, string $id, string $rights): /** * Causes a store to add the specified flag to the - * flags set for the messages in the specified + * flags set for the messages in the specified * sequence. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $sequence A sequence of message numbers. You can enumerate desired messages - * with the X,Y syntax, or retrieve all messages + * with the X,Y syntax, or retrieve all messages * within an interval with the X:Y syntax - * @param string $flag The flags which you can set are \Seen, + * @param string $flag The flags which you can set are \Seen, * \Answered, \Flagged, * \Deleted, and \Draft as * defined by RFC2060. * @param int $options A bit mask that may contain the single option: - * - * - * + * + * + * * ST_UID - The sequence argument contains UIDs * instead of sequence numbers - * - * - * + * + * + * * @throws ImapException - * + * */ -function imap_setflag_full($imap_stream, string $sequence, string $flag, int $options = NIL): void +function imap_setflag_full(\IMAP\Connection $imap, string $sequence, string $flag, int $options = 0): void { error_clear_last(); - $result = \imap_setflag_full($imap_stream, $sequence, $flag, $options); + $result = \imap_setflag_full($imap, $sequence, $flag, $options); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1261,74 +1984,139 @@ function imap_setflag_full($imap_stream, string $sequence, string $flag, int $op /** * Gets and sorts message numbers by the given parameters. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param int $criteria Criteria can be one (and only one) of the following: - * - * - * + * + * + * * SORTDATE - message Date - * - * - * - * + * + * + * + * * SORTARRIVAL - arrival date - * - * - * - * + * + * + * + * * SORTFROM - mailbox in first From address - * - * - * - * + * + * + * + * * SORTSUBJECT - message subject - * - * - * - * + * + * + * + * * SORTTO - mailbox in first To address - * - * - * - * + * + * + * + * * SORTCC - mailbox in first cc address - * - * - * - * + * + * + * + * * SORTSIZE - size of message in octets - * - * - * - * @param int $reverse Set this to 1 for reverse sorting - * @param int $options The options are a bitmask of one or more of the + * + * + * + * @param int $reverse Whether to sort in reverse order. + * @param int $flags The flags are a bitmask of one or more of the * following: - * - * - * + * + * + * * SE_UID - Return UIDs instead of sequence numbers - * - * - * - * + * + * + * + * * SE_NOPREFETCH - Don't prefetch searched messages - * - * - * + * + * + * * @param string $search_criteria IMAP2-format search criteria string. For details see * imap_search. * @param string $charset MIME character set to use when sorting strings. * @return array Returns an array of message numbers sorted by the given * parameters. * @throws ImapException - * + * */ -function imap_sort($imap_stream, int $criteria, int $reverse, int $options = 0, string $search_criteria = null, string $charset = null): array +function imap_sort(\IMAP\Connection $imap, int $criteria, int $reverse, int $flags = 0, string $search_criteria = null, string $charset = null): array { error_clear_last(); - $result = \imap_sort($imap_stream, $criteria, $reverse, $options, $search_criteria, $charset); + $result = \imap_sort($imap, $criteria, $reverse, $flags, $search_criteria, $charset); + if ($result === false) { + throw ImapException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets status information about the given mailbox. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $mailbox The mailbox name, see imap_open for more + * information + * @param int $flags Valid flags are: + * + * + * + * SA_MESSAGES - set $status->messages to the + * number of messages in the mailbox + * + * + * + * + * SA_RECENT - set $status->recent to the number + * of recent messages in the mailbox + * + * + * + * + * SA_UNSEEN - set $status->unseen to the number + * of unseen (new) messages in the mailbox + * + * + * + * + * SA_UIDNEXT - set $status->uidnext to the next + * uid to be used in the mailbox + * + * + * + * + * SA_UIDVALIDITY - set $status->uidvalidity to a + * constant that changes when uids for the mailbox may no longer be + * valid + * + * + * + * + * SA_ALL - set all of the above + * + * + * + * @return \stdClass This function returns an object containing status information. + * The object has the following properties: messages, + * recent, unseen, + * uidnext, and uidvalidity. + * + * flags is also set, which contains a bitmask which can + * be checked against any of the above constants. + * @throws ImapException + * + */ +function imap_status(\IMAP\Connection $imap, string $mailbox, int $flags): \stdClass +{ + error_clear_last(); + $result = \imap_status($imap, $mailbox, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1338,18 +2126,17 @@ function imap_sort($imap_stream, int $criteria, int $reverse, int $options = 0, /** * Subscribe to a new mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $mailbox The mailbox name, see imap_open for more * information * @throws ImapException - * + * */ -function imap_subscribe($imap_stream, string $mailbox): void +function imap_subscribe(\IMAP\Connection $imap, string $mailbox): void { error_clear_last(); - $result = \imap_subscribe($imap_stream, $mailbox); + $result = \imap_subscribe($imap, $mailbox); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1358,33 +2145,32 @@ function imap_subscribe($imap_stream, string $mailbox): void /** * Gets a tree of a threaded message. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $options + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param int $flags * @return array imap_thread returns an associative array containing * a tree of messages threaded by REFERENCES. - * + * * Every message in the current mailbox will be represented by three entries * in the resulting array: - * - * + * + * * $thread["XX.num"] - current message number - * - * + * + * * $thread["XX.next"] - * - * + * + * * $thread["XX.branch"] - * - * + * + * * @throws ImapException - * + * */ -function imap_thread($imap_stream, int $options = SE_FREE): array +function imap_thread(\IMAP\Connection $imap, int $flags = SE_FREE): array { error_clear_last(); - $result = \imap_thread($imap_stream, $options); + $result = \imap_thread($imap, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1394,7 +2180,7 @@ function imap_thread($imap_stream, int $options = SE_FREE): array /** * Sets or fetches the imap timeout. - * + * * @param int $timeout_type One of the following: * IMAP_OPENTIMEOUT, * IMAP_READTIMEOUT, @@ -1403,12 +2189,12 @@ function imap_thread($imap_stream, int $options = SE_FREE): array * @param int $timeout The timeout, in seconds. * @return mixed If the timeout parameter is set, this function * returns TRUE on success. - * + * * If timeout is not provided or evaluates to -1, * the current timeout value of timeout_type is * returned as an integer. * @throws ImapException - * + * */ function imap_timeout(int $timeout_type, int $timeout = -1) { @@ -1424,18 +2210,19 @@ function imap_timeout(int $timeout_type, int $timeout = -1) /** * Removes the deletion flag for a specified message, which is set by * imap_delete or imap_mail_move. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. - * @param int $msg_number The message number - * @param int $flags + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. + * @param string $message_nums A string representing one or more messages in IMAP4-style sequence format + * ("n", "n:m", or combination of these + * delimited by commas). + * @param int $flags * @throws ImapException - * + * */ -function imap_undelete($imap_stream, int $msg_number, int $flags = 0): void +function imap_undelete(\IMAP\Connection $imap, string $message_nums, int $flags = 0): void { error_clear_last(); - $result = \imap_undelete($imap_stream, $msg_number, $flags); + $result = \imap_undelete($imap, $message_nums, $flags); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1444,18 +2231,17 @@ function imap_undelete($imap_stream, int $msg_number, int $flags = 0): void /** * Unsubscribe from the specified mailbox. - * - * @param resource $imap_stream An IMAP stream returned by - * imap_open. + * + * @param \IMAP\Connection $imap An IMAP\Connection instance. * @param string $mailbox The mailbox name, see imap_open for more * information * @throws ImapException - * + * */ -function imap_unsubscribe($imap_stream, string $mailbox): void +function imap_unsubscribe(\IMAP\Connection $imap, string $mailbox): void { error_clear_last(); - $result = \imap_unsubscribe($imap_stream, $mailbox); + $result = \imap_unsubscribe($imap, $mailbox); if ($result === false) { throw ImapException::createFromPhpError(); } @@ -1464,18 +2250,20 @@ function imap_unsubscribe($imap_stream, string $mailbox): void /** * Encode a UTF-8 string to modified UTF-7 (as specified in RFC 2060, section 5.1.3). - * - * @param string $in A UTF-8 encoded string. - * @return string Returns in converted to modified UTF-7. + * + * @param string $string A UTF-8 encoded string. + * @return string Returns string converted to modified UTF-7. * @throws ImapException - * + * */ -function imap_utf8_to_mutf7(string $in): string +function imap_utf8_to_mutf7(string $string): string { error_clear_last(); - $result = \imap_utf8_to_mutf7($in); + $result = \imap_utf8_to_mutf7($string); if ($result === false) { throw ImapException::createFromPhpError(); } return $result; } + + diff --git a/generated/info.php b/generated/info.php index 1a76b406..05ea5270 100644 --- a/generated/info.php +++ b/generated/info.php @@ -8,10 +8,10 @@ * Sets the process title visible in tools such as top and * ps. This function is available only in * CLI mode. - * + * * @param string $title The new title. * @throws InfoException - * + * */ function cli_set_process_title(string $title): void { @@ -25,49 +25,49 @@ function cli_set_process_title(string $title): void /** * Loads the PHP extension given by the parameter - * library. - * + * extension_filename. + * * Use extension_loaded to test whether a given * extension is already available or not. This works on both built-in * extensions and dynamically loaded ones (either through php.ini or * dl). - * - * @param string $library This parameter is only the filename of the + * + * @param string $extension_filename This parameter is only the filename of the * extension to load which also depends on your platform. For example, * the sockets extension (if compiled - * as a shared module, not the default!) would be called + * as a shared module, not the default!) would be called * sockets.so on Unix platforms whereas it is called * php_sockets.dll on the Windows platform. - * + * * The directory where the extension is loaded from depends on your * platform: - * + * * Windows - If not explicitly set in the php.ini, the extension is * loaded from C:\php5\ by default. - * + * * Unix - If not explicitly set in the php.ini, the default extension * directory depends on - * - * - * + * + * + * * whether PHP has been built with --enable-debug * or not - * - * - * - * + * + * + * + * * whether PHP has been built with (experimental) ZTS (Zend Thread Safety) * support or not - * - * - * - * + * + * + * + * * the current internal ZEND_MODULE_API_NO (Zend * internal module API number, which is basically the date on which a * major module API change happened, e.g. 20010901) - * - * - * + * + * + * * Taking into account the above, the directory then defaults to * <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, * e.g. @@ -75,29 +75,47 @@ function cli_set_process_title(string $title): void * or * /usr/local/php/lib/php/extensions/no-debug-zts-20010901. * @throws InfoException - * + * */ -function dl(string $library): void +function dl(string $extension_filename): void { error_clear_last(); - $result = \dl($library); + $result = \dl($extension_filename); if ($result === false) { throw InfoException::createFromPhpError(); } } +/** + * + * + * @return string Returns the path, as a string. + * @throws InfoException + * + */ +function get_include_path(): string +{ + error_clear_last(); + $result = \get_include_path(); + if ($result === false) { + throw InfoException::createFromPhpError(); + } + return $result; +} + + /** * Gets the time of the last modification of the main script of execution. - * + * * If you're interested in getting the last modification time * of a different file, consider using filemtime. - * + * * @return int Returns the time of the last modification of the current * page. The value returned is a Unix timestamp, suitable for * feeding to date. * @throws InfoException - * + * */ function getlastmod(): int { @@ -111,11 +129,11 @@ function getlastmod(): int /** - * - * + * + * * @return int Returns the group ID of the current script. * @throws InfoException - * + * */ function getmygid(): int { @@ -130,10 +148,10 @@ function getmygid(): int /** * Gets the inode of the current script. - * + * * @return int Returns the current script's inode as an integer. * @throws InfoException - * + * */ function getmyinode(): int { @@ -148,10 +166,10 @@ function getmyinode(): int /** * Gets the current PHP process ID. - * + * * @return int Returns the current PHP process ID. * @throws InfoException - * + * */ function getmypid(): int { @@ -165,11 +183,11 @@ function getmypid(): int /** - * - * + * + * * @return int Returns the user ID of the current script. * @throws InfoException - * + * */ function getmyuid(): int { @@ -184,24 +202,41 @@ function getmyuid(): int /** * Parses options passed to the script. - * - * @param string $options - * @param array $longopts - * @param int|null $optind + * + * @param string $short_options + * @param array $long_options + * @param int $rest_index * @return array|array|array This function will return an array of option / argument pairs. * @throws InfoException - * + * */ -function getopt(string $options, array $longopts = null, ?int &$optind = null): array +function getopt(string $short_options, array $long_options = [], int &$rest_index = null): array { error_clear_last(); - if ($optind !== null) { - $result = \getopt($options, $longopts, $optind); - } elseif ($longopts !== null) { - $result = \getopt($options, $longopts); - } else { - $result = \getopt($options); + $result = \getopt($short_options, $long_options, $rest_index); + if ($result === false) { + throw InfoException::createFromPhpError(); } + return $result; +} + + +/** + * This is an interface to getrusage(2). It gets data returned + * from the system call. + * + * @param int $mode If mode is 1, getrusage will be called with + * RUSAGE_CHILDREN. + * @return array Returns an associative array containing the data returned from the system + * call. All entries are accessible by using their documented field names. + * Returns FALSE on failure. + * @throws InfoException + * + */ +function getrusage(int $mode = 0): array +{ + error_clear_last(); + $result = \getrusage($mode); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -211,18 +246,18 @@ function getopt(string $options, array $longopts = null, ?int &$optind = null): /** * Returns the value of the configuration option on success. - * - * @param string $varname The configuration option name. + * + * @param string $option The configuration option name. * @return string Returns the value of the configuration option as a string on success, or an * empty string for null values. Returns FALSE if the * configuration option doesn't exist. * @throws InfoException - * + * */ -function ini_get(string $varname): string +function ini_get(string $option): string { error_clear_last(); - $result = \ini_get($varname); + $result = \ini_get($option); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -234,19 +269,46 @@ function ini_get(string $varname): string * Sets the value of the given configuration option. The configuration option * will keep this new value during the script's execution, and will be restored * at the script's ending. - * - * @param string $varname Not all the available options can be changed using + * + * @param string $option Not all the available options can be changed using * ini_set. There is a list of all available options * in the appendix. - * @param string|int|float|bool $newvalue The new value for the option. + * @param $value The new value for the option. * @return string Returns the old value on success, FALSE on failure. * @throws InfoException - * + * + */ +function ini_set(string $option, $value): string +{ + error_clear_last(); + $result = \ini_set($option, $value); + if ($result === false) { + throw InfoException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @return string Returns the interface type, as a lowercase string. + * + * Although not exhaustive, the possible return values include + * apache, + * apache2handler, + * cgi (until PHP 5.3), + * cgi-fcgi, cli, cli-server, + * embed, fpm-fcgi, + * litespeed, + * phpdbg. + * @throws InfoException + * */ -function ini_set(string $varname, $newvalue): string +function php_sapi_name(): string { error_clear_last(); - $result = \ini_set($varname, $newvalue); + $result = \php_sapi_name(); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -258,75 +320,75 @@ function ini_set(string $varname, $newvalue): string * This function prints out the credits listing the PHP developers, * modules, etc. It generates the appropriate HTML codes to insert * the information in a page. - * - * @param int $flag To generate a custom credits page, you may want to use the - * flag parameter. - * - * + * + * @param int $flags To generate a custom credits page, you may want to use the + * flags parameter. + * + * * Pre-defined phpcredits flags - * - * - * + * + * + * * name * description - * - * - * - * + * + * + * + * * CREDITS_ALL - * + * * All the credits, equivalent to using: CREDITS_DOCS + * CREDITS_GENERAL + CREDITS_GROUP + * CREDITS_MODULES + CREDITS_FULLPAGE. * It generates a complete stand-alone HTML page with the appropriate tags. - * - * - * + * + * + * * CREDITS_DOCS * The credits for the documentation team - * - * + * + * * CREDITS_FULLPAGE - * + * * Usually used in combination with the other flags. Indicates * that a complete stand-alone HTML page needs to be * printed including the information indicated by the other * flags. - * - * - * + * + * + * * CREDITS_GENERAL - * - * General credits: Language design and concept, PHP authors + * + * General credits: Language design and concept, PHP authors * and SAPI module. - * - * - * + * + * + * * CREDITS_GROUP * A list of the core developers - * - * + * + * * CREDITS_MODULES - * + * * A list of the extension modules for PHP, and their authors - * - * - * + * + * + * * CREDITS_SAPI - * + * * A list of the server API modules for PHP, and their authors - * - * - * - * - * + * + * + * + * + * * @throws InfoException - * + * */ -function phpcredits(int $flag = CREDITS_ALL): void +function phpcredits(int $flags = CREDITS_ALL): void { error_clear_last(); - $result = \phpcredits($flag); + $result = \phpcredits($flags); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -334,109 +396,109 @@ function phpcredits(int $flag = CREDITS_ALL): void /** - * Outputs a large amount of information about the current state of PHP. + * Outputs a large amount of information about the current state of PHP. * This includes information about PHP compilation options and extensions, * the PHP version, server information and environment (if compiled as a * module), the PHP environment, OS version information, paths, master and * local values of configuration options, HTTP headers, and the PHP License. - * + * * Because every system is setup differently, phpinfo is * commonly used to check configuration settings and for available * predefined variables * on a given system. - * + * * phpinfo is also a valuable debugging tool as it * contains all EGPCS (Environment, GET, POST, Cookie, Server) data. - * - * @param int $what The output may be customized by passing one or more of the + * + * @param int $flags The output may be customized by passing one or more of the * following constants bitwise values summed - * together in the optional what parameter. + * together in the optional flags parameter. * One can also combine the respective constants or bitwise values * together with the bitwise or operator. - * - * + * + * * phpinfo options - * - * - * + * + * + * * Name (constant) * Value * Description - * - * - * - * + * + * + * + * * INFO_GENERAL * 1 - * + * * The configuration line, php.ini location, build date, Web * Server, System and more. - * - * - * + * + * + * * INFO_CREDITS * 2 - * + * * PHP Credits. See also phpcredits. - * - * - * + * + * + * * INFO_CONFIGURATION * 4 - * + * * Current Local and Master values for PHP directives. See * also ini_get. - * - * - * + * + * + * * INFO_MODULES * 8 - * + * * Loaded modules and their respective settings. See also * get_loaded_extensions. - * - * - * + * + * + * * INFO_ENVIRONMENT * 16 - * + * * Environment Variable information that's also available in * $_ENV. - * - * - * + * + * + * * INFO_VARIABLES * 32 - * - * Shows all + * + * Shows all * predefined variables from EGPCS (Environment, GET, * POST, Cookie, Server). - * - * - * + * + * + * * INFO_LICENSE * 64 - * + * * PHP License information. See also the license FAQ. - * - * - * + * + * + * * INFO_ALL * -1 - * + * * Shows all of the above. - * - * - * - * - * + * + * + * + * + * * @throws InfoException - * + * */ -function phpinfo(int $what = INFO_ALL): void +function phpinfo(int $flags = INFO_ALL): void { error_clear_last(); - $result = \phpinfo($what); + $result = \phpinfo($flags); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -444,19 +506,19 @@ function phpinfo(int $what = INFO_ALL): void /** - * Adds setting to the server environment. The + * Adds assignment to the server environment. The * environment variable will only exist for the duration of the current * request. At the end of the request the environment is restored to its * original state. - * - * @param string $setting The setting, like "FOO=BAR" + * + * @param string $assignment The setting, like "FOO=BAR" * @throws InfoException - * + * */ -function putenv(string $setting): void +function putenv(string $assignment): void { error_clear_last(); - $result = \putenv($setting); + $result = \putenv($assignment); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -466,17 +528,17 @@ function putenv(string $setting): void /** * Sets the include_path * configuration option for the duration of the script. - * - * @param string $new_include_path The new value for the include_path + * + * @param string $include_path The new value for the include_path * @return string Returns the old include_path on * success. * @throws InfoException - * + * */ -function set_include_path(string $new_include_path): string +function set_include_path(string $include_path): string { error_clear_last(); - $result = \set_include_path($new_include_path); + $result = \set_include_path($include_path); if ($result === false) { throw InfoException::createFromPhpError(); } @@ -489,17 +551,17 @@ function set_include_path(string $new_include_path): string * the script returns a fatal error. The default limit is 30 seconds or, if * it exists, the max_execution_time value defined in the * php.ini. - * + * * When called, set_time_limit restarts the timeout * counter from zero. In other words, if the timeout is the default 30 * seconds, and 25 seconds into script execution a call such as * set_time_limit(20) is made, the script will run for a * total of 45 seconds before timing out. - * + * * @param int $seconds The maximum execution time, in seconds. If set to zero, no time limit * is imposed. * @throws InfoException - * + * */ function set_time_limit(int $seconds): void { @@ -509,3 +571,5 @@ function set_time_limit(int $seconds): void throw InfoException::createFromPhpError(); } } + + diff --git a/generated/ingres-ii.php b/generated/ingres-ii.php deleted file mode 100644 index 9ea8b5f3..00000000 --- a/generated/ingres-ii.php +++ /dev/null @@ -1,720 +0,0 @@ - - * - * - * @param array $serverctrls Array of LDAP Controls to send with the request. + * + * + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_add($link_identifier, string $dn, array $entry, array $serverctrls = null): void +function ldap_add(\LDAP\Connection $ldap, string $dn, array $entry, $controls = null): void { error_clear_last(); - $result = \ldap_add($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_add($ldap, $dn, $entry, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } } -/** - * Does the same thing as ldap_bind but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string|null $bind_rdn - * @param string|null $bind_password - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. - * @throws LdapException - * - */ -function ldap_bind_ext($link_identifier, ?string $bind_rdn = null, ?string $bind_password = null, array $serverctrls = null) -{ - error_clear_last(); - $result = \ldap_bind_ext($link_identifier, $bind_rdn, $bind_password, $serverctrls); - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - /** * Binds to the LDAP directory with specified RDN and password. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param string|null $bind_rdn - * @param string|null $bind_password + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param $dn + * @param $password * @throws LdapException - * + * */ -function ldap_bind($link_identifier, ?string $bind_rdn = null, ?string $bind_password = null): void +function ldap_bind(\LDAP\Connection $ldap, $dn = null, $password = null): void { error_clear_last(); - $result = \ldap_bind($link_identifier, $bind_rdn, $bind_password); + $result = \ldap_bind($ldap, $dn, $password); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -98,15 +78,15 @@ function ldap_bind($link_identifier, ?string $bind_rdn = null, ?string $bind_pas /** * Retrieve the pagination information send by the server. - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. - * @param resource $result + * + * @param resource $link An LDAP resource, returned by ldap_connect. + * @param resource $result * @param string|null $cookie An opaque structure sent by the server. * @param int|null $estimated The estimated number of entries to retrieve. * @throws LdapException - * + * */ -function ldap_control_paged_result_response($link, $result, ?string &$cookie = null, ?int &$estimated = null): void +function ldap_control_paged_result_response( $link, $result, ?string &$cookie = null, ?int &$estimated = null): void { error_clear_last(); $result = \ldap_control_paged_result_response($link, $result, $cookie, $estimated); @@ -118,18 +98,18 @@ function ldap_control_paged_result_response($link, $result, ?string &$cookie = n /** * Enable LDAP pagination by sending the pagination control (page size, cookie...). - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. + * + * @param resource $link An LDAP resource, returned by ldap_connect. * @param int $pagesize The number of entries by page. - * @param bool $iscritical Indicates whether the pagination is critical or not. + * @param bool $iscritical Indicates whether the pagination is critical or not. * If true and if the server doesn't support pagination, the search * will return no result. - * @param string $cookie An opaque structure sent by the server + * @param string $cookie An opaque structure sent by the server * (ldap_control_paged_result_response). * @throws LdapException - * + * */ -function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ""): void +function ldap_control_paged_result( $link, int $pagesize, bool $iscritical = false, string $cookie = ""): void { error_clear_last(); $result = \ldap_control_paged_result($link, $pagesize, $iscritical, $cookie); @@ -142,17 +122,17 @@ function ldap_control_paged_result($link, int $pagesize, bool $iscritical = fals /** * Returns the number of entries stored in the result of previous search * operations. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_identifier The internal LDAP result. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param resource $result An LDAP\Result instance, returned by ldap_list or ldap_search. * @return int Returns number of entries in the result. * @throws LdapException - * + * */ -function ldap_count_entries($link_identifier, $result_identifier): int +function ldap_count_entries(\LDAP\Connection $ldap, $result): int { error_clear_last(); - $result = \ldap_count_entries($link_identifier, $result_identifier); + $result = \ldap_count_entries($ldap, $result); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -161,64 +141,63 @@ function ldap_count_entries($link_identifier, $result_identifier): int /** - * Does the same thing as ldap_delete but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string $dn - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. + * Deletes a particular entry in LDAP directory. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param string $dn The distinguished name of an LDAP entity. + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_delete_ext($link_identifier, string $dn, array $serverctrls = null) +function ldap_delete(\LDAP\Connection $ldap, string $dn, $controls = null): void { error_clear_last(); - $result = \ldap_delete_ext($link_identifier, $dn, $serverctrls); + $result = \ldap_delete($ldap, $dn, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } - return $result; } /** - * Deletes a particular entry in LDAP directory. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * Turns the specified dn, into a more user-friendly + * form, stripping off type names. + * * @param string $dn The distinguished name of an LDAP entity. - * @param array $serverctrls Array of LDAP Controls to send with the request. + * @return string Returns the user friendly name. * @throws LdapException - * + * */ -function ldap_delete($link_identifier, string $dn, array $serverctrls = null): void +function ldap_dn2ufn(string $dn): string { error_clear_last(); - $result = \ldap_delete($link_identifier, $dn, $serverctrls); + $result = \ldap_dn2ufn($dn); if ($result === false) { throw LdapException::createFromPhpError(); } + return $result; } /** * Performs a PASSWD extended operation. - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $user dn of the user to change the password of. - * @param string $oldpw The old password of this user. May be ommited depending of server configuration. - * @param string $newpw The new password for this user. May be omitted or empty to have a generated password. - * @param array $serverctrls If provided, a password policy request control is send with the request and this is + * @param string $old_password The old password of this user. May be ommited depending of server configuration. + * @param string $new_password The new password for this user. May be omitted or empty to have a generated password. + * @param array $controls If provided, a password policy request control is send with the request and this is * filled with an array of LDAP Controls * returned with the request. - * @return mixed Returns the generated password if newpw is empty or omitted. + * @return mixed Returns the generated password if new_password is empty or omitted. * Otherwise returns TRUE on success. * @throws LdapException - * + * */ -function ldap_exop_passwd($link, string $user = "", string $oldpw = "", string $newpw = "", array &$serverctrls = null) +function ldap_exop_passwd(\LDAP\Connection $ldap, string $user = "", string $old_password = "", string $new_password = "", array &$controls = null) { error_clear_last(); - $result = \ldap_exop_passwd($link, $user, $oldpw, $newpw, $serverctrls); + $result = \ldap_exop_passwd($ldap, $user, $old_password, $new_password, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -228,16 +207,16 @@ function ldap_exop_passwd($link, string $user = "", string $oldpw = "", string $ /** * Performs a WHOAMI extended operation and returns the data. - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @return string The data returned by the server. * @throws LdapException - * + * */ -function ldap_exop_whoami($link): string +function ldap_exop_whoami(\LDAP\Connection $ldap): string { error_clear_last(); - $result = \ldap_exop_whoami($link); + $result = \ldap_exop_whoami($ldap); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -249,8 +228,8 @@ function ldap_exop_whoami($link): string * Performs an extended operation on the specified link with * reqoid the OID of the operation and * reqdata the data. - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $reqoid The extended operation request OID. You may use one of LDAP_EXOP_START_TLS, LDAP_EXOP_MODIFY_PASSWD, LDAP_EXOP_REFRESH, LDAP_EXOP_WHO_AM_I, LDAP_EXOP_TURN, or a string with the OID of the operation you want to send. * @param string $reqdata The extended operation request data. May be NULL for some operations like LDAP_EXOP_WHO_AM_I, may also need to be BER encoded. * @param array|null $serverctrls Array of LDAP Controls to send with the request. @@ -261,12 +240,12 @@ function ldap_exop_whoami($link): string * @return mixed When used with retdata, returns TRUE on success. * When used without retdata, returns a result identifier. * @throws LdapException - * + * */ -function ldap_exop($link, string $reqoid, string $reqdata = null, ?array $serverctrls = null, ?string &$retdata = null, ?string &$retoid = null) +function ldap_exop(\LDAP\Connection $ldap, string $reqoid, string $reqdata = null, ?array $serverctrls = null, ?string &$retdata = null, ?string &$retoid = null) { error_clear_last(); - $result = \ldap_exop($link, $reqoid, $reqdata, $serverctrls, $retdata, $retoid); + $result = \ldap_exop($ldap, $reqoid, $reqdata, $serverctrls, $retdata, $retoid); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -278,7 +257,7 @@ function ldap_exop($link, string $reqoid, string $reqdata = null, ?array $server * Splits the DN returned by ldap_get_dn and breaks it * up into its component parts. Each part is known as Relative Distinguished * Name, or RDN. - * + * * @param string $dn The distinguished name of an LDAP entity. * @param int $with_attrib Used to request if the RDNs are returned with only values or their * attributes as well. To get RDNs with the attributes (i.e. in @@ -289,7 +268,7 @@ function ldap_exop($link, string $reqoid, string $reqdata = null, ?array $server * represents the number of returned values, next elements are numerically * indexed DN components. * @throws LdapException - * + * */ function ldap_explode_dn(string $dn, int $with_attrib): array { @@ -305,21 +284,21 @@ function ldap_explode_dn(string $dn, int $with_attrib): array /** * Gets the first attribute in the given entry. Remaining attributes are * retrieved by calling ldap_next_attribute successively. - * + * * Similar to reading entries, attributes are also read one by one from a * particular entry. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. * @return string Returns the first attribute in the entry on success and FALSE on * error. * @throws LdapException - * + * */ -function ldap_first_attribute($link_identifier, $result_entry_identifier): string +function ldap_first_attribute(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry): string { error_clear_last(); - $result = \ldap_first_attribute($link_identifier, $result_entry_identifier); + $result = \ldap_first_attribute($ldap, $entry); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -331,22 +310,21 @@ function ldap_first_attribute($link_identifier, $result_entry_identifier): strin * Returns the entry identifier for first entry in the result. This entry * identifier is then supplied to ldap_next_entry * routine to get successive entries from the result. - * + * * Entries in the LDAP result are read sequentially using the * ldap_first_entry and * ldap_next_entry functions. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_identifier - * @return resource Returns the result entry identifier for the first entry on success and - * FALSE on error. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\Result $result An LDAP\Result instance, returned by ldap_list or ldap_search. + * @return resource Returns an LDAP\ResultEntry instance. * @throws LdapException - * + * */ -function ldap_first_entry($link_identifier, $result_identifier) +function ldap_first_entry(\LDAP\Connection $ldap, \LDAP\Result $result) { error_clear_last(); - $result = \ldap_first_entry($link_identifier, $result_identifier); + $result = \ldap_first_entry($ldap, $result); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -357,20 +335,20 @@ function ldap_first_entry($link_identifier, $result_identifier) /** * Frees up the memory allocated internally to store the result. All result * memory will be automatically freed when the script terminates. - * + * * Typically all the memory allocated for the LDAP result gets freed at the * end of the script. In case the script is making successive searches which * return large result sets, ldap_free_result could be * called to keep the runtime memory usage by the script low. - * - * @param resource $result_identifier + * + * @param \LDAP\Result $result An LDAP\Result instance, returned by ldap_list or ldap_search. * @throws LdapException - * + * */ -function ldap_free_result($result_identifier): void +function ldap_free_result(\LDAP\Result $result): void { error_clear_last(); - $result = \ldap_free_result($result_identifier); + $result = \ldap_free_result($result); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -379,30 +357,30 @@ function ldap_free_result($result_identifier): void /** * Reads attributes and values from an entry in the search result. - * + * * Having located a specific entry in the directory, you can find out what * information is held for that entry by using this call. You would use this * call for an application which "browses" directory entries and/or where you * do not know the structure of the directory entries. In many applications * you will be searching for a specific attribute such as an email address or * a surname, and won't care what other data is held. - * - * - * - * - * - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier + * + * + * + * + * + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. * @return array Returns a complete entry information in a multi-dimensional array * on success and FALSE on error. * @throws LdapException - * + * */ -function ldap_get_attributes($link_identifier, $result_entry_identifier): array +function ldap_get_attributes(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry): array { error_clear_last(); - $result = \ldap_get_attributes($link_identifier, $result_entry_identifier); + $result = \ldap_get_attributes($ldap, $entry); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -412,17 +390,17 @@ function ldap_get_attributes($link_identifier, $result_entry_identifier): array /** * Finds out the DN of an entry in the result. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. * @return string Returns the DN of the result entry and FALSE on error. * @throws LdapException - * + * */ -function ldap_get_dn($link_identifier, $result_entry_identifier): string +function ldap_get_dn(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry): string { error_clear_last(); - $result = \ldap_get_dn($link_identifier, $result_entry_identifier); + $result = \ldap_get_dn($ldap, $entry); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -433,28 +411,28 @@ function ldap_get_dn($link_identifier, $result_entry_identifier): string /** * Reads multiple entries from the given result, and then reading the * attributes and multiple values. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_identifier + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\Result $result An LDAP\Result instance, returned by ldap_list or ldap_search. * @return array Returns a complete result information in a multi-dimensional array on - * success and FALSE on error. - * + * success. + * * The structure of the array is as follows. * The attribute index is converted to lowercase. (Attributes are * case-insensitive for directory servers, but not when used as * array indices.) - * - * - * - * - * + * + * + * + * + * * @throws LdapException - * + * */ -function ldap_get_entries($link_identifier, $result_identifier): array +function ldap_get_entries(\LDAP\Connection $ldap, \LDAP\Result $result): array { error_clear_last(); - $result = \ldap_get_entries($link_identifier, $result_identifier); + $result = \ldap_get_entries($ldap, $result); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -463,191 +441,191 @@ function ldap_get_entries($link_identifier, $result_identifier): array /** - * Sets retval to the value of the specified option. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * Sets value to the value of the specified option. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param int $option The parameter option can be one of: - * - * - * - * + * + * + * + * * Option * Type * since - * - * - * - * + * + * + * + * * LDAP_OPT_DEREF - * integer - * - * - * + * int + * + * + * * LDAP_OPT_SIZELIMIT - * integer - * - * - * + * int + * + * + * * LDAP_OPT_TIMELIMIT - * integer - * - * - * + * int + * + * + * * LDAP_OPT_NETWORK_TIMEOUT - * integer - * - * - * + * int + * + * + * * LDAP_OPT_PROTOCOL_VERSION - * integer - * - * - * + * int + * + * + * * LDAP_OPT_ERROR_NUMBER - * integer - * - * - * + * int + * + * + * * LDAP_OPT_DIAGNOSTIC_MESSAGE - * integer - * - * - * + * int + * + * + * * LDAP_OPT_REFERRALS - * bool - * - * - * + * int + * + * + * * LDAP_OPT_RESTART - * bool - * - * - * + * int + * + * + * * LDAP_OPT_HOST_NAME * string - * - * - * + * + * + * * LDAP_OPT_ERROR_STRING * string - * - * - * + * + * + * * LDAP_OPT_MATCHED_DN * string - * - * - * + * + * + * * LDAP_OPT_SERVER_CONTROLS * array - * - * - * + * + * + * * LDAP_OPT_CLIENT_CONTROLS * array - * - * - * + * + * + * * LDAP_OPT_X_KEEPALIVE_IDLE * int * 7.1 - * - * + * + * * LDAP_OPT_X_KEEPALIVE_PROBES * int * 7.1 - * - * + * + * * LDAP_OPT_X_KEEPALIVE_INTERVAL * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CACERTDIR * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CACERTFILE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CERTFILE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CIPHER_SUITE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CRLCHECK - * integer + * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CRL_NONE - * integer + * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CRL_PEER - * integer + * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CRL_ALL - * integer + * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_CRLFILE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_DHFILE * string * 7.1 - * - * - * LDAP_OPT_X_TLS_KEYILE + * + * + * LDAP_OPT_X_TLS_KEYFILE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_PACKAGE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_PROTOCOL_MIN - * integer + * int * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_RANDOM_FILE * string * 7.1 - * - * + * + * * LDAP_OPT_X_TLS_REQUIRE_CERT - * integer - * - * - * - * - * - * @param mixed $retval This will be set to the option value. + * int + * + * + * + * + * + * @param $value This will be set to the option value. * @throws LdapException - * + * */ -function ldap_get_option($link_identifier, int $option, &$retval): void +function ldap_get_option(\LDAP\Connection $ldap, int $option, &$value = null): void { error_clear_last(); - $result = \ldap_get_option($link_identifier, $option, $retval); + $result = \ldap_get_option($ldap, $option, $value); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -656,24 +634,24 @@ function ldap_get_option($link_identifier, int $option, &$retval): void /** * Reads all the values of the attribute in the entry in the result. - * + * * This function is used exactly like ldap_get_values * except that it handles binary data and not string data. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier - * @param string $attribute + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. + * @param string $attribute * @return array Returns an array of values for the attribute on success and FALSE on * error. Individual values are accessed by integer index in the array. The * first index is 0. The number of values can be found by indexing "count" * in the resultant array. * @throws LdapException - * + * */ -function ldap_get_values_len($link_identifier, $result_entry_identifier, string $attribute): array +function ldap_get_values_len(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry, string $attribute): array { error_clear_last(); - $result = \ldap_get_values_len($link_identifier, $result_entry_identifier, $attribute); + $result = \ldap_get_values_len($ldap, $entry, $attribute); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -683,161 +661,41 @@ function ldap_get_values_len($link_identifier, $result_entry_identifier, string /** * Reads all the values of the attribute in the entry in the result. - * - * This call needs a result_entry_identifier, + * + * This call needs a entry, * so needs to be preceded by one of the ldap search calls and one * of the calls to get an individual entry. - * + * * You application will either be hard coded to look for certain * attributes (such as "surname" or "mail") or you will have to use * the ldap_get_attributes call to work out * what attributes exist for a given entry. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier - * @param string $attribute + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. + * @param string $attribute * @return array Returns an array of values for the attribute on success and FALSE on * error. The number of values can be found by indexing "count" in the * resultant array. Individual values are accessed by integer index in the * array. The first index is 0. - * + * * LDAP allows more than one entry for an attribute, so it can, for example, * store a number of email addresses for one person's directory entry all * labeled with the attribute "mail" - * - * + * + * * return_value["count"] = number of values for attribute * return_value[0] = first value of attribute * return_value[i] = ith value of attribute - * - * + * + * * @throws LdapException - * + * */ -function ldap_get_values($link_identifier, $result_entry_identifier, string $attribute): array +function ldap_get_values(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry, string $attribute): array { error_clear_last(); - $result = \ldap_get_values($link_identifier, $result_entry_identifier, $attribute); - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - -/** - * Performs the search for a specified filter on the - * directory with the scope LDAP_SCOPE_ONELEVEL. - * - * LDAP_SCOPE_ONELEVEL means that the search should only - * return information that is at the level immediately below the - * base_dn given in the call. - * (Equivalent to typing "ls" and getting a list of files and folders in the - * current working directory.) - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param string $base_dn The base DN for the directory. - * @param string $filter - * @param array $attributes An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - * - * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - * @param int $attrsonly Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - * @param int $sizelimit Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - * - * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - * - * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - * @param int $timelimit Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - * - * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - * @param int $deref Specifies how aliases should be handled during the search. It can be - * one of the following: - * - * - * - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * - * - * - * - * LDAP_DEREF_SEARCHING - aliases should be - * dereferenced during the search but not when locating the base object - * of the search. - * - * - * - * - * LDAP_DEREF_FINDING - aliases should be - * dereferenced when locating the base object but not during the search. - * - * - * - * - * LDAP_DEREF_ALWAYS - aliases should be dereferenced - * always. - * - * - * - * @param array $serverctrls Array of LDAP Controls to send with the request. - * @return resource Returns a search result identifier. - * @throws LdapException - * - */ -function ldap_list($link_identifier, string $base_dn, string $filter, array $attributes = null, int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $serverctrls = null) -{ - error_clear_last(); - if ($serverctrls !== null) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $serverctrls); - } elseif ($deref !== LDAP_DEREF_NEVER) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref); - } elseif ($timelimit !== -1) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit); - } elseif ($sizelimit !== -1) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit); - } elseif ($attrsonly !== 0) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes, $attrsonly); - } elseif ($attributes !== null) { - $result = \ldap_list($link_identifier, $base_dn, $filter, $attributes); - } else { - $result = \ldap_list($link_identifier, $base_dn, $filter); - } - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - -/** - * Does the same thing as ldap_mod_add but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string $dn - * @param array $entry - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. - * @throws LdapException - * - */ -function ldap_mod_add_ext($link_identifier, string $dn, array $entry, array $serverctrls = null) -{ - error_clear_last(); - $result = \ldap_mod_add_ext($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_get_values($ldap, $entry, $attribute); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -848,105 +706,61 @@ function ldap_mod_add_ext($link_identifier, string $dn, array $entry, array $ser /** * Adds one or more attribute values to the specified dn. * To add a whole new object see ldap_add function. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $dn The distinguished name of an LDAP entity. * @param array $entry An associative array listing the attirbute values to add. If an attribute was not existing yet it will be added. If an attribute is existing you can only add values to it if it supports multiple values. - * @param array $serverctrls Array of LDAP Controls to send with the request. + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_mod_add($link_identifier, string $dn, array $entry, array $serverctrls = null): void +function ldap_mod_add(\LDAP\Connection $ldap, string $dn, array $entry, $controls = null): void { error_clear_last(); - $result = \ldap_mod_add($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_mod_add($ldap, $dn, $entry, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } } -/** - * Does the same thing as ldap_mod_del but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string $dn - * @param array $entry - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. - * @throws LdapException - * - */ -function ldap_mod_del_ext($link_identifier, string $dn, array $entry, array $serverctrls = null) -{ - error_clear_last(); - $result = \ldap_mod_del_ext($link_identifier, $dn, $entry, $serverctrls); - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - /** * Removes one or more attribute values from the specified dn. * Object deletions are done by the * ldap_delete function. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $dn The distinguished name of an LDAP entity. - * @param array $entry - * @param array $serverctrls Array of LDAP Controls to send with the request. + * @param array $entry + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_mod_del($link_identifier, string $dn, array $entry, array $serverctrls = null): void +function ldap_mod_del(\LDAP\Connection $ldap, string $dn, array $entry, $controls = null): void { error_clear_last(); - $result = \ldap_mod_del($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_mod_del($ldap, $dn, $entry, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } } -/** - * Does the same thing as ldap_mod_replace but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string $dn - * @param array $entry - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. - * @throws LdapException - * - */ -function ldap_mod_replace_ext($link_identifier, string $dn, array $entry, array $serverctrls = null) -{ - error_clear_last(); - $result = \ldap_mod_replace_ext($link_identifier, $dn, $entry, $serverctrls); - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - /** * Replaces one or more attributes from the specified dn. * It may also add or remove attributes. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $dn The distinguished name of an LDAP entity. * @param array $entry An associative array listing the attributes to replace. Sending an empty array as value will remove the attribute, while sending an attribute not existing yet on this entry will add it. - * @param array $serverctrls Array of LDAP Controls to send with the request. + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_mod_replace($link_identifier, string $dn, array $entry, array $serverctrls = null): void +function ldap_mod_replace(\LDAP\Connection $ldap, string $dn, array $entry, $controls = null): void { error_clear_last(); - $result = \ldap_mod_replace($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_mod_replace($ldap, $dn, $entry, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -956,92 +770,92 @@ function ldap_mod_replace($link_identifier, string $dn, array $entry, array $ser /** * Modifies an existing entry in the LDAP directory. Allows detailed * specification of the modifications to perform. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP resource, returned by ldap_connect. * @param string $dn The distinguished name of an LDAP entity. - * @param array $entry An array that specifies the modifications to make. Each entry in this + * @param array $modifications_info An array that specifies the modifications to make. Each entry in this * array is an associative array with two or three keys: * attrib maps to the name of the attribute to modify, * modtype maps to the type of modification to perform, * and (depending on the type of modification) values * maps to an array of attribute values relevant to the modification. - * + * * Possible values for modtype include: - * - * + * + * * LDAP_MODIFY_BATCH_ADD - * - * + * + * * Each value specified through values is added (as * an additional value) to the attribute named by * attrib. - * - * - * - * + * + * + * + * * LDAP_MODIFY_BATCH_REMOVE - * - * + * + * * Each value specified through values is removed * from the attribute named by attrib. Any value of * the attribute not contained in the values array * will remain untouched. - * - * - * - * + * + * + * + * * LDAP_MODIFY_BATCH_REMOVE_ALL - * - * + * + * * All values are removed from the attribute named by * attrib. A values entry must * not be provided. - * - * - * - * + * + * + * + * * LDAP_MODIFY_BATCH_REPLACE - * - * + * + * * All current values of the attribute named by * attrib are replaced with the values specified * through values. - * - * - * - * - * + * + * + * + * + * * Each value specified through values is added (as * an additional value) to the attribute named by * attrib. - * + * * Each value specified through values is removed * from the attribute named by attrib. Any value of * the attribute not contained in the values array * will remain untouched. - * + * * All values are removed from the attribute named by * attrib. A values entry must * not be provided. - * + * * All current values of the attribute named by * attrib are replaced with the values specified * through values. - * + * * Note that any value for attrib must be a string, any * value for values must be an array of strings, and * any value for modtype must be one of the * LDAP_MODIFY_BATCH_* constants listed above. - * @param array $serverctrls Each value specified through values is added (as + * @param $controls Each value specified through values is added (as * an additional value) to the attribute named by * attrib. * @throws LdapException - * + * */ -function ldap_modify_batch($link_identifier, string $dn, array $entry, array $serverctrls = null): void +function ldap_modify_batch(\LDAP\Connection $ldap, string $dn, array $modifications_info, $controls = null): void { error_clear_last(); - $result = \ldap_modify_batch($link_identifier, $dn, $entry, $serverctrls); + $result = \ldap_modify_batch($ldap, $dn, $modifications_info, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1051,20 +865,20 @@ function ldap_modify_batch($link_identifier, string $dn, array $entry, array $se /** * Retrieves the attributes in an entry. The first call to * ldap_next_attribute is made with the - * result_entry_identifier returned from + * entry returned from * ldap_first_attribute. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param resource $result_entry_identifier + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param \LDAP\ResultEntry $entry An LDAP\ResultEntry instance. * @return string Returns the next attribute in an entry on success and FALSE on * error. * @throws LdapException - * + * */ -function ldap_next_attribute($link_identifier, $result_entry_identifier): string +function ldap_next_attribute(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry): string { error_clear_last(); - $result = \ldap_next_attribute($link_identifier, $result_entry_identifier); + $result = \ldap_next_attribute($ldap, $entry); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1074,18 +888,18 @@ function ldap_next_attribute($link_identifier, $result_entry_identifier): string /** * Parse LDAP extended operation data from result object result - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. - * @param resource $result An LDAP result resource, returned by ldap_exop. - * @param string|null $retdata Will be filled by the response data. - * @param string|null $retoid Will be filled by the response OID. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param resource $result An LDAP\Result instance, returned by ldap_list or ldap_search. + * @param string $response_data Will be filled by the response data. + * @param string $response_oid Will be filled by the response OID. * @throws LdapException - * + * */ -function ldap_parse_exop($link, $result, ?string &$retdata = null, ?string &$retoid = null): void +function ldap_parse_exop(\LDAP\Connection $ldap, $result, string &$response_data = null, string &$response_oid = null): void { error_clear_last(); - $result = \ldap_parse_exop($link, $result, $retdata, $retoid); + $result = \ldap_parse_exop($ldap, $result, $response_data, $response_oid); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1094,171 +908,49 @@ function ldap_parse_exop($link, $result, ?string &$retdata = null, ?string &$ret /** * Parses an LDAP search result. - * - * @param resource $link An LDAP link identifier, returned by ldap_connect. - * @param resource $result An LDAP result resource, returned by ldap_list or - * ldap_search. - * @param int|null $errcode A reference to a variable that will be set to the LDAP error code in + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. + * @param resource $result An LDAP\Result instance, returned by ldap_list or ldap_search. + * @param int $error_code A reference to a variable that will be set to the LDAP error code in * the result, or 0 if no error occurred. - * @param string|null $matcheddn A reference to a variable that will be set to a matched DN if one was + * @param string $matched_dn A reference to a variable that will be set to a matched DN if one was * recognised within the request, otherwise it will be set to NULL. - * @param string|null $errmsg A reference to a variable that will be set to the LDAP error message in + * @param string $error_message A reference to a variable that will be set to the LDAP error message in * the result, or an empty string if no error occurred. * @param array|null $referrals A reference to a variable that will be set to an array set * to all of the referral strings in the result, or an empty array if no * referrals were returned. - * @param array|null $serverctrls An array of LDAP Controls which have been sent with the response. - * @throws LdapException - * - */ -function ldap_parse_result($link, $result, ?int &$errcode, ?string &$matcheddn = null, ?string &$errmsg = null, ?array &$referrals = null, ?array &$serverctrls = null): void -{ - error_clear_last(); - $result = \ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls); - if ($result === false) { - throw LdapException::createFromPhpError(); - } -} - - -/** - * Performs the search for a specified filter on the - * directory with the scope LDAP_SCOPE_BASE. So it is - * equivalent to reading an entry from the directory. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param string $base_dn The base DN for the directory. - * @param string $filter An empty filter is not allowed. If you want to retrieve absolutely all - * information for this entry, use a filter of - * objectClass=*. If you know which entry types are - * used on the directory server, you might use an appropriate filter such - * as objectClass=inetOrgPerson. - * @param array $attributes An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - * - * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - * @param int $attrsonly Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - * @param int $sizelimit Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - * - * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - * - * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - * @param int $timelimit Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - * - * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - * @param int $deref Specifies how aliases should be handled during the search. It can be - * one of the following: - * - * - * - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * - * - * - * - * LDAP_DEREF_SEARCHING - aliases should be - * dereferenced during the search but not when locating the base object - * of the search. - * - * - * - * - * LDAP_DEREF_FINDING - aliases should be - * dereferenced when locating the base object but not during the search. - * - * - * - * - * LDAP_DEREF_ALWAYS - aliases should be dereferenced - * always. - * - * - * - * @param array $serverctrls Array of LDAP Controls to send with the request. - * @return resource Returns a search result identifier. - * @throws LdapException - * - */ -function ldap_read($link_identifier, string $base_dn, string $filter, array $attributes = null, int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $serverctrls = null) -{ - error_clear_last(); - if ($serverctrls !== null) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $serverctrls); - } elseif ($deref !== LDAP_DEREF_NEVER) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref); - } elseif ($timelimit !== -1) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit); - } elseif ($sizelimit !== -1) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit); - } elseif ($attrsonly !== 0) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes, $attrsonly); - } elseif ($attributes !== null) { - $result = \ldap_read($link_identifier, $base_dn, $filter, $attributes); - } else { - $result = \ldap_read($link_identifier, $base_dn, $filter); - } - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - -/** - * Does the same thing as ldap_rename but returns the LDAP result resource to be parsed with ldap_parse_result. - * - * @param resource $link_identifier - * @param string $dn - * @param string $newrdn - * @param string $newparent - * @param bool $deleteoldrdn - * @param array $serverctrls - * @return resource Returns an LDAP result identifier. + * @param array $controls An array of LDAP Controls which have been sent with the response. * @throws LdapException - * + * */ -function ldap_rename_ext($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $serverctrls = null) +function ldap_parse_result(\LDAP\Connection $ldap, $result, int &$error_code, string &$matched_dn = null, string &$error_message = null, ?array &$referrals = null, array &$controls = null): void { error_clear_last(); - $result = \ldap_rename_ext($link_identifier, $dn, $newrdn, $newparent, $deleteoldrdn, $serverctrls); + $result = \ldap_parse_result($ldap, $result, $error_code, $matched_dn, $error_message, $referrals, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } - return $result; } /** * The entry specified by dn is renamed/moved. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @param string $dn The distinguished name of an LDAP entity. - * @param string $newrdn The new RDN. - * @param string $newparent The new parent/superior entry. - * @param bool $deleteoldrdn If TRUE the old RDN value(s) is removed, else the old RDN value(s) + * @param string $new_rdn The new RDN. + * @param string $new_parent The new parent/superior entry. + * @param bool $delete_old_rdn If TRUE the old RDN value(s) is removed, else the old RDN value(s) * is retained as non-distinguished values of the entry. - * @param array $serverctrls Array of LDAP Controls to send with the request. + * @param $controls Array of LDAP Controls to send with the request. * @throws LdapException - * + * */ -function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $serverctrls = null): void +function ldap_rename(\LDAP\Connection $ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, $controls = null): void { error_clear_last(); - $result = \ldap_rename($link_identifier, $dn, $newrdn, $newparent, $deleteoldrdn, $serverctrls); + $result = \ldap_rename($ldap, $dn, $new_rdn, $new_parent, $delete_old_rdn, $controls); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1266,23 +958,23 @@ function ldap_rename($link_identifier, string $dn, string $newrdn, string $newpa /** - * - * - * @param resource $link - * @param string $binddn - * @param string $password - * @param string $sasl_mech - * @param string $sasl_realm - * @param string $sasl_authc_id - * @param string $sasl_authz_id - * @param string $props + * + * + * @param \LDAP\Connection $ldap + * @param $dn + * @param string $password + * @param $mech + * @param $realm + * @param $authc_id + * @param $authz_id + * @param string $props * @throws LdapException - * + * */ -function ldap_sasl_bind($link, string $binddn = null, string $password = null, string $sasl_mech = null, string $sasl_realm = null, string $sasl_authc_id = null, string $sasl_authz_id = null, string $props = null): void +function ldap_sasl_bind(\LDAP\Connection $ldap, $dn = null, string $password = null, $mech = null, $realm = null, $authc_id = null, $authz_id = null, string $props = null): void { error_clear_last(); - $result = \ldap_sasl_bind($link, $binddn, $password, $sasl_mech, $sasl_realm, $sasl_authc_id, $sasl_authz_id, $props); + $result = \ldap_sasl_bind($ldap, $dn, $password, $mech, $realm, $authc_id, $authz_id, $props); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1290,276 +982,165 @@ function ldap_sasl_bind($link, string $binddn = null, string $password = null, s /** - * Performs the search for a specified filter on the directory with the scope - * of LDAP_SCOPE_SUBTREE. This is equivalent to searching - * the entire directory. - * - * From 4.0.5 on it's also possible to do parallel searches. To do this - * you use an array of link identifiers, rather than a single identifier, - * as the first argument. If you don't want the same base DN and the - * same filter for all the searches, you can also use an array of base DNs - * and/or an array of filters. Those arrays must be of the same size as - * the link identifier array since the first entries of the arrays are - * used for one search, the second entries are used for another, and so - * on. When doing parallel searches an array of search result - * identifiers is returned, except in case of error, then the entry - * corresponding to the search will be FALSE. This is very much like - * the value normally returned, except that a result identifier is always - * returned when a search was made. There are some rare cases where the - * normal search returns FALSE while the parallel search returns an - * identifier. - * - * @param resource|array $link_identifier An LDAP link identifier, returned by ldap_connect. - * @param string $base_dn The base DN for the directory. - * @param string $filter The search filter can be simple or advanced, using boolean operators in - * the format described in the LDAP documentation (see the Netscape Directory SDK or - * RFC4515 for full - * information on filters). - * @param array $attributes An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - * - * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - * @param int $attrsonly Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - * @param int $sizelimit Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - * - * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - * - * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - * @param int $timelimit Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - * - * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - * @param int $deref Specifies how aliases should be handled during the search. It can be - * one of the following: - * - * - * - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * - * - * - * - * LDAP_DEREF_SEARCHING - aliases should be - * dereferenced during the search but not when locating the base object - * of the search. - * - * - * - * - * LDAP_DEREF_FINDING - aliases should be - * dereferenced when locating the base object but not during the search. - * - * - * - * - * LDAP_DEREF_ALWAYS - aliases should be dereferenced - * always. - * - * - * - * @param array $serverctrls Array of LDAP Controls to send with the request. - * @return resource Returns a search result identifier. - * @throws LdapException - * - */ -function ldap_search($link_identifier, string $base_dn, string $filter, array $attributes = null, int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $serverctrls = null) -{ - error_clear_last(); - if ($serverctrls !== null) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref, $serverctrls); - } elseif ($deref !== LDAP_DEREF_NEVER) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref); - } elseif ($timelimit !== -1) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit); - } elseif ($sizelimit !== -1) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes, $attrsonly, $sizelimit); - } elseif ($attrsonly !== 0) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes, $attrsonly); - } elseif ($attributes !== null) { - $result = \ldap_search($link_identifier, $base_dn, $filter, $attributes); - } else { - $result = \ldap_search($link_identifier, $base_dn, $filter); - } - if ($result === false) { - throw LdapException::createFromPhpError(); - } - return $result; -} - - -/** - * Sets the value of the specified option to be newval. - * - * @param resource|null $link_identifier An LDAP link identifier, returned by ldap_connect. + * Sets the value of the specified option to be value. + * + * @param $ldap An LDAP\Connection instance, returned by ldap_connect. * @param int $option The parameter option can be one of: - * - * - * - * + * + * + * + * * Option * Type * Available since - * - * - * - * + * + * + * + * * LDAP_OPT_DEREF - * integer - * - * - * + * int + * + * + * * LDAP_OPT_SIZELIMIT - * integer - * - * - * + * int + * + * + * * LDAP_OPT_TIMELIMIT - * integer - * - * - * + * int + * + * + * * LDAP_OPT_NETWORK_TIMEOUT - * integer - * PHP 5.3.0 - * - * + * int + * + * + * * LDAP_OPT_PROTOCOL_VERSION - * integer - * - * - * + * int + * + * + * * LDAP_OPT_ERROR_NUMBER - * integer - * - * - * + * int + * + * + * * LDAP_OPT_REFERRALS * bool - * - * - * + * + * + * * LDAP_OPT_RESTART * bool - * - * - * + * + * + * * LDAP_OPT_HOST_NAME * string - * - * - * + * + * + * * LDAP_OPT_ERROR_STRING * string - * - * - * + * + * + * * LDAP_OPT_DIAGNOSTIC_MESSAGE * string - * - * - * + * + * + * * LDAP_OPT_MATCHED_DN * string - * - * - * + * + * + * * LDAP_OPT_SERVER_CONTROLS * array - * - * - * + * + * + * * LDAP_OPT_CLIENT_CONTROLS * array - * - * - * + * + * + * * LDAP_OPT_X_KEEPALIVE_IDLE * int * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_KEEPALIVE_PROBES * int * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_KEEPALIVE_INTERVAL * int * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CACERTDIR * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CACERTFILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CERTFILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CIPHER_SUITE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CRLCHECK - * integer + * int * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_CRLFILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_DHFILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_KEYFILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_PROTOCOL_MIN - * integer + * int * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_RANDOM_FILE * string * PHP 7.1.0 - * - * + * + * * LDAP_OPT_X_TLS_REQUIRE_CERT - * integer + * int * PHP 7.0.5 - * - * - * - * - * - * LDAP_OPT_SERVER_CONTROLS and + * + * + * + * + * + * LDAP_OPT_SERVER_CONTROLS and * LDAP_OPT_CLIENT_CONTROLS require a list of * controls, this means that the value must be an array of controls. A * control consists of an oid identifying the control, @@ -1572,14 +1153,14 @@ function ldap_search($link_identifier, string $base_dn, string $filter, array $a * iscritical defaults to FALSE * if not supplied. See draft-ietf-ldapext-ldap-c-api-xx.txt * for details. See also the second example below. - * @param mixed $newval The new value for the specified option. + * @param $value The new value for the specified option. * @throws LdapException - * + * */ -function ldap_set_option($link_identifier, int $option, $newval): void +function ldap_set_option( $ldap, int $option, $value): void { error_clear_last(); - $result = \ldap_set_option($link_identifier, $option, $newval); + $result = \ldap_set_option($ldap, $option, $value); if ($result === false) { throw LdapException::createFromPhpError(); } @@ -1588,16 +1169,18 @@ function ldap_set_option($link_identifier, int $option, $newval): void /** * Unbinds from the LDAP directory. - * - * @param resource $link_identifier An LDAP link identifier, returned by ldap_connect. + * + * @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect. * @throws LdapException - * + * */ -function ldap_unbind($link_identifier): void +function ldap_unbind(\LDAP\Connection $ldap): void { error_clear_last(); - $result = \ldap_unbind($link_identifier); + $result = \ldap_unbind($ldap); if ($result === false) { throw LdapException::createFromPhpError(); } } + + diff --git a/generated/libxml.php b/generated/libxml.php index cef784c4..85813677 100644 --- a/generated/libxml.php +++ b/generated/libxml.php @@ -6,11 +6,11 @@ /** * Retrieve last error from libxml. - * + * * @return \LibXMLError Returns a LibXMLError object if there is any error in the * buffer, FALSE otherwise. * @throws LibxmlException - * + * */ function libxml_get_last_error(): \LibXMLError { @@ -23,21 +23,3 @@ function libxml_get_last_error(): \LibXMLError } -/** - * Changes the default external entity loader. - * - * @param callable $resolver_function A callable that takes three arguments. Two strings, a public id - * and system id, and a context (an array with four keys) as the third argument. - * This callback should return a resource, a string from which a resource can be - * opened, or NULL. - * @throws LibxmlException - * - */ -function libxml_set_external_entity_loader(callable $resolver_function): void -{ - error_clear_last(); - $result = \libxml_set_external_entity_loader($resolver_function); - if ($result === false) { - throw LibxmlException::createFromPhpError(); - } -} diff --git a/generated/lzf.php b/generated/lzf.php index 7fce838a..3e97b604 100644 --- a/generated/lzf.php +++ b/generated/lzf.php @@ -7,11 +7,11 @@ /** * lzf_compress compresses the given * data string using LZF encoding. - * + * * @param string $data The string to compress. * @return string Returns the compressed data. * @throws LzfException - * + * */ function lzf_compress(string $data): string { @@ -27,11 +27,11 @@ function lzf_compress(string $data): string /** * lzf_compress decompresses the given * data string containing lzf encoded data. - * + * * @param string $data The compressed string. * @return string Returns the decompressed data. * @throws LzfException - * + * */ function lzf_decompress(string $data): string { @@ -42,3 +42,5 @@ function lzf_decompress(string $data): string } return $result; } + + diff --git a/generated/mailparse.php b/generated/mailparse.php index 1bae182a..97473d9f 100644 --- a/generated/mailparse.php +++ b/generated/mailparse.php @@ -6,32 +6,32 @@ /** * Extracts/decodes a message section from the supplied filename. - * + * * The contents of the section will be decoded according to their transfer * encoding - base64, quoted-printable and uuencoded text are supported. - * + * * @param resource $mimemail A valid MIME resource, created with * mailparse_msg_create. * @param mixed $filename Can be a file name or a valid stream resource. * @param callable $callbackfunc If set, this must be either a valid callback that will be passed the * extracted section, or NULL to make this function return the * extracted section. - * + * * If not specified, the contents will be sent to "stdout". * @return string If callbackfunc is not NULL returns TRUE on * success. - * + * * If callbackfunc is set to NULL, returns the * extracted section as a string. * @throws MailparseException - * + * */ -function mailparse_msg_extract_part_file($mimemail, $filename, callable $callbackfunc = null): string +function mailparse_msg_extract_part_file( $mimemail, $filename, callable $callbackfunc = null): string { error_clear_last(); if ($callbackfunc !== null) { $result = \mailparse_msg_extract_part_file($mimemail, $filename, $callbackfunc); - } else { + }else { $result = \mailparse_msg_extract_part_file($mimemail, $filename); } if ($result === false) { @@ -43,14 +43,14 @@ function mailparse_msg_extract_part_file($mimemail, $filename, callable $callbac /** * Frees a MIME resource. - * + * * @param resource $mimemail A valid MIME resource allocated by - * mailparse_msg_create or + * mailparse_msg_create or * mailparse_msg_parse_file. * @throws MailparseException - * + * */ -function mailparse_msg_free($mimemail): void +function mailparse_msg_free( $mimemail): void { error_clear_last(); $result = \mailparse_msg_free($mimemail); @@ -63,15 +63,15 @@ function mailparse_msg_free($mimemail): void /** * Parses a file. * This is the optimal way of parsing a mail file that you have on disk. - * + * * @param string $filename Path to the file holding the message. * The file is opened and streamed through the parser. - * + * * The message contained in filename is supposed to end with a newline * (CRLF); otherwise the last line of the message will not be parsed. * @return resource Returns a MIME resource representing the structure. * @throws MailparseException - * + * */ function mailparse_msg_parse_file(string $filename) { @@ -86,17 +86,17 @@ function mailparse_msg_parse_file(string $filename) /** * Incrementally parse data into the supplied mime mail resource. - * + * * This function allow you to stream portions of a file at a time, rather * than read and parse the whole thing. - * + * * @param resource $mimemail A valid MIME resource. * @param string $data The final chunk of data is supposed to end with a newline * (CRLF); otherwise the last line of the message will not be parsed. * @throws MailparseException - * + * */ -function mailparse_msg_parse($mimemail, string $data): void +function mailparse_msg_parse( $mimemail, string $data): void { error_clear_last(); $result = \mailparse_msg_parse($mimemail, $data); @@ -107,17 +107,17 @@ function mailparse_msg_parse($mimemail, string $data): void /** - * Streams data from the source file pointer, apply + * Streams data from the source file pointer, apply * encoding and write to the destination file pointer. - * + * * @param resource $sourcefp A valid file handle. The file is streamed through the parser. * @param resource $destfp The destination file handle in which the encoded data will be written. * @param string $encoding One of the character encodings supported by the * mbstring module. * @throws MailparseException - * + * */ -function mailparse_stream_encode($sourcefp, $destfp, string $encoding): void +function mailparse_stream_encode( $sourcefp, $destfp, string $encoding): void { error_clear_last(); $result = \mailparse_stream_encode($sourcefp, $destfp, $encoding); @@ -125,3 +125,5 @@ function mailparse_stream_encode($sourcefp, $destfp, string $encoding): void throw MailparseException::createFromPhpError(); } } + + diff --git a/generated/mbstring.php b/generated/mbstring.php index fa082943..9a2a081e 100644 --- a/generated/mbstring.php +++ b/generated/mbstring.php @@ -5,22 +5,59 @@ use Safe\Exceptions\MbstringException; /** - * - * - * @param int $cp - * @param string $encoding - * @return string Returns a specific character. + * Returns a string containing the character specified by the Unicode code point value, + * encoded in the specified encoding. + * + * This function complements mb_ord. + * + * @param int $codepoint A Unicode codepoint value, e.g. 128024 for U+1F418 ELEPHANT + * @param string $encoding The encoding + * parameter is the character encoding. If it is omitted or NULL, the internal character + * encoding value will be used. + * @return string A string containing the requested character, if it can be represented in the specified + * encoding. * @throws MbstringException - * + * */ -function mb_chr(int $cp, string $encoding = null): string +function mb_chr(int $codepoint, string $encoding = null): string { error_clear_last(); - if ($encoding !== null) { - $result = \mb_chr($cp, $encoding); - } else { - $result = \mb_chr($cp); + $result = \mb_chr($codepoint, $encoding); + if ($result === false) { + throw MbstringException::createFromPhpError(); } + return $result; +} + + +/** + * Converts string from from_encoding, + * or the current internal encoding, to to_encoding. + * If string is an array, all its string values will be + * converted recursively. + * + * @param $string The string or array to be converted. + * @param string $to_encoding The desired encoding of the result. + * @param mixed $from_encoding The current encoding used to interpret string. + * Multiple encodings may be specified as an array or comma separated + * list, in which case the correct encoding will be guessed using the + * same algorithm as mb_detect_encoding. + * + * If from_encoding is NULL or not specified, the + * mbstring.internal_encoding setting + * will be used if set, otherwise the default_charset setting. + * + * See supported encodings + * for valid values of to_encoding + * and from_encoding. + * @return string The encoded string or array on success. + * @throws MbstringException + * + */ +function mb_convert_encoding( $string, string $to_encoding, $from_encoding = null): string +{ + error_clear_last(); + $result = \mb_convert_encoding($string, $to_encoding, $from_encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -30,41 +67,37 @@ function mb_chr(int $cp, string $encoding = null): string /** * Sets the automatic character - * encoding detection order to encoding_list. - * - * @param mixed $encoding_list encoding_list is an array or + * encoding detection order to encoding. + * + * @param $encoding encoding is an array or * comma separated list of character encoding. See supported encodings. - * - * If encoding_list is omitted, it returns + * + * If encoding is omitted or NULL, it returns * the current character encoding detection order as array. - * + * * This setting affects mb_detect_encoding and * mb_send_mail. - * + * * mbstring currently implements the following * encoding detection filters. If there is an invalid byte sequence * for the following encodings, encoding detection will fail. - * + * * For ISO-8859-*, mbstring * always detects as ISO-8859-*. - * + * * For UTF-16, UTF-32, * UCS2 and UCS4, encoding * detection will fail always. * @return bool|array When setting the encoding detection order, TRUE is returned on success. - * + * * When getting the encoding detection order, an ordered array of the encodings is returned. * @throws MbstringException - * + * */ -function mb_detect_order($encoding_list = null) +function mb_detect_order( $encoding = null) { error_clear_last(); - if ($encoding_list !== null) { - $result = \mb_detect_order($encoding_list); - } else { - $result = \mb_detect_order(); - } + $result = \mb_detect_order($encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -74,11 +107,11 @@ function mb_detect_order($encoding_list = null) /** * Returns an array of aliases for a known encoding type. - * + * * @param string $encoding The encoding type being checked, for aliases. * @return array Returns a numerically indexed array of encoding aliases on success * @throws MbstringException - * + * */ function mb_encoding_aliases(string $encoding): array { @@ -95,19 +128,19 @@ function mb_encoding_aliases(string $encoding): array * Scans string for matches to * pattern, then replaces the matched text * with the output of callback function. - * - * The behavior of this function is almost identical to mb_ereg_replace, + * + * The behavior of this function is almost identical to mb_ereg_replace, * except for the fact that instead of * replacement parameter, one should specify a * callback. - * + * * @param string $pattern The regular expression pattern. - * + * * Multibyte characters may be used in pattern. * @param callable $callback A callback that will be called and passed an array of matched elements * in the subject string. The callback should * return the replacement string. - * + * * You'll often need the callback function * for a mb_ereg_replace_callback in just one place. * In this case you can use an @@ -118,15 +151,17 @@ function mb_encoding_aliases(string $encoding): array * clutter the function namespace with a callback function's name * not used anywhere else. * @param string $string The string being checked. - * @param string $option The search option. See mb_regex_set_options for explanation. + * @param $options The search option. See mb_regex_set_options for explanation. * @return string The resultant string on success. + * If string is not valid for the current encoding, NULL + * is returned. * @throws MbstringException - * + * */ -function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, string $option = "msr"): string +function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, $options = null): string { error_clear_last(); - $result = \mb_ereg_replace_callback($pattern, $callback, $string, $option); + $result = \mb_ereg_replace_callback($pattern, $callback, $string, $options); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -135,22 +170,24 @@ function mb_ereg_replace_callback(string $pattern, callable $callback, string $s /** - * - * + * + * * @param string $pattern The regular expression pattern. - * + * * Multibyte characters may be used in pattern. * @param string $replacement The replacement text. * @param string $string The string being checked. - * @param string $option + * @param $options * @return string The resultant string on success. + * If string is not valid for the current encoding, NULL + * is returned. * @throws MbstringException - * + * */ -function mb_ereg_replace(string $pattern, string $replacement, string $string, string $option = "msr"): string +function mb_ereg_replace(string $pattern, string $replacement, string $string, $options = null): string { error_clear_last(); - $result = \mb_ereg_replace($pattern, $replacement, $string, $option); + $result = \mb_ereg_replace($pattern, $replacement, $string, $options); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -159,11 +196,11 @@ function mb_ereg_replace(string $pattern, string $replacement, string $string, s /** - * - * - * @return array + * + * + * @return array * @throws MbstringException - * + * */ function mb_ereg_search_getregs(): array { @@ -183,23 +220,17 @@ function mb_ereg_search_getregs(): array * mb_ereg_search, * mb_ereg_search_pos, and * mb_ereg_search_regs. - * + * * @param string $string The search string. * @param string $pattern The search pattern. - * @param string $option The search option. See mb_regex_set_options for explanation. + * @param $options The search option. See mb_regex_set_options for explanation. * @throws MbstringException - * + * */ -function mb_ereg_search_init(string $string, string $pattern = null, string $option = "msr"): void +function mb_ereg_search_init(string $string, string $pattern = null, $options = null): void { error_clear_last(); - if ($option !== "msr") { - $result = \mb_ereg_search_init($string, $pattern, $option); - } elseif ($pattern !== null) { - $result = \mb_ereg_search_init($string, $pattern); - } else { - $result = \mb_ereg_search_init($string); - } + $result = \mb_ereg_search_init($string, $pattern, $options); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -208,23 +239,17 @@ function mb_ereg_search_init(string $string, string $pattern = null, string $opt /** * Returns the matched part of a multibyte regular expression. - * + * * @param string $pattern The search pattern. - * @param string $option The search option. See mb_regex_set_options for explanation. - * @return array + * @param $options The search option. See mb_regex_set_options for explanation. + * @return array * @throws MbstringException - * + * */ -function mb_ereg_search_regs(string $pattern = null, string $option = "ms"): array +function mb_ereg_search_regs(string $pattern = null, $options = null): array { error_clear_last(); - if ($option !== "ms") { - $result = \mb_ereg_search_regs($pattern, $option); - } elseif ($pattern !== null) { - $result = \mb_ereg_search_regs($pattern); - } else { - $result = \mb_ereg_search_regs(); - } + $result = \mb_ereg_search_regs($pattern, $options); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -233,16 +258,16 @@ function mb_ereg_search_regs(string $pattern = null, string $option = "ms"): arr /** - * - * - * @param int $position The position to set. If it is negative, it counts from the end of the string. + * + * + * @param int $offset The position to set. If it is negative, it counts from the end of the string. * @throws MbstringException - * + * */ -function mb_ereg_search_setpos(int $position): void +function mb_ereg_search_setpos(int $offset): void { error_clear_last(); - $result = \mb_ereg_search_setpos($position); + $result = \mb_ereg_search_setpos($offset); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -250,20 +275,60 @@ function mb_ereg_search_setpos(int $position): void /** - * - * + * + * * @param string $pattern The regular expression pattern. Multibyte characters may be used. The case will be ignored. - * @param string $replace The replacement text. + * @param string $replacement The replacement text. * @param string $string The searched string. - * @param string $option - * @return string The resultant string. + * @param $options + * @return string The resultant string. + * If string is not valid for the current encoding, NULL + * is returned. + * @throws MbstringException + * + */ +function mb_eregi_replace(string $pattern, string $replacement, string $string, $options = null): string +{ + error_clear_last(); + $result = \mb_eregi_replace($pattern, $replacement, $string, $options); + if ($result === false) { + throw MbstringException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param string $type If type is not specified or is specified as "all", + * "internal_encoding", "http_input", + * "http_output", "http_output_conv_mimetypes", + * "mail_charset", "mail_header_encoding", + * "mail_body_encoding", "illegal_chars", + * "encoding_translation", "language", + * "detect_order", "substitute_character" + * and "strict_detection" + * will be returned. + * + * If type is specified as + * "internal_encoding", "http_input", + * "http_output", "http_output_conv_mimetypes", + * "mail_charset", "mail_header_encoding", + * "mail_body_encoding", "illegal_chars", + * "encoding_translation", "language", + * "detect_order", "substitute_character" + * or "strict_detection" + * the specified setting parameter will be returned. + * @return mixed An array of type information if type + * is not specified, otherwise a specific type. * @throws MbstringException - * + * */ -function mb_eregi_replace(string $pattern, string $replace, string $string, string $option = "msri"): string +function mb_get_info(string $type = "all") { error_clear_last(); - $result = \mb_eregi_replace($pattern, $replace, $string, $option); + $result = \mb_get_info($type); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -274,29 +339,25 @@ function mb_eregi_replace(string $pattern, string $replace, string $string, stri /** * Set/Get the HTTP output character encoding. * Output after this function is called will be converted from the set internal encoding to encoding. - * + * * @param string $encoding If encoding is set, * mb_http_output sets the HTTP output character * encoding to encoding. - * + * * If encoding is omitted, * mb_http_output returns the current HTTP output * character encoding. * @return string|bool If encoding is omitted, * mb_http_output returns the current HTTP output - * character encoding. Otherwise, + * character encoding. Otherwise, * Returns TRUE on success. * @throws MbstringException - * + * */ function mb_http_output(string $encoding = null) { error_clear_last(); - if ($encoding !== null) { - $result = \mb_http_output($encoding); - } else { - $result = \mb_http_output(); - } + $result = \mb_http_output($encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -306,28 +367,24 @@ function mb_http_output(string $encoding = null) /** * Set/Get the internal character encoding - * - * @param string $encoding encoding is the character encoding name - * used for the HTTP input character encoding conversion, HTTP output - * character encoding conversion, and the default character encoding + * + * @param string $encoding encoding is the character encoding name + * used for the HTTP input character encoding conversion, HTTP output + * character encoding conversion, and the default character encoding * for string functions defined by the mbstring module. * You should notice that the internal encoding is totally different from the one for multibyte regex. - * @return string|bool If encoding is set, then + * @return string|bool If encoding is set, then * Returns TRUE on success. * In this case, the character encoding for multibyte regex is NOT changed. - * If encoding is omitted, then + * If encoding is omitted, then * the current character encoding name is returned. * @throws MbstringException - * + * */ function mb_internal_encoding(string $encoding = null) { error_clear_last(); - if ($encoding !== null) { - $result = \mb_internal_encoding($encoding); - } else { - $result = \mb_internal_encoding(); - } + $result = \mb_internal_encoding($encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -336,22 +393,22 @@ function mb_internal_encoding(string $encoding = null) /** - * - * - * @param string $str - * @param string $encoding - * @return int Returns a code point of character. + * Returns the Unicode code point value of the given character. + * + * This function complements mb_chr. + * + * @param string $string A string + * @param $encoding The encoding + * parameter is the character encoding. If it is omitted or NULL, the internal character + * encoding value will be used. + * @return int The Unicode code point for the first character of string. * @throws MbstringException - * + * */ -function mb_ord(string $str, string $encoding = null): int +function mb_ord(string $string, $encoding = null): int { error_clear_last(); - if ($encoding !== null) { - $result = \mb_ord($str, $encoding); - } else { - $result = \mb_ord($str); - } + $result = \mb_ord($string, $encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -366,16 +423,16 @@ function mb_ord(string $str, string $encoding = null): int * encoded data, detects encoding, converts coding to internal * encoding and set values to the result array or * global variables. - * - * @param string $encoded_string The URL encoded data. + * + * @param string $string The URL encoded data. * @param array|null $result An array containing decoded and character encoded converted values. * @throws MbstringException - * + * */ -function mb_parse_str(string $encoded_string, ?array &$result): void +function mb_parse_str(string $string, ?array &$result): void { error_clear_last(); - $result = \mb_parse_str($encoded_string, $result); + $result = \mb_parse_str($string, $result); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -384,22 +441,18 @@ function mb_parse_str(string $encoded_string, ?array &$result): void /** * Set/Get character encoding for a multibyte regex. - * + * * @param string $encoding The encoding - * parameter is the character encoding. If it is omitted, the internal character + * parameter is the character encoding. If it is omitted or NULL, the internal character * encoding value will be used. - * @return string|bool + * @return string|bool * @throws MbstringException - * + * */ function mb_regex_encoding(string $encoding = null) { error_clear_last(); - if ($encoding !== null) { - $result = \mb_regex_encoding($encoding); - } else { - $result = \mb_regex_encoding(); - } + $result = \mb_regex_encoding($encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -411,63 +464,63 @@ function mb_regex_encoding(string $encoding = null) * Sends email. Headers and messages are converted and encoded according * to the mb_language setting. It's a wrapper function * for mail, so see also mail for details. - * + * * @param string $to The mail addresses being sent to. Multiple * recipients may be specified by putting a comma between each - * address in to. + * address in to. * This parameter is not automatically encoded. * @param string $subject The subject of the mail. * @param string $message The message of the mail. * @param string|array|null $additional_headers String or array to be inserted at the end of the email header. - * + * * This is typically used to add extra headers (From, Cc, and Bcc). * Multiple extra headers should be separated with a CRLF (\r\n). * Validate parameter not to be injected unwanted headers by attackers. - * + * * If an array is passed, its keys are the header names and its * values are the respective header values. - * + * * When sending mail, the mail must contain - * a From header. This can be set with the + * a From header. This can be set with the * additional_headers parameter, or a default * can be set in php.ini. - * + * * Failing to do this will result in an error * message similar to Warning: mail(): "sendmail_from" not * set in php.ini or custom "From:" header missing. * The From header sets also * Return-Path under Windows. - * + * * If messages are not received, try using a LF (\n) only. * Some Unix mail transfer agents (most notably * qmail) replace LF by CRLF * automatically (which leads to doubling CR if CRLF is used). * This should be a last resort, as it does not comply with * RFC 2822. - * @param string $additional_parameter additional_parameter is a MTA command line + * @param $additional_params additional_params is a MTA command line * parameter. It is useful when setting the correct Return-Path * header when using sendmail. - * + * * This parameter is escaped by escapeshellcmd internally * to prevent command execution. escapeshellcmd prevents * command execution, but allows to add additional parameters. For security reason, * this parameter should be validated. - * + * * Since escapeshellcmd is applied automatically, some characters * that are allowed as email addresses by internet RFCs cannot be used. Programs * that are required to use these characters mail cannot be used. - * + * * The user that the webserver runs as should be added as a trusted user to the * sendmail configuration to prevent a 'X-Warning' header from being added * to the message when the envelope sender (-f) is set using this method. * For sendmail users, this file is /etc/mail/trusted-users. * @throws MbstringException - * + * */ -function mb_send_mail(string $to, string $subject, string $message, $additional_headers = null, string $additional_parameter = null): void +function mb_send_mail(string $to, string $subject, string $message, $additional_headers = [], $additional_params = null): void { error_clear_last(); - $result = \mb_send_mail($to, $subject, $message, $additional_headers, $additional_parameter); + $result = \mb_send_mail($to, $subject, $message, $additional_headers, $additional_params); if ($result === false) { throw MbstringException::createFromPhpError(); } @@ -475,14 +528,14 @@ function mb_send_mail(string $to, string $subject, string $message, $additional_ /** - * - * + * + * * @param string $pattern The regular expression pattern. * @param string $string The string being split. - * @param int $limit + * @param int $limit * @return array The result as an array. * @throws MbstringException - * + * */ function mb_split(string $pattern, string $string, int $limit = -1): array { @@ -497,30 +550,28 @@ function mb_split(string $pattern, string $string, int $limit = -1): array /** * This function will return an array of strings, it is a version of str_split with support for encodings of variable character size as well as fixed-size encodings of 1,2 or 4 byte characters. - * If the split_length parameter is specified, the string is broken down into chunks of the specified length in characters (not bytes). + * If the length parameter is specified, the string is broken down into chunks of the specified length in characters (not bytes). * The encoding parameter can be optionally specified and it is good practice to do so. - * + * * @param string $string The string to split into characters or chunks. - * @param int $split_length If specified, each element of the returned array will be composed of multiple characters instead of a single character. - * @param string $encoding The encoding - * parameter is the character encoding. If it is omitted, the internal character + * @param int $length If specified, each element of the returned array will be composed of multiple characters instead of a single character. + * @param $encoding The encoding + * parameter is the character encoding. If it is omitted or NULL, the internal character * encoding value will be used. - * + * * A string specifying one of the supported encodings. * @return array mb_str_split returns an array of strings. * @throws MbstringException - * + * */ -function mb_str_split(string $string, int $split_length = 1, string $encoding = null): array +function mb_str_split(string $string, int $length = 1, $encoding = null): array { error_clear_last(); - if ($encoding !== null) { - $result = \mb_str_split($string, $split_length, $encoding); - } else { - $result = \mb_str_split($string, $split_length); - } + $result = \mb_str_split($string, $length, $encoding); if ($result === false) { throw MbstringException::createFromPhpError(); } return $result; } + + diff --git a/generated/misc.php b/generated/misc.php index ff636fd4..565e93cf 100644 --- a/generated/misc.php +++ b/generated/misc.php @@ -6,32 +6,32 @@ /** * Defines a named constant at runtime. - * - * @param string $name The name of the constant. - * + * + * @param string $constant_name The name of the constant. + * * It is possible to define constants with reserved or * even invalid names, whose value can (only) be retrieved with * constant. However, doing so is not recommended. * @param mixed $value The value of the constant. In PHP 5, value must - * be a scalar value (integer, - * float, string, boolean, or + * be a scalar value (int, + * float, string, bool, or * NULL). In PHP 7, array values are also accepted. - * + * * While it is possible to define resource constants, it is * not recommended and may cause unpredictable behavior. - * @param bool $case_insensitive If set to TRUE, the constant will be defined case-insensitive. - * The default behavior is case-sensitive; i.e. + * @param bool $case_insensitive If set to TRUE, the constant will be defined case-insensitive. + * The default behavior is case-sensitive; i.e. * CONSTANT and Constant represent * different values. - * + * * Case-insensitive constants are stored as lower-case. * @throws MiscException - * + * */ -function define(string $name, $value, bool $case_insensitive = false): void +function define(string $constant_name, $value, bool $case_insensitive = false): void { error_clear_last(); - $result = \define($name, $value, $case_insensitive); + $result = \define($constant_name, $value, $case_insensitive); if ($result === false) { throw MiscException::createFromPhpError(); } @@ -42,13 +42,13 @@ function define(string $name, $value, bool $case_insensitive = false): void * Prints out or returns a syntax highlighted version of the code contained * in filename using the colors defined in the * built-in syntax highlighter for PHP. - * + * * Many servers are configured to automatically highlight files * with a phps extension. For example, * example.phps when viewed will show the * syntax highlighted source of the file. To enable this, add this * line to the httpd.conf: - * + * * @param string $filename Path to the PHP file to be highlighted. * @param bool $return Set this parameter to TRUE to make this function return the * highlighted code. @@ -56,7 +56,7 @@ function define(string $name, $value, bool $case_insensitive = false): void * code as a string instead of printing it out. Otherwise, it will return * TRUE on success, FALSE on failure. * @throws MiscException - * + * */ function highlight_file(string $filename, bool $return = false) { @@ -70,21 +70,45 @@ function highlight_file(string $filename, bool $return = false) /** - * - * - * @param string $str The PHP code to be highlighted. This should include the opening tag. + * + * + * @param string $string The PHP code to be highlighted. This should include the opening tag. * @param bool $return Set this parameter to TRUE to make this function return the * highlighted code. * @return string|bool If return is set to TRUE, returns the highlighted * code as a string instead of printing it out. Otherwise, it will return * TRUE on success, FALSE on failure. * @throws MiscException - * + * */ -function highlight_string(string $str, bool $return = false) +function highlight_string(string $string, bool $return = false) { error_clear_last(); - $result = \highlight_string($str, $return); + $result = \highlight_string($string, $return); + if ($result === false) { + throw MiscException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param bool $as_number Whether the high resolution time should be returned as array + * or number. + * @return array{0:int,1:int}|int|float Returns an array of integers in the form [seconds, nanoseconds], if the + * parameter as_number is false. Otherwise the nanoseconds + * are returned as int (64bit platforms) or float + * (32bit platforms). + * Returns FALSE on failure. + * @throws MiscException + * + */ +function hrtime(bool $as_number = false) +{ + error_clear_last(); + $result = \hrtime($as_number); if ($result === false) { throw MiscException::createFromPhpError(); } @@ -95,16 +119,16 @@ function highlight_string(string $str, bool $return = false) /** * Pack given arguments into a binary string according to * format. - * + * * The idea for this function was taken from Perl and all formatting codes * work the same as in Perl. However, there are some formatting codes that are * missing such as Perl's "u" format code. - * + * * Note that the distinction between signed and unsigned values only * affects the function unpack, where as * function pack gives the same result for * signed and unsigned format codes. - * + * * @param string $format The format string consists of format codes * followed by an optional repeater argument. The repeater argument can * be either an integer value or * for repeating to @@ -113,147 +137,143 @@ function highlight_string(string $str, bool $return = false) * absolute position where to put the next data, for everything else the * repeat count specifies how many data arguments are consumed and packed * into the resulting binary string. - * + * * Currently implemented formats are: - * + * * pack format characters - * - * - * + * + * + * * Code * Description - * - * - * - * + * + * + * + * * a * NUL-padded string - * - * + * + * * A * SPACE-padded string - * + * * h * Hex string, low nibble first - * + * * H * Hex string, high nibble first * csigned char - * + * * C * unsigned char - * + * * s * signed short (always 16 bit, machine byte order) - * - * + * + * * S * unsigned short (always 16 bit, machine byte order) - * - * + * + * * n * unsigned short (always 16 bit, big endian byte order) - * - * + * + * * v * unsigned short (always 16 bit, little endian byte order) - * - * + * + * * i * signed integer (machine dependent size and byte order) - * - * + * + * * I * unsigned integer (machine dependent size and byte order) - * - * + * + * * l * signed long (always 32 bit, machine byte order) - * - * + * + * * L * unsigned long (always 32 bit, machine byte order) - * - * + * + * * N * unsigned long (always 32 bit, big endian byte order) - * - * + * + * * V * unsigned long (always 32 bit, little endian byte order) - * - * + * + * * q * signed long long (always 64 bit, machine byte order) - * - * + * + * * Q * unsigned long long (always 64 bit, machine byte order) - * - * + * + * * J * unsigned long long (always 64 bit, big endian byte order) - * - * + * + * * P * unsigned long long (always 64 bit, little endian byte order) - * - * + * + * * f * float (machine dependent size and representation) - * - * + * + * * g * float (machine dependent size, little endian byte order) - * - * + * + * * G * float (machine dependent size, big endian byte order) - * - * + * + * * d * double (machine dependent size and representation) - * - * + * + * * e * double (machine dependent size, little endian byte order) - * - * + * + * * E * double (machine dependent size, big endian byte order) - * - * + * + * * x * NUL byte - * - * + * + * * X * Back up one byte - * - * + * + * * Z - * NUL-padded string (new in PHP 5.5) - * - * + * NUL-padded string + * + * * @ * NUL-fill to absolute position - * - * - * - * - * @param mixed $params + * + * + * + * + * @param mixed $values * @return string Returns a binary string containing data. * @throws MiscException - * + * */ -function pack(string $format, ...$params): string +function pack(string $format, $values): string { error_clear_last(); - if ($params !== []) { - $result = \pack($format, ...$params); - } else { - $result = \pack($format); - } + $result = \pack($format, $values); if ($result === false) { throw MiscException::createFromPhpError(); } @@ -263,7 +283,7 @@ function pack(string $format, ...$params): string /** * Convert string from one codepage to another. - * + * * @param int|string $in_codepage The codepage of the subject string. * Either the codepage name or identifier. * @param int|string $out_codepage The codepage to convert the subject string to. @@ -272,9 +292,9 @@ function pack(string $format, ...$params): string * @return string The subject string converted to * out_codepage. * @throws MiscException - * + * */ -function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject): string +function sapi_windows_cp_conv( $in_codepage, $out_codepage, string $subject): string { error_clear_last(); $result = \sapi_windows_cp_conv($in_codepage, $out_codepage, $subject); @@ -287,15 +307,15 @@ function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject): str /** * Set the codepage of the current process. - * - * @param int $cp A codepage identifier. + * + * @param int $codepage A codepage identifier. * @throws MiscException - * + * */ -function sapi_windows_cp_set(int $cp): void +function sapi_windows_cp_set(int $codepage): void { error_clear_last(); - $result = \sapi_windows_cp_set($cp); + $result = \sapi_windows_cp_set($codepage); if ($result === false) { throw MiscException::createFromPhpError(); } @@ -304,14 +324,14 @@ function sapi_windows_cp_set(int $cp): void /** * Sends a CTRL event to another process in the same process group. - * + * * @param int $event The CTRL even to send; * either PHP_WINDOWS_EVENT_CTRL_C * or PHP_WINDOWS_EVENT_CTRL_BREAK. * @param int $pid The ID of the process to which to send the event to. If 0 * is given, the event is sent to all processes of the process group. * @throws MiscException - * + * */ function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void { @@ -324,29 +344,25 @@ function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void /** - * If enable is omitted, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise. - * - * If enable is specified, the function will try to enable or disable the VT100 features of the stream stream. + * If enable is NULL, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise. + * + * If enable is a bool, the function will try to enable or disable the VT100 features of the stream stream. * If the feature has been successfully enabled (or disabled). - * + * * At startup, PHP tries to enable the VT100 feature of the STDOUT/STDERR streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled. - * - * If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal. + * + * If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal. * They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences. - * + * * @param resource $stream The stream on which the function will operate. - * @param bool $enable If specified, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE). + * @param bool $enable If bool, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE). * @throws MiscException - * + * */ -function sapi_windows_vt100_support($stream, bool $enable = null): void +function sapi_windows_vt100_support( $stream, bool $enable = null): void { error_clear_last(); - if ($enable !== null) { - $result = \sapi_windows_vt100_support($stream, $enable); - } else { - $result = \sapi_windows_vt100_support($stream); - } + $result = \sapi_windows_vt100_support($stream, $enable); if ($result === false) { throw MiscException::createFromPhpError(); } @@ -354,11 +370,11 @@ function sapi_windows_vt100_support($stream, bool $enable = null): void /** - * - * + * + * * @param int $seconds Halt time in seconds. * @return int Returns zero on success. - * + * * If the call was interrupted by a signal, sleep returns * a non-zero value. On Windows, this value will always be * 192 (the value of the @@ -366,7 +382,7 @@ function sapi_windows_vt100_support($stream, bool $enable = null): void * On other platforms, the return value will be the number of seconds left to * sleep. * @throws MiscException - * + * */ function sleep(int $seconds): int { @@ -379,32 +395,53 @@ function sleep(int $seconds): int } +/** + * Returns three samples representing the average system load + * (the number of processes in the system run queue) over the last 1, 5 and 15 + * minutes, respectively. Returns FALSE on failure. + * + * @return array Returns an array with three samples (last 1, 5 and 15 + * minutes). + * @throws MiscException + * + */ +function sys_getloadavg(): array +{ + error_clear_last(); + $result = \sys_getloadavg(); + if ($result === false) { + throw MiscException::createFromPhpError(); + } + return $result; +} + + /** * Delays program execution for the given number of * seconds and nanoseconds. - * + * * @param int $seconds Must be a non-negative integer. * @param int $nanoseconds Must be a non-negative integer less than 1 billion. * @return array{0:int,1:int}|bool Returns TRUE on success. - * + * * If the delay was interrupted by a signal, an associative array will be * returned with the components: - * - * - * + * + * + * * seconds - number of seconds remaining in * the delay - * - * - * - * + * + * + * + * * nanoseconds - number of nanoseconds * remaining in the delay - * - * - * + * + * + * * @throws MiscException - * + * */ function time_nanosleep(int $seconds, int $nanoseconds) { @@ -420,10 +457,10 @@ function time_nanosleep(int $seconds, int $nanoseconds) /** * Makes the script sleep until the specified * timestamp. - * + * * @param float $timestamp The timestamp when the script should wake. * @throws MiscException - * + * */ function time_sleep_until(float $timestamp): void { @@ -438,27 +475,44 @@ function time_sleep_until(float $timestamp): void /** * Unpacks from a binary string into an array according to the given * format. - * + * * The unpacked data is stored in an associative array. To * accomplish this you have to name the different format codes and * separate them by a slash /. If a repeater argument is present, * then each of the array keys will have a sequence number behind * the given name. - * + * + * Changes were made to bring this function into line with Perl: + * + * + * The "a" code now retains trailing NULL bytes. + * + * + * The "A" code now strips all trailing ASCII whitespace (spaces, tabs, + * newlines, carriage returns, and NULL bytes). + * + * + * The "Z" code was added for NULL-padded strings, and removes trailing + * NULL bytes. + * + * + * * @param string $format See pack for an explanation of the format codes. - * @param string $data The packed data. + * @param string $string The packed data. * @param int $offset The offset to begin unpacking from. * @return array Returns an associative array containing unpacked elements of binary * string. * @throws MiscException - * + * */ -function unpack(string $format, string $data, int $offset = 0): array +function unpack(string $format, string $string, int $offset = 0): array { error_clear_last(); - $result = \unpack($format, $data, $offset); + $result = \unpack($format, $string, $offset); if ($result === false) { throw MiscException::createFromPhpError(); } return $result; } + + diff --git a/generated/msql.php b/generated/msql.php deleted file mode 100644 index 331c1b6c..00000000 --- a/generated/msql.php +++ /dev/null @@ -1,443 +0,0 @@ - - * + * * The above example will output: - * + * * example: , this is a test * example: , this is a test * ]]> - * - * + * + * * So, $out[0] contains array of strings that matched full pattern, * and $out[1] contains array of strings enclosed by tags. - * - * - * - * + * + * + * + * * If the pattern contains named subpatterns, $matches * additionally contains entries for keys with the subpattern name. - * - * + * + * * If the pattern contains duplicate named subpatterns, only the rightmost * subpattern is stored in $matches[NAME]. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * - * + * + * * [1] => bar * ) * ]]> - * - * - * - * - * - * + * + * + * + * + * + * * PREG_SET_ORDER - * - * + * + * * Orders results so that $matches[0] is an array of first set * of matches, $matches[1] is an array of second set of matches, * and so on. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * example: , example: * this is a test, this is a test * ]]> - * - * - * - * - * - * + * + * + * + * + * + * * PREG_OFFSET_CAPTURE - * - * + * + * * If this flag is passed, for every occurring match the appendant string * offset (in bytes) will also be returned. Note that this changes the value of * matches into an array of arrays where every element is an * array consisting of the matched string at offset 0 * and its string offset into subject at offset * 1. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * Array * ( * [0] => Array @@ -116,9 +142,9 @@ * [0] => foobarbaz * [1] => 0 * ) - * + * * ) - * + * * [1] => Array * ( * [0] => Array @@ -126,9 +152,9 @@ * [0] => foo * [1] => 0 * ) - * + * * ) - * + * * [2] => Array * ( * [0] => Array @@ -136,9 +162,9 @@ * [0] => bar * [1] => 3 * ) - * + * * ) - * + * * [3] => Array * ( * [0] => Array @@ -146,105 +172,105 @@ * [0] => baz * [1] => 6 * ) - * + * * ) - * + * * ) * ]]> - * - * - * - * - * - * + * + * + * + * + * + * * PREG_UNMATCHED_AS_NULL - * - * + * + * * If this flag is passed, unmatched subpatterns are reported as NULL; * otherwise they are reported as an empty string. - * - * - * - * - * + * + * + * + * + * * Orders results so that $matches[0] is an array of full * pattern matches, $matches[1] is an array of strings matched by * the first parenthesized subpattern, and so on. - * - * - * - * + * + * + * + * * ]]> - * + * * The above example will output: - * + * * example: , this is a test * example: , this is a test * ]]> - * - * + * + * * So, $out[0] contains array of strings that matched full pattern, * and $out[1] contains array of strings enclosed by tags. - * - * - * + * + * + * * The above example will output: - * + * * So, $out[0] contains array of strings that matched full pattern, * and $out[1] contains array of strings enclosed by tags. - * + * * If the pattern contains named subpatterns, $matches * additionally contains entries for keys with the subpattern name. - * + * * If the pattern contains duplicate named subpatterns, only the rightmost * subpattern is stored in $matches[NAME]. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * - * + * + * * [1] => bar * ) * ]]> - * - * - * + * + * + * * The above example will output: - * + * * Orders results so that $matches[0] is an array of first set * of matches, $matches[1] is an array of second set of matches, * and so on. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * example: , example: * this is a test, this is a test * ]]> - * - * - * + * + * + * * The above example will output: - * + * * If this flag is passed, for every occurring match the appendant string * offset (in bytes) will also be returned. Note that this changes the value of * matches into an array of arrays where every element is an * array consisting of the matched string at offset 0 * and its string offset into subject at offset * 1. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * Array * ( * [0] => Array @@ -252,9 +278,9 @@ * [0] => foobarbaz * [1] => 0 * ) - * + * * ) - * + * * [1] => Array * ( * [0] => Array @@ -262,9 +288,9 @@ * [0] => foo * [1] => 0 * ) - * + * * ) - * + * * [2] => Array * ( * [0] => Array @@ -272,9 +298,9 @@ * [0] => bar * [1] => 3 * ) - * + * * ) - * + * * [3] => Array * ( * [0] => Array @@ -282,72 +308,72 @@ * [0] => baz * [1] => 6 * ) - * + * * ) - * + * * ) * ]]> - * - * - * + * + * + * * The above example will output: - * + * * If this flag is passed, unmatched subpatterns are reported as NULL; * otherwise they are reported as an empty string. - * + * * If no order flag is given, PREG_PATTERN_ORDER is * assumed. * @param int $offset Orders results so that $matches[0] is an array of full * pattern matches, $matches[1] is an array of strings matched by * the first parenthesized subpattern, and so on. - * - * - * - * + * + * + * + * * ]]> - * + * * The above example will output: - * + * * example: , this is a test * example: , this is a test * ]]> - * - * + * + * * So, $out[0] contains array of strings that matched full pattern, * and $out[1] contains array of strings enclosed by tags. - * - * - * + * + * + * * The above example will output: - * + * * So, $out[0] contains array of strings that matched full pattern, * and $out[1] contains array of strings enclosed by tags. - * + * * If the pattern contains named subpatterns, $matches * additionally contains entries for keys with the subpattern name. - * + * * If the pattern contains duplicate named subpatterns, only the rightmost * subpattern is stored in $matches[NAME]. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * - * + * + * * [1] => bar * ) * ]]> - * - * - * + * + * + * * The above example will output: * @return int Returns the number of full pattern matches (which might be zero). * @throws PcreException - * + * */ -function preg_match_all(string $pattern, string $subject, array &$matches = null, int $flags = PREG_PATTERN_ORDER, int $offset = 0): int +function preg_match_all(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int { error_clear_last(); $result = \preg_match_all($pattern, $subject, $matches, $flags, $offset); @@ -361,7 +387,7 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null /** * Searches subject for a match to the regular * expression given in pattern. - * + * * @param string $pattern The pattern to search for, as a string. * @param string $subject The input string. * @param array $matches If matches is provided, then it is filled with @@ -370,69 +396,69 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null * will have the text that matched the first captured parenthesized * subpattern, and so on. * @param int $flags flags can be a combination of the following flags: - * - * + * + * * PREG_OFFSET_CAPTURE - * - * + * + * * If this flag is passed, for every occurring match the appendant string * offset (in bytes) will also be returned. Note that this changes the value of * matches into an array where every element is an * array consisting of the matched string at offset 0 * and its string offset into subject at offset * 1. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * Array * ( * [0] => foobarbaz * [1] => 0 * ) - * + * * [1] => Array * ( * [0] => foo * [1] => 0 * ) - * + * * [2] => Array * ( * [0] => bar * [1] => 3 * ) - * + * * [3] => Array * ( * [0] => baz * [1] => 6 * ) - * + * * ) * ]]> - * - * - * - * - * - * + * + * + * + * + * + * * PREG_UNMATCHED_AS_NULL - * - * + * + * * If this flag is passed, unmatched subpatterns are reported as NULL; * otherwise they are reported as an empty string. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * - * + * + * * string(2) "ac" * [1]=> * string(1) "a" @@ -452,67 +478,67 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null * string(1) "c" * } * ]]> - * - * - * - * - * - * - * + * + * + * + * + * + * + * * If this flag is passed, for every occurring match the appendant string * offset (in bytes) will also be returned. Note that this changes the value of * matches into an array where every element is an * array consisting of the matched string at offset 0 * and its string offset into subject at offset * 1. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * Array * ( * [0] => foobarbaz * [1] => 0 * ) - * + * * [1] => Array * ( * [0] => foo * [1] => 0 * ) - * + * * [2] => Array * ( * [0] => bar * [1] => 3 * ) - * + * * [3] => Array * ( * [0] => baz * [1] => 6 * ) - * + * * ) * ]]> - * - * - * + * + * + * * The above example will output: - * + * * If this flag is passed, unmatched subpatterns are reported as NULL; * otherwise they are reported as an empty string. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * - * + * + * * string(2) "ac" * [1]=> * string(1) "a" @@ -532,9 +558,9 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null * string(1) "c" * } * ]]> - * - * - * + * + * + * * The above example will output: * @param int $offset If this flag is passed, for every occurring match the appendant string * offset (in bytes) will also be returned. Note that this changes the value of @@ -542,47 +568,47 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null * array consisting of the matched string at offset 0 * and its string offset into subject at offset * 1. - * - * - * + * + * + * * ]]> - * + * * The above example will output: - * + * * Array * ( * [0] => foobarbaz * [1] => 0 * ) - * + * * [1] => Array * ( * [0] => foo * [1] => 0 * ) - * + * * [2] => Array * ( * [0] => bar * [1] => 3 * ) - * + * * [3] => Array * ( * [0] => baz * [1] => 6 * ) - * + * * ) * ]]> - * - * - * + * + * + * * The above example will output: * @return int preg_match returns 1 if the pattern * matches given subject, 0 if it does not. * @throws PcreException - * + * */ function preg_match(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int { @@ -597,7 +623,7 @@ function preg_match(string $pattern, string $subject, array &$matches = null, in /** * Split the given string by a regular expression. - * + * * @param string $pattern The pattern to search for, as a string. * @param string $subject The input string. * @param int|null $limit If specified, then only substrings up to limit @@ -605,39 +631,39 @@ function preg_match(string $pattern, string $subject, array &$matches = null, in * substring. A limit of -1 or 0 means "no limit". * @param int $flags flags can be any combination of the following * flags (combined with the | bitwise operator): - * - * + * + * * PREG_SPLIT_NO_EMPTY - * - * + * + * * If this flag is set, only non-empty pieces will be returned by * preg_split. - * - * - * - * + * + * + * + * * PREG_SPLIT_DELIM_CAPTURE - * - * + * + * * If this flag is set, parenthesized expression in the delimiter pattern * will be captured and returned as well. - * - * - * - * + * + * + * + * * PREG_SPLIT_OFFSET_CAPTURE - * - * + * + * * If this flag is set, for every occurring match the appendant string * offset will also be returned. Note that this changes the return * value in an array where every element is an array consisting of the * matched string at offset 0 and its string offset * into subject at offset 1. - * - * - * - * - * + * + * + * + * + * * If this flag is set, for every occurring match the appendant string * offset will also be returned. Note that this changes the return * value in an array where every element is an array consisting of the @@ -646,7 +672,7 @@ function preg_match(string $pattern, string $subject, array &$matches = null, in * @return array Returns an array containing substrings of subject * split along boundaries matched by pattern. * @throws PcreException - * + * */ function preg_split(string $pattern, string $subject, ?int $limit = -1, int $flags = 0): array { @@ -657,3 +683,5 @@ function preg_split(string $pattern, string $subject, ?int $limit = -1, int $fla } return $result; } + + diff --git a/generated/pdf.php b/generated/pdf.php deleted file mode 100644 index d039b27a..00000000 --- a/generated/pdf.php +++ /dev/null @@ -1,1553 +0,0 @@ - - * ]]> - * - * - * + * * @param string $prompt The prompt message. * @param callable $callback The callback function takes one parameter; the * user input returned. * @throws ReadlineException - * + * */ function readline_callback_handler_install(string $prompt, callable $callback): void { @@ -82,9 +50,9 @@ function readline_callback_handler_install(string $prompt, callable $callback): /** * This function clears the entire command line history. - * + * * @throws ReadlineException - * + * */ function readline_clear_history(): void { @@ -99,16 +67,16 @@ function readline_clear_history(): void /** * This function registers a completion function. This is the same kind of * functionality you'd get if you hit your tab key while using Bash. - * - * @param callable $function You must supply the name of an existing function which accepts a + * + * @param callable $callback You must supply the name of an existing function which accepts a * partial command line and returns an array of possible matches. * @throws ReadlineException - * + * */ -function readline_completion_function(callable $function): void +function readline_completion_function(callable $callback): void { error_clear_last(); - $result = \readline_completion_function($function); + $result = \readline_completion_function($callback); if ($result === false) { throw ReadlineException::createFromPhpError(); } @@ -117,19 +85,15 @@ function readline_completion_function(callable $function): void /** * This function reads a command history from a file. - * + * * @param string $filename Path to the filename containing the command history. * @throws ReadlineException - * + * */ function readline_read_history(string $filename = null): void { error_clear_last(); - if ($filename !== null) { - $result = \readline_read_history($filename); - } else { - $result = \readline_read_history(); - } + $result = \readline_read_history($filename); if ($result === false) { throw ReadlineException::createFromPhpError(); } @@ -138,20 +102,18 @@ function readline_read_history(string $filename = null): void /** * This function writes the command history to a file. - * + * * @param string $filename Path to the saved file. * @throws ReadlineException - * + * */ function readline_write_history(string $filename = null): void { error_clear_last(); - if ($filename !== null) { - $result = \readline_write_history($filename); - } else { - $result = \readline_write_history(); - } + $result = \readline_write_history($filename); if ($result === false) { throw ReadlineException::createFromPhpError(); } } + + diff --git a/generated/rpminfo.php b/generated/rpminfo.php index 44de1ce2..d946c7e0 100644 --- a/generated/rpminfo.php +++ b/generated/rpminfo.php @@ -6,10 +6,10 @@ /** * Add an additional retrieved tag in subsequent queries. - * + * * @param int $tag One of RPMTAG_* constant, see the rpminfo constants page. * @throws RpminfoException - * + * */ function rpmaddtag(int $tag): void { @@ -19,3 +19,5 @@ function rpmaddtag(int $tag): void throw RpminfoException::createFromPhpError(); } } + + diff --git a/generated/rrd.php b/generated/rrd.php index 9bb3b5c5..6766934c 100644 --- a/generated/rrd.php +++ b/generated/rrd.php @@ -6,12 +6,12 @@ /** * Creates the rdd database file. - * + * * @param string $filename Filename for newly created rrd file. * @param array $options Options for rrd create - list of strings. See man page of rrd create * for whole list of options. * @throws RrdException - * + * */ function rrd_create(string $filename, array $options): void { @@ -21,3 +21,172 @@ function rrd_create(string $filename, array $options): void throw RrdException::createFromPhpError(); } } + + +/** + * Returns the first data sample from the specified RRA of the RRD file. + * + * @param string $file RRD database file name. + * @param int $raaindex The index number of the RRA that is to be examined. Default value is 0. + * @return int Integer number of unix timestamp. + * @throws RrdException + * + */ +function rrd_first(string $file, int $raaindex = 0): int +{ + error_clear_last(); + $result = \rrd_first($file, $raaindex); + if ($result === false) { + throw RrdException::createFromPhpError(); + } + return $result; +} + + +/** + * Creates image for a particular data from RRD file. + * + * @param string $filename The filename to output the graph to. This will generally end in either + * .png, .svg or + * .eps, depending on the format you want to output. + * @param array $options Options for generating image. See man page of rrd graph for all + * possible options. All options (data definitions, variable definitions, etc.) + * are allowed. + * @return array Array with information about generated image is returned. + * @throws RrdException + * + */ +function rrd_graph(string $filename, array $options): array +{ + error_clear_last(); + $result = \rrd_graph($filename, $options); + if ($result === false) { + throw RrdException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns information about particular RRD database file. + * + * @param string $filename RRD database file name. + * @return array Array with information about requested RRD file. + * @throws RrdException + * + */ +function rrd_info(string $filename): array +{ + error_clear_last(); + $result = \rrd_info($filename); + if ($result === false) { + throw RrdException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets array of the UNIX timestamp and the values stored for each date in the + * most recent update of the RRD database file. + * + * @param string $filename RRD database file name. + * @return array Array of information about last update. + * @throws RrdException + * + */ +function rrd_lastupdate(string $filename): array +{ + error_clear_last(); + $result = \rrd_lastupdate($filename); + if ($result === false) { + throw RrdException::createFromPhpError(); + } + return $result; +} + + +/** + * Restores the RRD file from the XML dump. + * + * @param string $xml_file XML filename with the dump of the original RRD database file. + * @param string $rrd_file Restored RRD database file name. + * @param array $options Array of options for restoring. See man page for rrd restore. + * @throws RrdException + * + */ +function rrd_restore(string $xml_file, string $rrd_file, array $options = null): void +{ + error_clear_last(); + if ($options !== null) { + $result = \rrd_restore($xml_file, $rrd_file, $options); + }else { + $result = \rrd_restore($xml_file, $rrd_file); + } + if ($result === false) { + throw RrdException::createFromPhpError(); + } +} + + +/** + * Change some options in the RRD dabase header file. E.g. renames the source for + * the data etc. + * + * @param string $filename RRD database file name. + * @param array $options Options with RRD database file properties which will be changed. See + * rrd tune man page for details. + * @throws RrdException + * + */ +function rrd_tune(string $filename, array $options): void +{ + error_clear_last(); + $result = \rrd_tune($filename, $options); + if ($result === false) { + throw RrdException::createFromPhpError(); + } +} + + +/** + * Updates the RRD database file. The input data is time interpolated according to the + * properties of the RRD database file. + * + * @param string $filename RRD database file name. This database will be updated. + * @param array $options Options for updating the RRD database. This is list of strings. See man page of rrd update + * for whole list of options. + * @throws RrdException + * + */ +function rrd_update(string $filename, array $options): void +{ + error_clear_last(); + $result = \rrd_update($filename, $options); + if ($result === false) { + throw RrdException::createFromPhpError(); + } +} + + +/** + * Exports the information about RRD database file. This data can be converted + * to XML file via user space PHP script and then restored back as RRD database + * file. + * + * @param array $options Array of options for the export, see rrd xport man page. + * @return array Array with information about RRD database file. + * @throws RrdException + * + */ +function rrd_xport(array $options): array +{ + error_clear_last(); + $result = \rrd_xport($options); + if ($result === false) { + throw RrdException::createFromPhpError(); + } + return $result; +} + + diff --git a/generated/sem.php b/generated/sem.php index 739e8b38..c7362e9b 100644 --- a/generated/sem.php +++ b/generated/sem.php @@ -4,12 +4,40 @@ use Safe\Exceptions\SemException; +/** + * msg_get_queue returns an id that can be used to + * access the System V message queue with the given + * key. The first call creates the message queue with + * the optional permissions. + * A second call to msg_get_queue for the same + * key will return a different message queue + * identifier, but both identifiers access the same underlying message + * queue. + * + * @param int $key Message queue numeric ID + * @param int $permissions Queue permissions. Default to 0666. If the message queue already + * exists, the permissions will be ignored. + * @return resource Returns SysvMessageQueue instance that can be used to access the System V message queue. + * @throws SemException + * + */ +function msg_get_queue(int $key, int $permissions = 0666) +{ + error_clear_last(); + $result = \msg_get_queue($key, $permissions); + if ($result === false) { + throw SemException::createFromPhpError(); + } + return $result; +} + + /** * Checks whether the message queue key exists. - * + * * @param int $key Queue key. * @throws SemException - * + * */ function msg_queue_exists(int $key): void { @@ -24,23 +52,23 @@ function msg_queue_exists(int $key): void /** * msg_receive will receive the first message from the * specified queue of the type specified by - * desiredmsgtype. - * - * @param resource $queue Message queue resource handle - * @param int $desiredmsgtype If desiredmsgtype is 0, the message from the front - * of the queue is returned. If desiredmsgtype is + * desired_message_type. + * + * @param resource $queue The message queue. + * @param int $desired_message_type If desired_message_type is 0, the message from the front + * of the queue is returned. If desired_message_type is * greater than 0, then the first message of that type is returned. - * If desiredmsgtype is less than 0, the first + * If desired_message_type is less than 0, the first * message on the queue with a type less than or equal to the - * absolute value of desiredmsgtype will be read. + * absolute value of desired_message_type will be read. * If no messages match the criteria, your script will wait until a suitable * message arrives on the queue. You can prevent the script from blocking * by specifying MSG_IPC_NOWAIT in the * flags parameter. - * @param int|null $msgtype The type of the message that was received will be stored in this + * @param int $received_message_type The type of the message that was received will be stored in this * parameter. - * @param int $maxsize The maximum size of message to be accepted is specified by the - * maxsize; if the message in the queue is larger + * @param int $max_message_size The maximum size of message to be accepted is specified by the + * max_message_size; if the message in the queue is larger * than this size the function will fail (unless you set * flags as described below). * @param mixed $message The received message will be stored in message, @@ -51,51 +79,51 @@ function msg_queue_exists(int $key): void * and then returned to your script. This allows you to easily receive * arrays or complex object structures from other PHP scripts, or if you * are using the WDDX serializer, from any WDDX compatible source. - * + * * If unserialize is FALSE, the message will be * returned as a binary-safe string. * @param int $flags The optional flags allows you to pass flags to the * low-level msgrcv system call. It defaults to 0, but you may specify one * or more of the following values (by adding or ORing them together). - * + * * Flag values for msg_receive - * - * - * + * + * + * * MSG_IPC_NOWAIT * If there are no messages of the - * desiredmsgtype, return immediately and do not + * desired_message_type, return immediately and do not * wait. The function will fail and return an integer value * corresponding to MSG_ENOMSG. - * - * - * + * + * + * * MSG_EXCEPT * Using this flag in combination with a - * desiredmsgtype greater than 0 will cause the + * desired_message_type greater than 0 will cause the * function to receive the first message that is not equal to - * desiredmsgtype. - * - * + * desired_message_type. + * + * * MSG_NOERROR - * - * If the message is longer than maxsize, + * + * If the message is longer than max_message_size, * setting this flag will truncate the message to - * maxsize and will not signal an error. - * - * - * - * - * - * @param int|null $errorcode If the function fails, the optional errorcode + * max_message_size and will not signal an error. + * + * + * + * + * + * @param int $error_code If the function fails, the optional error_code * will be set to the value of the system errno variable. * @throws SemException - * + * */ -function msg_receive($queue, int $desiredmsgtype, ?int &$msgtype, int $maxsize, &$message, bool $unserialize = true, int $flags = 0, ?int &$errorcode = null): void +function msg_receive( $queue, int $desired_message_type, int &$received_message_type, int $max_message_size, &$message, bool $unserialize = true, int $flags = 0, int &$error_code = null): void { error_clear_last(); - $result = \msg_receive($queue, $desiredmsgtype, $msgtype, $maxsize, $message, $unserialize, $flags, $errorcode); + $result = \msg_receive($queue, $desired_message_type, $received_message_type, $max_message_size, $message, $unserialize, $flags, $error_code); if ($result === false) { throw SemException::createFromPhpError(); } @@ -107,12 +135,12 @@ function msg_receive($queue, int $desiredmsgtype, ?int &$msgtype, int $maxsize, * by the queue. Only use this function when all * processes have finished working with the message queue and you need to * release the system resources held by it. - * - * @param resource $queue Message queue resource handle + * + * @param resource $queue The message queue. * @throws SemException - * + * */ -function msg_remove_queue($queue): void +function msg_remove_queue( $queue): void { error_clear_last(); $result = \msg_remove_queue($queue); @@ -124,15 +152,15 @@ function msg_remove_queue($queue): void /** * msg_send sends a message of type - * msgtype (which MUST be greater than 0) to + * message_type (which MUST be greater than 0) to * the message queue specified by queue. - * - * @param resource $queue Message queue resource handle - * @param int $msgtype The type of the message (MUST be greater than 0) + * + * @param resource $queue The message queue. + * @param int $message_type The type of the message (MUST be greater than 0) * @param mixed $message The body of the message. - * + * * If serialize set to FALSE is supplied, - * MUST be of type: string, integer, float + * MUST be of type: string, int, float * or bool. In other case a warning will be issued. * @param bool $serialize The optional serialize controls how the * message is sent. serialize @@ -148,17 +176,17 @@ function msg_remove_queue($queue): void * optional blocking parameter to FALSE, in which * case msg_send will immediately return FALSE if the * message is too big for the queue, and set the optional - * errorcode to MSG_EAGAIN, + * error_code to MSG_EAGAIN, * indicating that you should try to send your message again a little * later on. - * @param int|null $errorcode If the function fails, the optional errorcode will be set to the value of the system errno variable. + * @param int $error_code If the function fails, the optional errorcode will be set to the value of the system errno variable. * @throws SemException - * + * */ -function msg_send($queue, int $msgtype, $message, bool $serialize = true, bool $blocking = true, ?int &$errorcode = null): void +function msg_send( $queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, int &$error_code = null): void { error_clear_last(); - $result = \msg_send($queue, $msgtype, $message, $serialize, $blocking, $errorcode); + $result = \msg_send($queue, $message_type, $message, $serialize, $blocking, $error_code); if ($result === false) { throw SemException::createFromPhpError(); } @@ -169,20 +197,20 @@ function msg_send($queue, int $msgtype, $message, bool $serialize = true, bool $ * msg_set_queue allows you to change the values of the * msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the * underlying message queue data structure. - * + * * Changing the data structure will require that PHP be running as the same * user that created the queue, owns the queue (as determined by the * existing msg_perm.xxx fields), or be running with root privileges. * root privileges are required to raise the msg_qbytes values above the * system defined limit. - * - * @param resource $queue Message queue resource handle + * + * @param resource $queue The message queue. * @param array $data You specify the values you require by setting the value of the keys * that you require in the data array. * @throws SemException - * + * */ -function msg_set_queue($queue, array $data): void +function msg_set_queue( $queue, array $data): void { error_clear_last(); $result = \msg_set_queue($queue, $data); @@ -192,29 +220,123 @@ function msg_set_queue($queue, array $data): void } +/** + * msg_stat_queue returns the message queue meta data + * for the message queue specified by the queue. + * This is useful, for example, to determine which process sent the message + * that was just received. + * + * @param resource $queue The message queue. + * @return array On success, the return value is an array whose keys and values have the following + * meanings: + * + * Array structure for msg_stat_queue + * + * + * + * msg_perm.uid + * + * The uid of the owner of the queue. + * + * + * + * msg_perm.gid + * + * The gid of the owner of the queue. + * + * + * + * msg_perm.mode + * + * The file access mode of the queue. + * + * + * + * msg_stime + * + * The time that the last message was sent to the queue. + * + * + * + * msg_rtime + * + * The time that the last message was received from the queue. + * + * + * + * msg_ctime + * + * The time that the queue was last changed. + * + * + * + * msg_qnum + * + * The number of messages waiting to be read from the queue. + * + * + * + * msg_qbytes + * + * The maximum number of bytes allowed in one message queue. On + * Linux, this value may be read and modified via + * /proc/sys/kernel/msgmnb. + * + * + * + * msg_lspid + * + * The pid of the process that sent the last message to the queue. + * + * + * + * msg_lrpid + * + * The pid of the process that received the last message from the queue. + * + * + * + * + * + * + * Returns FALSE on failure. + * @throws SemException + * + */ +function msg_stat_queue( $queue): array +{ + error_clear_last(); + $result = \msg_stat_queue($queue); + if ($result === false) { + throw SemException::createFromPhpError(); + } + return $result; +} + + /** * sem_acquire by default blocks (if necessary) until the * semaphore can be acquired. A process attempting to acquire a semaphore which * it has already acquired will block forever if acquiring the semaphore would * cause its maximum number of semaphore to be exceeded. - * + * * After processing a request, any semaphores acquired by the process but not * explicitly released will be released automatically and a warning will be * generated. - * - * @param resource $sem_identifier sem_identifier is a semaphore resource, + * + * @param \SysvSemaphore $semaphore semaphore is a semaphore * obtained from sem_get. - * @param bool $nowait Specifies if the process shouldn't wait for the semaphore to be acquired. + * @param bool $non_blocking Specifies if the process shouldn't wait for the semaphore to be acquired. * If set to true, the call will return * false immediately if a semaphore cannot be immediately * acquired. * @throws SemException - * + * */ -function sem_acquire($sem_identifier, bool $nowait = false): void +function sem_acquire(\SysvSemaphore $semaphore, bool $non_blocking = false): void { error_clear_last(); - $result = \sem_acquire($sem_identifier, $nowait); + $result = \sem_acquire($semaphore, $non_blocking); if ($result === false) { throw SemException::createFromPhpError(); } @@ -224,30 +346,30 @@ function sem_acquire($sem_identifier, bool $nowait = false): void /** * sem_get returns an id that can be used to * access the System V semaphore with the given key. - * + * * A second call to sem_get for the same key * will return a different semaphore identifier, but both * identifiers access the same underlying semaphore. - * + * * If key is 0, a new private semaphore * is created for each call to sem_get. - * - * @param int $key + * + * @param int $key * @param int $max_acquire The number of processes that can acquire the semaphore simultaneously * is set to max_acquire. - * @param int $perm The semaphore permissions. Actually this value is + * @param int $permissions The semaphore permissions. Actually this value is * set only if the process finds it is the only process currently * attached to the semaphore. * @param int $auto_release Specifies if the semaphore should be automatically released on request * shutdown. * @return resource Returns a positive semaphore identifier on success. * @throws SemException - * + * */ -function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_release = 1) +function sem_get(int $key, int $max_acquire = 1, int $permissions = 0666, int $auto_release = true) { error_clear_last(); - $result = \sem_get($key, $max_acquire, $perm, $auto_release); + $result = \sem_get($key, $max_acquire, $permissions, $auto_release); if ($result === false) { throw SemException::createFromPhpError(); } @@ -259,19 +381,19 @@ function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_rel * sem_release releases the semaphore if it * is currently acquired by the calling process, otherwise * a warning is generated. - * + * * After releasing the semaphore, sem_acquire * may be called to re-acquire it. - * - * @param resource $sem_identifier A Semaphore resource handle as returned by + * + * @param \SysvSemaphore $semaphore A Semaphore as returned by * sem_get. * @throws SemException - * + * */ -function sem_release($sem_identifier): void +function sem_release(\SysvSemaphore $semaphore): void { error_clear_last(); - $result = \sem_release($sem_identifier); + $result = \sem_release($semaphore); if ($result === false) { throw SemException::createFromPhpError(); } @@ -280,18 +402,71 @@ function sem_release($sem_identifier): void /** * sem_remove removes the given semaphore. - * + * * After removing the semaphore, it is no longer accessible. - * - * @param resource $sem_identifier A semaphore resource identifier as returned + * + * @param \SysvSemaphore $semaphore A semaphore as returned * by sem_get. * @throws SemException - * + * */ -function sem_remove($sem_identifier): void +function sem_remove(\SysvSemaphore $semaphore): void { error_clear_last(); - $result = \sem_remove($sem_identifier); + $result = \sem_remove($semaphore); + if ($result === false) { + throw SemException::createFromPhpError(); + } +} + + +/** + * shm_attach returns an id that can be used to access + * the System V shared memory with the given key, the + * first call creates the shared memory segment with + * size and the optional perm-bits + * permissions. + * + * A second call to shm_attach for the same + * key will return a different SysvSharedMemory + * instance, but both instances access the same underlying + * shared memory. size and + * permissions will be ignored. + * + * @param int $key A numeric shared memory segment ID + * @param $size The memory size. If not provided, default to the + * sysvshm.init_mem in the php.ini, otherwise 10000 + * bytes. + * @param int $permissions The optional permission bits. Default to 0666. + * @return resource Returns a SysvSharedMemory instance on success. + * @throws SemException + * + */ +function shm_attach(int $key, $size = null, int $permissions = 0666) +{ + error_clear_last(); + $result = \shm_attach($key, $size, $permissions); + if ($result === false) { + throw SemException::createFromPhpError(); + } + return $result; +} + + +/** + * shm_detach disconnects from the shared memory given + * by the shm created by + * shm_attach. Remember, that shared memory still exist + * in the Unix system and the data is still present. + * + * @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach. + * @throws SemException + * + */ +function shm_detach(\SysvSharedMemory $shm): void +{ + error_clear_last(); + $result = \shm_detach($shm); if ($result === false) { throw SemException::createFromPhpError(); } @@ -300,28 +475,27 @@ function sem_remove($sem_identifier): void /** * shm_put_var inserts or updates the - * variable with the given - * variable_key. - * + * value with the given + * key. + * * Warnings (E_WARNING level) will be issued if - * shm_identifier is not a valid SysV shared memory + * shm is not a valid SysV shared memory * index or if there was not enough shared memory remaining to complete your * request. - * - * @param resource $shm_identifier A shared memory resource handle as returned by - * shm_attach - * @param int $variable_key The variable key. - * @param mixed $variable The variable. All variable types + * + * @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach. + * @param int $key The variable key. + * @param mixed $value The variable. All variable types * that serialize supports may be used: generally * this means all types except for resources and some internal objects * that cannot be serialized. * @throws SemException - * + * */ -function shm_put_var($shm_identifier, int $variable_key, $variable): void +function shm_put_var(\SysvSharedMemory $shm, int $key, $value): void { error_clear_last(); - $result = \shm_put_var($shm_identifier, $variable_key, $variable); + $result = \shm_put_var($shm, $key, $value); if ($result === false) { throw SemException::createFromPhpError(); } @@ -329,19 +503,18 @@ function shm_put_var($shm_identifier, int $variable_key, $variable): void /** - * Removes a variable with a given variable_key + * Removes a variable with a given key * and frees the occupied memory. - * - * @param resource $shm_identifier The shared memory identifier as returned by - * shm_attach - * @param int $variable_key The variable key. + * + * @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach. + * @param int $key The variable key. * @throws SemException - * + * */ -function shm_remove_var($shm_identifier, int $variable_key): void +function shm_remove_var(\SysvSharedMemory $shm, int $key): void { error_clear_last(); - $result = \shm_remove_var($shm_identifier, $variable_key); + $result = \shm_remove_var($shm, $key); if ($result === false) { throw SemException::createFromPhpError(); } @@ -350,18 +523,19 @@ function shm_remove_var($shm_identifier, int $variable_key): void /** * shm_remove removes the shared memory - * shm_identifier. All data will be destroyed. - * - * @param resource $shm_identifier The shared memory identifier as returned by - * shm_attach + * shm. All data will be destroyed. + * + * @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach. * @throws SemException - * + * */ -function shm_remove($shm_identifier): void +function shm_remove(\SysvSharedMemory $shm): void { error_clear_last(); - $result = \shm_remove($shm_identifier); + $result = \shm_remove($shm); if ($result === false) { throw SemException::createFromPhpError(); } } + + diff --git a/generated/session.php b/generated/session.php index 7b8c9478..5e34047c 100644 --- a/generated/session.php +++ b/generated/session.php @@ -7,9 +7,9 @@ /** * session_abort finishes session without saving * data. Thus the original values in session data are kept. - * + * * @throws SessionException - * + * */ function session_abort(): void { @@ -21,17 +21,53 @@ function session_abort(): void } +/** + * session_create_id is used to create new + * session id for the current session. It returns collision free + * session id. + * + * If session is not active, collision check is omitted. + * + * Session ID is created according to php.ini settings. + * + * It is important to use the same user ID of your web server for GC + * task script. Otherwise, you may have permission problems especially + * with files save handler. + * + * @param string $prefix If prefix is specified, new session id + * is prefixed by prefix. Not all + * characters are allowed within the session id. Characters in + * the range a-z A-Z 0-9 , (comma) and - + * (minus) are allowed. + * @return string session_create_id returns new collision free + * session id for the current session. If it is used without active + * session, it omits collision check. + * On failure, FALSE is returned. + * @throws SessionException + * + */ +function session_create_id(string $prefix = ""): string +{ + error_clear_last(); + $result = \session_create_id($prefix); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + /** * session_decode decodes the serialized session data provided in * $data, and populates the $_SESSION superglobal * with the result. - * + * * By default, the unserialization method used is internal to PHP, and is not the same as unserialize. * The serialization method can be set using session.serialize_handler. - * + * * @param string $data The encoded data to be stored. * @throws SessionException - * + * */ function session_decode(string $data): void { @@ -48,16 +84,16 @@ function session_decode(string $data): void * session ID must also be unset. If a cookie is used to propagate the * session ID (default behavior), then the session cookie must be deleted. * setcookie may be used for that. - * + * * When session.use_strict_mode * is enabled. You do not have to remove obsolete session ID cookie because * session module will not accept session ID cookie when there is no * data associated to the session ID and set new session ID cookie. * Enabling session.use_strict_mode * is recommended for all sites. - * + * * @throws SessionException - * + * */ function session_destroy(): void { @@ -69,20 +105,153 @@ function session_destroy(): void } +/** + * session_encode returns a serialized string of the + * contents of the current session data stored in the $_SESSION superglobal. + * + * By default, the serialization method used is internal to PHP, and is not the same as serialize. + * The serialization method can be set using session.serialize_handler. + * + * @return string Returns the contents of the current session encoded. + * @throws SessionException + * + */ +function session_encode(): string +{ + error_clear_last(); + $result = \session_encode(); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + +/** + * session_id is used to get or set the session id for + * the current session. + * + * The constant SID can also be used to + * retrieve the current name and session id as a string suitable for + * adding to URLs. See also Session + * handling. + * + * @param $id If id is specified and not NULL, it will replace the current + * session id. session_id needs to be called before + * session_start for that purpose. Depending on the + * session handler, not all characters are allowed within the session id. + * For example, the file session handler only allows characters in the + * range a-z A-Z 0-9 , (comma) and - (minus)! + * @return string session_id returns the session id for the current + * session or the empty string ("") if there is no current + * session (no current session id exists). + * On failure, FALSE is returned. + * @throws SessionException + * + */ +function session_id( $id = null): string +{ + error_clear_last(); + $result = \session_id($id); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + +/** + * session_module_name gets the name of the current + * session module, which is also known as + * session.save_handler. + * + * @param $module If module is specified and not NULL, that module will be + * used instead. + * Passing "user" to this parameter is forbidden. Instead + * session_set_save_handler has to be called to set a user + * defined session handler. + * @return string Returns the name of the current session module. + * @throws SessionException + * + */ +function session_module_name( $module = null): string +{ + error_clear_last(); + $result = \session_module_name($module); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + +/** + * session_name returns the name of the current + * session. If name is given, + * session_name will update the session name and return + * the old session name. + * + * If a new session name is + * supplied, session_name modifies the HTTP cookie + * (and output content when session.transid is + * enabled). Once the HTTP cookie is + * sent, session_name raises error. + * session_name must be called + * before session_start for the session to work + * properly. + * + * The session name is reset to the default value stored in + * session.name at request startup time. Thus, you need to + * call session_name for every request (and before + * session_start is called). + * + * @param $name The session name references the name of the session, which is + * used in cookies and URLs (e.g. PHPSESSID). It + * should contain only alphanumeric characters; it should be short and + * descriptive (i.e. for users with enabled cookie warnings). + * If name is specified and not NULL, the name of the current + * session is changed to its value. + * + * + * + * The session name can't consist of digits only, at least one letter + * must be present. Otherwise a new session id is generated every time. + * + * + * + * The session name can't consist of digits only, at least one letter + * must be present. Otherwise a new session id is generated every time. + * @return string Returns the name of the current session. If name is given + * and function updates the session name, name of the old session + * is returned. + * @throws SessionException + * + */ +function session_name( $name = null): string +{ + error_clear_last(); + $result = \session_name($name); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + /** * session_regenerate_id will replace the current * session id with a new one, and keep the current session information. - * + * * When session.use_trans_sid * is enabled, output must be started after session_regenerate_id * call. Otherwise, old session ID is used. - * + * * @param bool $delete_old_session Whether to delete the old associated session file or not. * You should not delete old session if you need to avoid * races caused by deletion or detect/avoid session hijack * attacks. * @throws SessionException - * + * */ function session_regenerate_id(bool $delete_old_session = false): void { @@ -98,9 +267,9 @@ function session_regenerate_id(bool $delete_old_session = false): void * session_reset reinitializes a session with * original values stored in session storage. This function requires an active session and * discards changes in $_SESSION. - * + * * @throws SessionException - * + * */ function session_reset(): void { @@ -112,12 +281,46 @@ function session_reset(): void } +/** + * session_save_path returns the path of the current + * directory used to save session data. + * + * @param $path Session data path. If specified and not NULL, the path to which data is saved will + * be changed. session_save_path needs to be called + * before session_start for that purpose. + * + * + * + * On some operating systems, you may want to specify a path on a + * filesystem that handles lots of small files efficiently. For example, + * on Linux, reiserfs may provide better performance than ext2fs. + * + * + * + * On some operating systems, you may want to specify a path on a + * filesystem that handles lots of small files efficiently. For example, + * on Linux, reiserfs may provide better performance than ext2fs. + * @return string Returns the path of the current directory used for data storage. + * @throws SessionException + * + */ +function session_save_path( $path = null): string +{ + error_clear_last(); + $result = \session_save_path($path); + if ($result === false) { + throw SessionException::createFromPhpError(); + } + return $result; +} + + /** * The session_unset function frees all session variables * currently registered. - * + * * @throws SessionException - * + * */ function session_unset(): void { @@ -131,7 +334,7 @@ function session_unset(): void /** * End the current session and store session data. - * + * * Session data is usually stored after your script terminated without the * need to call session_write_close, but as session data * is locked to prevent concurrent writes only one script may operate on a @@ -139,9 +342,9 @@ function session_unset(): void * experience the frames loading one by one due to this locking. You can * reduce the time needed to load all the frames by ending the session as * soon as all changes to session variables are done. - * + * * @throws SessionException - * + * */ function session_write_close(): void { @@ -151,3 +354,5 @@ function session_write_close(): void throw SessionException::createFromPhpError(); } } + + diff --git a/generated/shmop.php b/generated/shmop.php index 04ba57cb..d011a410 100644 --- a/generated/shmop.php +++ b/generated/shmop.php @@ -6,16 +6,16 @@ /** * shmop_delete is used to delete a shared memory block. - * - * @param resource $shmid The shared memory block resource created by + * + * @param \Shmop $shmop The shared memory block resource created by * shmop_open * @throws ShmopException - * + * */ -function shmop_delete($shmid): void +function shmop_delete(\Shmop $shmop): void { error_clear_last(); - $result = \shmop_delete($shmid); + $result = \shmop_delete($shmop); if ($result === false) { throw ShmopException::createFromPhpError(); } @@ -24,20 +24,20 @@ function shmop_delete($shmid): void /** * shmop_read will read a string from shared memory block. - * - * @param resource $shmid The shared memory block identifier created by + * + * @param \Shmop $shmop The shared memory block identifier created by * shmop_open - * @param int $start Offset from which to start reading - * @param int $count The number of bytes to read. + * @param int $offset Offset from which to start reading + * @param int $size The number of bytes to read. * 0 reads shmop_size($shmid) - $start bytes. * @return string Returns the data. * @throws ShmopException - * + * */ -function shmop_read($shmid, int $start, int $count): string +function shmop_read(\Shmop $shmop, int $offset, int $size): string { error_clear_last(); - $result = \shmop_read($shmid, $start, $count); + $result = \shmop_read($shmop, $offset, $size); if ($result === false) { throw ShmopException::createFromPhpError(); } @@ -45,24 +45,3 @@ function shmop_read($shmid, int $start, int $count): string } -/** - * shmop_write will write a string into shared memory block. - * - * @param resource $shmid The shared memory block identifier created by - * shmop_open - * @param string $data A string to write into shared memory block - * @param int $offset Specifies where to start writing data inside the shared memory - * segment. - * @return int The size of the written data. - * @throws ShmopException - * - */ -function shmop_write($shmid, string $data, int $offset): int -{ - error_clear_last(); - $result = \shmop_write($shmid, $data, $offset); - if ($result === false) { - throw ShmopException::createFromPhpError(); - } - return $result; -} diff --git a/generated/simplexml.php b/generated/simplexml.php index 118de443..7bd87ff2 100644 --- a/generated/simplexml.php +++ b/generated/simplexml.php @@ -8,21 +8,21 @@ * This function takes a node of a DOM * document and makes it into a SimpleXML node. This new object can * then be used as a native SimpleXML element. - * + * * @param \DOMNode $node A DOM Element node * @param string $class_name You may use this optional parameter so that - * simplexml_import_dom will return an object of - * the specified class. That class should extend the + * simplexml_import_dom will return an object of + * the specified class. That class should extend the * SimpleXMLElement class. - * @return \SimpleXMLElement Returns a SimpleXMLElement. + * @return \SimpleXMLElement|false Returns a SimpleXMLElement. * @throws SimplexmlException - * + * */ -function simplexml_import_dom(\DOMNode $node, string $class_name = "SimpleXMLElement"): \SimpleXMLElement +function simplexml_import_dom(\DOMNode $node, string $class_name = SimpleXMLElement::class): \SimpleXMLElement { error_clear_last(); $result = \simplexml_import_dom($node, $class_name); - if ($result === false) { + if ($result === null) { throw SimplexmlException::createFromPhpError(); } return $result; @@ -31,33 +31,26 @@ function simplexml_import_dom(\DOMNode $node, string $class_name = "SimpleXMLEle /** * Convert the well-formed XML document in the given file to an object. - * + * * @param string $filename Path to the XML file - * - * Libxml 2 unescapes the URI, so if you want to pass e.g. - * b&c as the URI parameter a, - * you have to call - * simplexml_load_file(rawurlencode('http://example.com/?a=' . - * urlencode('b&c'))). Since PHP 5.1.0 you don't need to do - * this because PHP will do it for you. * @param string $class_name You may use this optional parameter so that - * simplexml_load_file will return an object of - * the specified class. That class should extend the + * simplexml_load_file will return an object of + * the specified class. That class should extend the * SimpleXMLElement class. - * @param int $options Since PHP 5.1.0 and Libxml 2.6.0, you may also use the + * @param int $options Since Libxml 2.6.0, you may also use the * options parameter to specify additional Libxml parameters. - * @param string $ns Namespace prefix or URI. - * @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI; + * @param string $namespace_or_prefix Namespace prefix or URI. + * @param bool $is_prefix TRUE if namespace_or_prefix is a prefix, FALSE if it's a URI; * defaults to FALSE. * @return \SimpleXMLElement Returns an object of class SimpleXMLElement with * properties containing the data held within the XML document. * @throws SimplexmlException - * + * */ -function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement +function simplexml_load_file(string $filename, string $class_name = SimpleXMLElement::class, int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false): \SimpleXMLElement { error_clear_last(); - $result = \simplexml_load_file($filename, $class_name, $options, $ns, $is_prefix); + $result = \simplexml_load_file($filename, $class_name, $options, $namespace_or_prefix, $is_prefix); if ($result === false) { throw SimplexmlException::createFromPhpError(); } @@ -67,28 +60,30 @@ function simplexml_load_file(string $filename, string $class_name = "SimpleXMLEl /** * Takes a well-formed XML string and returns it as an object. - * + * * @param string $data A well-formed XML string * @param string $class_name You may use this optional parameter so that - * simplexml_load_string will return an object of - * the specified class. That class should extend the + * simplexml_load_string will return an object of + * the specified class. That class should extend the * SimpleXMLElement class. - * @param int $options Since PHP 5.1.0 and Libxml 2.6.0, you may also use the + * @param int $options Since Libxml 2.6.0, you may also use the * options parameter to specify additional Libxml parameters. - * @param string $ns Namespace prefix or URI. - * @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI; + * @param string $namespace_or_prefix Namespace prefix or URI. + * @param bool $is_prefix TRUE if namespace_or_prefix is a prefix, FALSE if it's a URI; * defaults to FALSE. * @return \SimpleXMLElement Returns an object of class SimpleXMLElement with * properties containing the data held within the xml document. * @throws SimplexmlException - * + * */ -function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement +function simplexml_load_string(string $data, string $class_name = SimpleXMLElement::class, int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false): \SimpleXMLElement { error_clear_last(); - $result = \simplexml_load_string($data, $class_name, $options, $ns, $is_prefix); + $result = \simplexml_load_string($data, $class_name, $options, $namespace_or_prefix, $is_prefix); if ($result === false) { throw SimplexmlException::createFromPhpError(); } return $result; } + + diff --git a/generated/sockets.php b/generated/sockets.php index d6cc892b..a23d57fb 100644 --- a/generated/sockets.php +++ b/generated/sockets.php @@ -10,31 +10,31 @@ * socket_bind, and told to listen for connections * with socket_listen, this function will accept * incoming connections on that socket. Once a successful connection - * is made, a new socket resource is returned, which may be used - * for communication. If there are multiple connections queued on - * the socket, the first will be used. If there are no pending + * is made, a new Socket instance is returned, + * which may be used for communication. If there are multiple connections + * queued on the socket, the first will be used. If there are no pending * connections, socket_accept will block until * a connection becomes present. If socket * has been made non-blocking using * socket_set_blocking or * socket_set_nonblock, FALSE will be returned. - * - * The socket resource returned by + * + * The Socket instance returned by * socket_accept may not be used to accept new * connections. The original listening socket * socket, however, remains open and may be * reused. - * - * @param resource $socket A valid socket resource created with socket_create. - * @return resource Returns a new socket resource on success. The actual + * + * @param resource $socket A Socket instance created with socket_create. + * @return resource Returns a new Socket instance on success. The actual * error code can be retrieved by calling * socket_last_error. This error code may be passed to * socket_strerror to get a textual explanation of the * error. * @throws SocketsException - * + * */ -function socket_accept($socket) +function socket_accept( $socket) { error_clear_last(); $result = \socket_accept($socket); @@ -46,19 +46,19 @@ function socket_accept($socket) /** - * Create a Socket resource, and bind it to the provided AddrInfo resource. The return + * Create a Socket instance, and bind it to the provided AddressInfo. The return * value of this function may be used with socket_listen. - * - * @param resource $addr Resource created from socket_addrinfo_lookup. - * @return resource Returns a Socket resource on success. + * + * @param \AddressInfo $address AddressInfo instance created from socket_addrinfo_lookup. + * @return resource|null Returns a Socket instance on success. * @throws SocketsException - * + * */ -function socket_addrinfo_bind($addr) +function socket_addrinfo_bind(\AddressInfo $address) { error_clear_last(); - $result = \socket_addrinfo_bind($addr); - if ($result === null) { + $result = \socket_addrinfo_bind($address); + if ($result === false) { throw SocketsException::createFromPhpError(); } return $result; @@ -66,19 +66,44 @@ function socket_addrinfo_bind($addr) /** - * Create a Socket resource, and connect it to the provided AddrInfo resource. The return + * Create a Socket instance, and connect it to the provided AddressInfo instance. The return * value of this function may be used with the rest of the socket functions. - * - * @param resource $addr Resource created from socket_addrinfo_lookup - * @return resource Returns a Socket resource on success. + * + * @param \AddressInfo $address AddressInfo instance created from socket_addrinfo_lookup + * @return resource|null Returns a Socket instance on success. * @throws SocketsException - * + * */ -function socket_addrinfo_connect($addr) +function socket_addrinfo_connect(\AddressInfo $address) { error_clear_last(); - $result = \socket_addrinfo_connect($addr); - if ($result === null) { + $result = \socket_addrinfo_connect($address); + if ($result === false) { + throw SocketsException::createFromPhpError(); + } + return $result; +} + + +/** + * Lookup different ways we can connect to host. The returned array contains + * a set of AddressInfo instances that we can bind to using socket_addrinfo_bind. + * + * @param string $host Hostname to search. + * @param mixed $service The service to connect to. If service is a name, it is translated to the corresponding + * port number. + * @param array $hints Hints provide criteria for selecting addresses returned. You may specify the + * hints as defined by getadrinfo. + * @return resource[] Returns an array of AddressInfo instances that can be used with the other socket_addrinfo functions. + * On failure, FALSE is returned. + * @throws SocketsException + * + */ +function socket_addrinfo_lookup(string $host, $service = null, array $hints = []): iterable +{ + error_clear_last(); + $result = \socket_addrinfo_lookup($host, $service, $hints); + if ($result === false) { throw SocketsException::createFromPhpError(); } return $result; @@ -90,12 +115,12 @@ function socket_addrinfo_connect($addr) * described by socket. This has to be done before * a connection is be established using socket_connect * or socket_listen. - * - * @param resource $socket A valid socket resource created with socket_create. + * + * @param resource $socket A Socket instance created with socket_create. * @param string $address If the socket is of the AF_INET family, the * address is an IP in dotted-quad notation * (e.g. 127.0.0.1). - * + * * If the socket is of the AF_UNIX family, the * address is the path of a * Unix-domain socket (e.g. /tmp/my.sock). @@ -103,9 +128,9 @@ function socket_addrinfo_connect($addr) * binding an AF_INET socket, and designates * the port on which to listen for connections. * @throws SocketsException - * + * */ -function socket_bind($socket, string $address, int $port = 0): void +function socket_bind( $socket, string $address, int $port = 0): void { error_clear_last(); $result = \socket_bind($socket, $address, $port); @@ -116,26 +141,27 @@ function socket_bind($socket, string $address, int $port = 0): void /** - * Initiate a connection to address using the socket resource - * socket, which must be a valid socket - * resource created with socket_create. - * - * @param resource $socket + * Initiate a connection to address using the Socket instance + * socket, which must be Socket + * instance created with socket_create. + * + * @param resource $socket A Socket instance created with + * socket_create. * @param string $address The address parameter is either an IPv4 address - * in dotted-quad notation (e.g. 127.0.0.1) if - * socket is AF_INET, a valid - * IPv6 address (e.g. ::1) if IPv6 support is enabled and + * in dotted-quad notation (e.g. 127.0.0.1) if + * socket is AF_INET, a valid + * IPv6 address (e.g. ::1) if IPv6 support is enabled and * socket is AF_INET6 * or the pathname of a Unix domain socket, if the socket family is * AF_UNIX. * @param int $port The port parameter is only used and is mandatory - * when connecting to an AF_INET or an + * when connecting to an AF_INET or an * AF_INET6 socket, and designates * the port on the remote host to which a connection should be made. * @throws SocketsException - * + * */ -function socket_connect($socket, string $address, int $port = 0): void +function socket_connect( $socket, string $address, int $port = null): void { error_clear_last(); $result = \socket_connect($socket, $address, $port); @@ -146,26 +172,26 @@ function socket_connect($socket, string $address, int $port = 0): void /** - * socket_create_listen creates a new socket resource of + * socket_create_listen creates a new Socket instance of * type AF_INET listening on all * local interfaces on the given port waiting for new connections. - * + * * This function is meant to ease the task of creating a new socket which * only listens to accept new connections. - * + * * @param int $port The port on which to listen on all interfaces. * @param int $backlog The backlog parameter defines the maximum length * the queue of pending connections may grow to. * SOMAXCONN may be passed as * backlog parameter, see * socket_listen for more information. - * @return resource socket_create_listen returns a new socket resource + * @return resource socket_create_listen returns a new Socket instance * on success. The error code can be retrieved with * socket_last_error. This code may be passed to * socket_strerror to get a textual explanation of the * error. * @throws SocketsException - * + * */ function socket_create_listen(int $port, int $backlog = 128) { @@ -180,14 +206,14 @@ function socket_create_listen(int $port, int $backlog = 128) /** * socket_create_pair creates two connected and - * indistinguishable sockets, and stores them in fd. + * indistinguishable sockets, and stores them in pair. * This function is commonly used in IPC (InterProcess Communication). - * + * * @param int $domain The domain parameter specifies the protocol * family to be used by the socket. See socket_create * for the full list. * @param int $type The type parameter selects the type of communication - * to be used by the socket. See socket_create for the + * to be used by the socket. See socket_create for the * full list. * @param int $protocol The protocol parameter sets the specific * protocol within the specified domain to be used @@ -196,17 +222,17 @@ function socket_create_listen(int $port, int $backlog = 128) * the desired protocol is TCP, or UDP the corresponding constants * SOL_TCP, and SOL_UDP * can also be used. - * - * See socket_create for the full list of supported + * + * See socket_create for the full list of supported * protocols. - * @param resource[]|null $fd Reference to an array in which the two socket resources will be inserted. + * @param array $pair Reference to an array in which the two Socket instances will be inserted. * @throws SocketsException - * + * */ -function socket_create_pair(int $domain, int $type, int $protocol, ?iterable &$fd): void +function socket_create_pair(int $domain, int $type, int $protocol, array &$pair): void { error_clear_last(); - $result = \socket_create_pair($domain, $type, $protocol, $fd); + $result = \socket_create_pair($domain, $type, $protocol, $pair); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -214,10 +240,10 @@ function socket_create_pair(int $domain, int $type, int $protocol, ?iterable &$f /** - * Creates and returns a socket resource, also referred to as an endpoint + * Creates and returns a Socket instance, also referred to as an endpoint * of communication. A typical network connection is made up of 2 sockets, one * performing the role of the client, and another performing the role of the server. - * + * * @param int $domain The domain parameter specifies the protocol * family to be used by the socket. * @param int $type The type parameter selects the type of communication @@ -229,12 +255,12 @@ function socket_create_pair(int $domain, int $type, int $protocol, ?iterable &$f * the desired protocol is TCP, or UDP the corresponding constants * SOL_TCP, and SOL_UDP * can also be used. - * @return resource socket_create returns a socket resource on success. The actual error code can be retrieved by calling + * @return resource socket_create returns a Socket instance on success. The actual error code can be retrieved by calling * socket_last_error. This error code may be passed to * socket_strerror to get a textual explanation of the * error. * @throws SocketsException - * + * */ function socket_create(int $domain, int $type, int $protocol) { @@ -248,14 +274,14 @@ function socket_create(int $domain, int $type, int $protocol) /** - * - * - * @param resource $socket + * + * + * @param resource $socket * @return resource Return resource. * @throws SocketsException - * + * */ -function socket_export_stream($socket) +function socket_export_stream( $socket) { error_clear_last(); $result = \socket_export_stream($socket); @@ -268,10 +294,10 @@ function socket_export_stream($socket) /** * The socket_get_option function retrieves the value for - * the option specified by the optname parameter for the + * the option specified by the option parameter for the * specified socket. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @param int $level The level parameter specifies the protocol * level at which the option resides. For example, to retrieve options at @@ -280,32 +306,32 @@ function socket_export_stream($socket) * TCP, can be used by * specifying the protocol number of that level. Protocol numbers can be * found by using the getprotobyname function. - * @param int $optname Reports whether the socket lingers on - * socket_close if data is present. By default, + * @param int $option Reports whether the socket lingers on + * socket_close if data is present. By default, * when the socket is closed, it attempts to send all unsent data. - * In the case of a connection-oriented socket, + * In the case of a connection-oriented socket, * socket_close will wait for its peer to * acknowledge the data. - * - * If l_onoff is non-zero and - * l_linger is zero, all the - * unsent data will be discarded and RST (reset) is sent to the + * + * If l_onoff is non-zero and + * l_linger is zero, all the + * unsent data will be discarded and RST (reset) is sent to the * peer in the case of a connection-oriented socket. - * - * On the other hand, if l_onoff is + * + * On the other hand, if l_onoff is * non-zero and l_linger is non-zero, - * socket_close will block until all the data + * socket_close will block until all the data * is sent or the time specified in l_linger - * elapses. If the socket is non-blocking, + * elapses. If the socket is non-blocking, * socket_close will fail and return an error. - * @return mixed Returns the value of the given options. + * @return mixed Returns the value of the given option. * @throws SocketsException - * + * */ -function socket_get_option($socket, int $level, int $optname) +function socket_get_option( $socket, int $level, int $option) { error_clear_last(); - $result = \socket_get_option($socket, $level, $optname); + $result = \socket_get_option($socket, $level, $option); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -316,8 +342,8 @@ function socket_get_option($socket, int $level, int $optname) /** * Queries the remote side of the given socket which may either result in * host/port or in a Unix filesystem path, dependent on its type. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @param string $address If the given socket is of type AF_INET or * AF_INET6, socket_getpeername @@ -326,7 +352,7 @@ function socket_get_option($socket, int $level, int $optname) * fe80::1) in the address * parameter and, if the optional port parameter is * present, also the associated port. - * + * * If the given socket is of type AF_UNIX, * socket_getpeername will return the Unix filesystem * path (e.g. /var/run/daemon.sock) in the @@ -334,9 +360,9 @@ function socket_get_option($socket, int $level, int $optname) * @param int|null $port If given, this will hold the port associated to * address. * @throws SocketsException - * + * */ -function socket_getpeername($socket, string &$address, ?int &$port = null): void +function socket_getpeername( $socket, string &$address, ?int &$port = null): void { error_clear_last(); $result = \socket_getpeername($socket, $address, $port); @@ -347,29 +373,29 @@ function socket_getpeername($socket, string &$address, ?int &$port = null): void /** - * - * - * @param resource $socket A valid socket resource created with socket_create + * + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. - * @param string|null $addr If the given socket is of type AF_INET + * @param string $address If the given socket is of type AF_INET * or AF_INET6, socket_getsockname * will return the local IP address in appropriate notation (e.g. * 127.0.0.1 or fe80::1) in the * address parameter and, if the optional * port parameter is present, also the associated port. - * + * * If the given socket is of type AF_UNIX, * socket_getsockname will return the Unix filesystem * path (e.g. /var/run/daemon.sock) in the * address parameter. * @param int|null $port If provided, this will hold the associated port. * @throws SocketsException - * + * */ -function socket_getsockname($socket, ?string &$addr, ?int &$port = null): void +function socket_getsockname( $socket, string &$address, ?int &$port = null): void { error_clear_last(); - $result = \socket_getsockname($socket, $addr, $port); + $result = \socket_getsockname($socket, $address, $port); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -378,17 +404,17 @@ function socket_getsockname($socket, ?string &$addr, ?int &$port = null): void /** * Imports a stream that encapsulates a socket into a socket extension resource. - * + * * @param resource $stream The stream resource to import. - * @return resource|false Returns FALSE. + * @return resource Returns FALSE on failure. * @throws SocketsException - * + * */ -function socket_import_stream($stream) +function socket_import_stream( $stream) { error_clear_last(); $result = \socket_import_stream($stream); - if ($result === null) { + if ($result === false) { throw SocketsException::createFromPhpError(); } return $result; @@ -400,19 +426,19 @@ function socket_import_stream($stream) * using socket_create and bound to a name with * socket_bind, it may be told to listen for incoming * connections on socket. - * + * * socket_listen is applicable only to sockets of * type SOCK_STREAM or * SOCK_SEQPACKET. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_addrinfo_bind * @param int $backlog A maximum of backlog incoming connections will be * queued for processing. If a connection request arrives with the queue * full the client may receive an error with an indication of * ECONNREFUSED, or, if the underlying protocol supports * retransmission, the request may be ignored so that retries may succeed. - * + * * The maximum number passed to the backlog * parameter highly depends on the underlying platform. On Linux, it is * silently truncated to SOMAXCONN. On win32, if @@ -421,9 +447,9 @@ function socket_import_stream($stream) * reasonable value. There is no standard provision to * find out the actual backlog value on this platform. * @throws SocketsException - * + * */ -function socket_listen($socket, int $backlog = 0): void +function socket_listen( $socket, int $backlog = 0): void { error_clear_last(); $result = \socket_listen($socket, $backlog); @@ -434,45 +460,45 @@ function socket_listen($socket, int $backlog = 0): void /** - * The function socket_read reads from the socket - * resource socket created by the + * The function socket_read reads from the Socket instance + * socket created by the * socket_create or * socket_accept functions. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @param int $length The maximum number of bytes read is specified by the * length parameter. Otherwise you can use * \r, \n, - * or \0 to end reading (depending on the type + * or \0 to end reading (depending on the mode * parameter, see below). - * @param int $type Optional type parameter is a named constant: - * - * - * + * @param int $mode Optional mode parameter is a named constant: + * + * + * * PHP_BINARY_READ (Default) - use the system * recv() function. Safe for reading binary data. - * - * - * - * + * + * + * + * * PHP_NORMAL_READ - reading stops at * \n or \r. - * - * - * + * + * + * * @return string socket_read returns the data as a string on success (including if the remote host has closed the * connection). The error code can be retrieved with * socket_last_error. This code may be passed to * socket_strerror to get a textual representation of * the error. * @throws SocketsException - * + * */ -function socket_read($socket, int $length, int $type = PHP_BINARY_READ): string +function socket_read( $socket, int $length, int $mode = PHP_BINARY_READ): string { error_clear_last(); - $result = \socket_read($socket, $length, $type); + $result = \socket_read($socket, $length, $mode); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -482,58 +508,58 @@ function socket_read($socket, int $length, int $type = PHP_BINARY_READ): string /** * The function socket_send sends - * len bytes to the socket - * socket from buf. - * - * @param resource $socket A valid socket resource created with socket_create + * length bytes to the socket + * socket from data. + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. - * @param string $buf A buffer containing the data that will be sent to the remote host. - * @param int $len The number of bytes that will be sent to the remote host from - * buf. - * @param int $flags The value of flags can be any combination of + * @param string $data A buffer containing the data that will be sent to the remote host. + * @param int $length The number of bytes that will be sent to the remote host from + * data. + * @param int $flags The value of flags can be any combination of * the following flags, joined with the binary OR (|) * operator. - * + * * Possible values for flags - * - * - * + * + * + * * MSG_OOB - * + * * Send OOB (out-of-band) data. - * - * - * + * + * + * * MSG_EOR - * + * * Indicate a record mark. The sent data completes the record. - * - * - * + * + * + * * MSG_EOF - * + * * Close the sender side of the socket and include an appropriate * notification of this at the end of the sent data. The sent data * completes the transaction. - * - * - * + * + * + * * MSG_DONTROUTE - * + * * Bypass routing, use direct interface. - * - * - * - * - * + * + * + * + * + * * @return int socket_send returns the number of bytes sent. * @throws SocketsException - * + * */ -function socket_send($socket, string $buf, int $len, int $flags): int +function socket_send( $socket, string $data, int $length, int $flags): int { error_clear_last(); - $result = \socket_send($socket, $buf, $len, $flags); + $result = \socket_send($socket, $data, $length, $flags); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -542,16 +568,16 @@ function socket_send($socket, string $buf, int $len, int $flags): int /** - * - * - * @param resource $socket - * @param array $message - * @param int $flags + * + * + * @param resource $socket + * @param array $message + * @param int $flags * @return int Returns the number of bytes sent. * @throws SocketsException - * + * */ -function socket_sendmsg($socket, array $message, int $flags = 0): int +function socket_sendmsg( $socket, array $message, int $flags = 0): int { error_clear_last(); $result = \socket_sendmsg($socket, $message, $flags); @@ -564,62 +590,62 @@ function socket_sendmsg($socket, array $message, int $flags = 0): int /** * The function socket_sendto sends - * len bytes from buf + * length bytes from data * through the socket socket to the - * port at the address addr. - * - * @param resource $socket A valid socket resource created using socket_create. - * @param string $buf The sent data will be taken from buffer buf. - * @param int $len len bytes from buf will be + * port at the address address. + * + * @param resource $socket A Socket instance created using socket_create. + * @param string $data The sent data will be taken from buffer data. + * @param int $length length bytes from data will be * sent. - * @param int $flags The value of flags can be any combination of + * @param int $flags The value of flags can be any combination of * the following flags, joined with the binary OR (|) * operator. - * + * * Possible values for flags - * - * - * + * + * + * * MSG_OOB - * + * * Send OOB (out-of-band) data. - * - * - * + * + * + * * MSG_EOR - * + * * Indicate a record mark. The sent data completes the record. - * - * - * + * + * + * * MSG_EOF - * + * * Close the sender side of the socket and include an appropriate * notification of this at the end of the sent data. The sent data * completes the transaction. - * - * - * + * + * + * * MSG_DONTROUTE - * + * * Bypass routing, use direct interface. - * - * - * - * - * - * @param string $addr IP address of the remote host. + * + * + * + * + * + * @param string $address IP address of the remote host. * @param int $port port is the remote port number at which the data * will be sent. * @return int socket_sendto returns the number of bytes sent to the * remote host. * @throws SocketsException - * + * */ -function socket_sendto($socket, string $buf, int $len, int $flags, string $addr, int $port = 0): int +function socket_sendto( $socket, string $data, int $length, int $flags, string $address, int $port = null): int { error_clear_last(); - $result = \socket_sendto($socket, $buf, $len, $flags, $addr, $port); + $result = \socket_sendto($socket, $data, $length, $flags, $address, $port); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -628,20 +654,20 @@ function socket_sendto($socket, string $buf, int $len, int $flags, string $addr, /** - * The socket_set_block function removes the - * O_NONBLOCK flag on the socket specified by the + * The socket_set_block function removes the + * O_NONBLOCK flag on the socket specified by the * socket parameter. - * - * When an operation (e.g. receive, send, connect, accept, ...) is performed on + * + * When an operation (e.g. receive, send, connect, accept, ...) is performed on * a blocking socket, the script will pause its execution until it receives * a signal or it can perform the operation. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @throws SocketsException - * + * */ -function socket_set_block($socket): void +function socket_set_block( $socket): void { error_clear_last(); $result = \socket_set_block($socket); @@ -652,21 +678,21 @@ function socket_set_block($socket): void /** - * The socket_set_nonblock function sets the + * The socket_set_nonblock function sets the * O_NONBLOCK flag on the socket specified by * the socket parameter. - * - * When an operation (e.g. receive, send, connect, accept, ...) is performed on - * a non-blocking socket, the script will not pause its execution until it receives a + * + * When an operation (e.g. receive, send, connect, accept, ...) is performed on + * a non-blocking socket, the script will not pause its execution until it receives a * signal or it can perform the operation. Rather, if the operation would result * in a block, the called function will fail. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @throws SocketsException - * + * */ -function socket_set_nonblock($socket): void +function socket_set_nonblock( $socket): void { error_clear_last(); $result = \socket_set_nonblock($socket); @@ -678,30 +704,30 @@ function socket_set_nonblock($socket): void /** * The socket_set_option function sets the option - * specified by the optname parameter, at the + * specified by the option parameter, at the * specified protocol level, to the value pointed to - * by the optval parameter for the + * by the value parameter for the * socket. - * - * @param resource $socket A valid socket resource created with socket_create + * + * @param resource $socket A Socket instance created with socket_create * or socket_accept. * @param int $level The level parameter specifies the protocol * level at which the option resides. For example, to retrieve options at * the socket level, a level parameter of * SOL_SOCKET would be used. Other levels, such as - * TCP, can be used by specifying the protocol number of that level. - * Protocol numbers can be found by using the + * TCP, can be used by specifying the protocol number of that level. + * Protocol numbers can be found by using the * getprotobyname function. - * @param int $optname The available socket options are the same as those for the + * @param int $option The available socket options are the same as those for the * socket_get_option function. - * @param int|string|array $optval The option value. + * @param $value The option value. * @throws SocketsException - * + * */ -function socket_set_option($socket, int $level, int $optname, $optval): void +function socket_set_option( $socket, int $level, int $option, $value): void { error_clear_last(); - $result = \socket_set_option($socket, $level, $optname, $optval); + $result = \socket_set_option($socket, $level, $option, $value); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -712,41 +738,41 @@ function socket_set_option($socket, int $level, int $optname, $optval): void * The socket_shutdown function allows you to stop * incoming, outgoing or all data (the default) from being sent through the * socket - * - * @param resource $socket A valid socket resource created with socket_create. - * @param int $how The value of how can be one of the following: - * - * possible values for how - * - * - * + * + * @param resource $socket A Socket instance created with socket_create. + * @param int $mode The value of mode can be one of the following: + * + * possible values for mode + * + * + * * 0 - * + * * Shutdown socket reading - * - * - * + * + * + * * 1 - * + * * Shutdown socket writing - * - * - * + * + * + * * 2 - * + * * Shutdown socket reading and writing - * - * - * - * - * + * + * + * + * + * * @throws SocketsException - * + * */ -function socket_shutdown($socket, int $how = 2): void +function socket_shutdown( $socket, int $mode = 2): void { error_clear_last(); - $result = \socket_shutdown($socket, $how); + $result = \socket_shutdown($socket, $mode); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -756,18 +782,18 @@ function socket_shutdown($socket, int $how = 2): void /** * Exports the WSAPROTOCOL_INFO structure into shared memory and returns * an identifier to be used with socket_wsaprotocol_info_import. The - * exported ID is only valid for the given target_pid. - * - * @param resource $socket A valid socket resource. - * @param int $target_pid The ID of the process which will import the socket. + * exported ID is only valid for the given process_id. + * + * @param \Socket $socket A Socket instance. + * @param int $process_id The ID of the process which will import the socket. * @return string Returns an identifier to be used for the import * @throws SocketsException - * + * */ -function socket_wsaprotocol_info_export($socket, int $target_pid): string +function socket_wsaprotocol_info_export(\Socket $socket, int $process_id): string { error_clear_last(); - $result = \socket_wsaprotocol_info_export($socket, $target_pid); + $result = \socket_wsaprotocol_info_export($socket, $process_id); if ($result === false) { throw SocketsException::createFromPhpError(); } @@ -777,12 +803,12 @@ function socket_wsaprotocol_info_export($socket, int $target_pid): string /** * Imports a socket which has formerly been exported from another process. - * + * * @param string $info_id The ID which has been returned by a former call to * socket_wsaprotocol_info_export. - * @return resource Returns the socket resource + * @return resource Returns a Socket instance on success * @throws SocketsException - * + * */ function socket_wsaprotocol_info_import(string $info_id) { @@ -797,11 +823,11 @@ function socket_wsaprotocol_info_import(string $info_id) /** * Releases the shared memory corresponding to the given info_id. - * + * * @param string $info_id The ID which has been returned by a former call to * socket_wsaprotocol_info_export. * @throws SocketsException - * + * */ function socket_wsaprotocol_info_release(string $info_id): void { @@ -811,3 +837,5 @@ function socket_wsaprotocol_info_release(string $info_id): void throw SocketsException::createFromPhpError(); } } + + diff --git a/generated/sodium.php b/generated/sodium.php index 6cb378ad..d1d664c8 100644 --- a/generated/sodium.php +++ b/generated/sodium.php @@ -5,24 +5,23 @@ use Safe\Exceptions\SodiumException; /** - * Uses a CPU- and memory-hard hash algorithm along with a randomly-generated salt, and memory and CPU limits to generate an ASCII-encoded hash suitable for password storage. - * - * @param string $password string; The password to generate a hash for. - * @param int $opslimit Represents a maximum amount of computations to perform. Raising this number will make the function require more CPU cycles to compute a key. There are constants available to set the operations limit to appropriate values depending on intended use, in order of strength: SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE and SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE. - * @param int $memlimit The maximum amount of RAM that the function will use, in bytes. There are constants to help you choose an appropriate value, in order of size: SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE, and SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE. Typically these should be paired with the matching opslimit values. - * @return string Returns the hashed password. - * - * In order to produce the same password hash from the same password, the same values for opslimit and memlimit must be used. These are embedded within the generated hash, so - * everything that's needed to verify the hash is included. This allows - * the sodium_crypto_pwhash_str_verify function to verify the hash without - * needing separate storage for the other parameters. + * Verify then decrypt with AES-256-GCM. + * Only available if sodium_crypto_aead_aes256gcm_is_available returns TRUE. + * + * @param string $ciphertext Must be in the format provided by sodium_crypto_aead_aes256gcm_encrypt + * (ciphertext and tag, concatenated). + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 12 bytes long. + * @param string $key Encryption key (256-bit). + * @return string Returns the plaintext on success. * @throws SodiumException - * + * */ -function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string +function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string { error_clear_last(); - $result = \sodium_crypto_pwhash_str($password, $opslimit, $memlimit); + $result = \sodium_crypto_aead_aes256gcm_decrypt($ciphertext, $additional_data, $nonce, $key); if ($result === false) { throw SodiumException::createFromPhpError(); } @@ -31,28 +30,299 @@ function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit /** - * This function provides low-level access to libsodium's crypto_pwhash key derivation function. Unless you have specific reason to use this function, you should use sodium_crypto_pwhash_str or password_hash functions instead. - * - * @param int $length integer; The length of the password hash to generate, in bytes. - * @param string $password string; The password to generate a hash for. - * @param string $salt string A salt to add to the password before hashing. The salt should be unpredictable, ideally generated from a good random mumber source such as random_bytes, and have a length of at least SODIUM_CRYPTO_PWHASH_SALTBYTES bytes. - * @param int $opslimit Represents a maximum amount of computations to perform. Raising this number will make the function require more CPU cycles to compute a key. There are some constants available to set the operations limit to appropriate values depending on intended use, in order of strength: SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE and SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE. - * @param int $memlimit The maximum amount of RAM that the function will use, in bytes. There are constants to help you choose an appropriate value, in order of size: SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE, and SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE. Typically these should be paired with the matching opslimit values. - * @param int $alg integer A number indicating the hash algorithm to use. By default SODIUM_CRYPTO_PWHASH_ALG_DEFAULT (the currently recommended algorithm, which can change from one version of libsodium to another), or explicitly using SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13, representing the Argon2id algorithm version 1.3. - * @return string Returns the derived key. The return value is a binary string of the hash, not an ASCII-encoded representation, and does not contain additional information about the parameters used to create the hash, so you will need to keep that information if you are ever going to verify the password in future. Use sodium_crypto_pwhash_str to avoid needing to do all that. + * Verify then decrypt with ChaCha20-Poly1305. + * + * @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_encrypt + * (ciphertext and tag, concatenated). + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 8 bytes long. + * @param string $key Encryption key (256-bit). + * @return string Returns the plaintext on success. * @throws SodiumException - * + * */ -function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $alg = null): string +function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string { error_clear_last(); - if ($alg !== null) { - $result = \sodium_crypto_pwhash($length, $password, $salt, $opslimit, $memlimit, $alg); - } else { - $result = \sodium_crypto_pwhash($length, $password, $salt, $opslimit, $memlimit); + $result = \sodium_crypto_aead_chacha20poly1305_decrypt($ciphertext, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Encrypt then authenticate with ChaCha20-Poly1305. + * + * @param string $message The plaintext message to encrypt. + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 8 bytes long. + * @param string $key Encryption key (256-bit). + * @return string Returns the ciphertext and tag on success. + * @throws SodiumException + * + */ +function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_aead_chacha20poly1305_encrypt($message, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Verify then decrypt with ChaCha20-Poly1305 (IETF variant). + * + * The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both. + * + * @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_ietf_encrypt + * (ciphertext and tag, concatenated). + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 12 bytes long. + * @param string $key Encryption key (256-bit). + * @return string Returns the plaintext on success. + * @throws SodiumException + * + */ +function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_aead_chacha20poly1305_ietf_decrypt($ciphertext, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Encrypt then authenticate with ChaCha20-Poly1305 (IETF variant). + * + * The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both. + * + * @param string $message The plaintext message to encrypt. + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 12 bytes long. + * @param string $key Encryption key (256-bit). + * @return string Returns the ciphertext and tag on success. + * @throws SodiumException + * + */ +function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Verify then decrypt with ChaCha20-Poly1305 (eXtended-nonce variant). + * + * Generally, XChaCha20-Poly1305 is the best of the provided AEAD modes to use. + * + * @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_ietf_encrypt + * (ciphertext and tag, concatenated). + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 24 bytes long. + * This is a large enough bound to generate randomly (i.e. random_bytes). + * @param string $key Encryption key (256-bit). + * @return string Returns the plaintext on success. + * @throws SodiumException + * + */ +function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($ciphertext, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Encrypt then authenticate with XChaCha20-Poly1305 (eXtended-nonce variant). + * + * Generally, XChaCha20-Poly1305 is the best of the provided AEAD modes to use. + * + * @param string $message The plaintext message to encrypt. + * @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag + * appended to the ciphertext, but it is not encrypted or stored in the ciphertext. + * @param string $nonce A number that must be only used once, per message. 24 bytes long. + * This is a large enough bound to generate randomly (i.e. random_bytes). + * @param string $key Encryption key (256-bit). + * @return string Returns the ciphertext and tag on success. + * @throws SodiumException + * + */ +function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $additional_data, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Verify the authentication tag is valid for a given message and key. + * + * Unlike with digital signatures (e.g. sodium_crypto_sign_verify_detached), + * any party capable of verifying a message is also capable of authenticating + * their own messages. (Hence, symmetric authentication.) + * + * @param string $mac Authentication tag produced by sodium_crypto_auth + * @param string $message Message + * @param string $key Authentication key + * @throws SodiumException + * + */ +function sodium_crypto_auth_verify(string $mac, string $message, string $key): void +{ + error_clear_last(); + $result = \sodium_crypto_auth_verify($mac, $message, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } +} + + +/** + * Decrypt a message using asymmetric (public key) cryptography. + * + * @param string $ciphertext The encrypted message to attempt to decrypt. + * @param string $nonce A number that must be only used once, per message. 24 bytes long. + * This is a large enough bound to generate randomly (i.e. random_bytes). + * @param string $key_pair See sodium_crypto_box_keypair_from_secretkey_and_publickey. + * This should include the sender's public key and the recipient's secret key. + * @return string Returns the plaintext message on success. + * @throws SodiumException + * + */ +function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string +{ + error_clear_last(); + $result = \sodium_crypto_box_open($ciphertext, $nonce, $key_pair); + if ($result === false) { + throw SodiumException::createFromPhpError(); } + return $result; +} + + +/** + * Decrypt a message that was encrypted with sodium_crypto_box_seal + * + * @param string $ciphertext The encrypted message + * @param string $key_pair The keypair of the recipient. Must include the secret key. + * @return string The plaintext on success. + * @throws SodiumException + * + */ +function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string +{ + error_clear_last(); + $result = \sodium_crypto_box_seal_open($ciphertext, $key_pair); if ($result === false) { throw SodiumException::createFromPhpError(); } return $result; } + + +/** + * Appends a message to the internal hash state. + * + * @param string $state The return value of sodium_crypto_generichash_init. + * @param string $message Data to append to the hashing state. + * @throws SodiumException + * + */ +function sodium_crypto_generichash_update(string &$state, string $message): void +{ + error_clear_last(); + $result = \sodium_crypto_generichash_update($state, $message); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } +} + + +/** + * Decrypt an encrypted message with a symmetric (shared) key. + * + * @param string $ciphertext Must be in the format provided by sodium_crypto_secretbox + * (ciphertext and tag, concatenated). + * @param string $nonce A number that must be only used once, per message. 24 bytes long. + * This is a large enough bound to generate randomly (i.e. random_bytes). + * @param string $key Encryption key (256-bit). + * @return string The decrypted string on success. + * @throws SodiumException + * + */ +function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string +{ + error_clear_last(); + $result = \sodium_crypto_secretbox_open($ciphertext, $nonce, $key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Verify the signature attached to a message and return the message + * + * @param string $signed_message A message signed with sodium_crypto_sign + * @param string $public_key An Ed25519 public key + * @return string Returns the original signed message on success. + * @throws SodiumException + * + */ +function sodium_crypto_sign_open(string $signed_message, string $public_key): string +{ + error_clear_last(); + $result = \sodium_crypto_sign_open($signed_message, $public_key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } + return $result; +} + + +/** + * Verify signature for the message + * + * @param string $signature The cryptographic signature obtained from sodium_crypto_sign_detached + * @param string $message The message being verified + * @param string $public_key Ed25519 public key + * @throws SodiumException + * + */ +function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): void +{ + error_clear_last(); + $result = \sodium_crypto_sign_verify_detached($signature, $message, $public_key); + if ($result === false) { + throw SodiumException::createFromPhpError(); + } +} + + diff --git a/generated/solr.php b/generated/solr.php index 4d4e0418..f316074b 100644 --- a/generated/solr.php +++ b/generated/solr.php @@ -6,10 +6,10 @@ /** * This function returns the current version of the extension as a string. - * + * * @return string It returns a string on success. * @throws SolrException - * + * */ function solr_get_version(): string { @@ -20,3 +20,5 @@ function solr_get_version(): string } return $result; } + + diff --git a/generated/spl.php b/generated/spl.php index 679e6899..9d0ba2e4 100644 --- a/generated/spl.php +++ b/generated/spl.php @@ -4,136 +4,25 @@ use Safe\Exceptions\SplException; -/** - * This function returns an array with the names of the interfaces that the - * given class and its parents implement. - * - * @param mixed $class An object (class instance) or a string (class or interface name). - * @param bool $autoload Whether to allow this function to load the class automatically through - * the __autoload magic method. - * @return array An array on success. - * @throws SplException - * - */ -function class_implements($class, bool $autoload = true): array -{ - error_clear_last(); - $result = \class_implements($class, $autoload); - if ($result === false) { - throw SplException::createFromPhpError(); - } - return $result; -} - - -/** - * This function returns an array with the name of the parent classes of - * the given class. - * - * @param mixed $class An object (class instance) or a string (class name). - * @param bool $autoload Whether to allow this function to load the class automatically through - * the __autoload magic method. - * @return array An array on success. - * @throws SplException - * - */ -function class_parents($class, bool $autoload = true): array -{ - error_clear_last(); - $result = \class_parents($class, $autoload); - if ($result === false) { - throw SplException::createFromPhpError(); - } - return $result; -} - - -/** - * This function returns an array with the names of the traits that the - * given class uses. This does however not include - * any traits used by a parent class. - * - * @param mixed $class An object (class instance) or a string (class name). - * @param bool $autoload Whether to allow this function to load the class automatically through - * the __autoload magic method. - * @return array An array on success. - * @throws SplException - * - */ -function class_uses($class, bool $autoload = true): array -{ - error_clear_last(); - $result = \class_uses($class, $autoload); - if ($result === false) { - throw SplException::createFromPhpError(); - } - return $result; -} - - -/** - * Register a function with the spl provided __autoload queue. If the queue - * is not yet activated it will be activated. - * - * If your code has an existing __autoload function then - * this function must be explicitly registered on the __autoload queue. This - * is because spl_autoload_register will effectively - * replace the engine cache for the __autoload function - * by either spl_autoload or - * spl_autoload_call. - * - * If there must be multiple autoload functions, spl_autoload_register - * allows for this. It effectively creates a queue of autoload functions, and - * runs through each of them in the order they are defined. By contrast, - * __autoload may only be defined once. - * - * @param callable(string):void $autoload_function The autoload function being registered. - * If no parameter is provided, then the default implementation of - * spl_autoload will be registered. - * @param bool $throw This parameter specifies whether - * spl_autoload_register should throw - * exceptions when the autoload_function - * cannot be registered. - * @param bool $prepend If true, spl_autoload_register will prepend - * the autoloader on the autoload queue instead of appending it. - * @throws SplException - * - */ -function spl_autoload_register(callable $autoload_function = null, bool $throw = true, bool $prepend = false): void -{ - error_clear_last(); - if ($prepend !== false) { - $result = \spl_autoload_register($autoload_function, $throw, $prepend); - } elseif ($throw !== true) { - $result = \spl_autoload_register($autoload_function, $throw); - } elseif ($autoload_function !== null) { - $result = \spl_autoload_register($autoload_function); - } else { - $result = \spl_autoload_register(); - } - if ($result === false) { - throw SplException::createFromPhpError(); - } -} - - /** * Removes a function from the autoload queue. If the queue * is activated and empty after removing the given function then it will * be deactivated. - * + * * When this function results in the queue being deactivated, any * __autoload function that previously existed will not be reactivated. - * - * @param mixed $autoload_function The autoload function being unregistered. + * + * @param callable $callback The autoload function being unregistered. * @throws SplException - * + * */ -function spl_autoload_unregister($autoload_function): void +function spl_autoload_unregister(callable $callback): void { error_clear_last(); - $result = \spl_autoload_unregister($autoload_function); + $result = \spl_autoload_unregister($callback); if ($result === false) { throw SplException::createFromPhpError(); } } + + diff --git a/generated/sqlsrv.php b/generated/sqlsrv.php index e93aa37a..9cedc2d0 100644 --- a/generated/sqlsrv.php +++ b/generated/sqlsrv.php @@ -5,20 +5,20 @@ use Safe\Exceptions\SqlsrvException; /** - * The transaction begun by sqlsrv_begin_transaction includes - * all statements that were executed after the call to - * sqlsrv_begin_transaction and before calls to - * sqlsrv_rollback or sqlsrv_commit. - * Explicit transactions should be started and committed or rolled back using - * these functions instead of executing SQL statements that begin and commit/roll - * back transactions. For more information, see + * The transaction begun by sqlsrv_begin_transaction includes + * all statements that were executed after the call to + * sqlsrv_begin_transaction and before calls to + * sqlsrv_rollback or sqlsrv_commit. + * Explicit transactions should be started and committed or rolled back using + * these functions instead of executing SQL statements that begin and commit/roll + * back transactions. For more information, see * SQLSRV Transactions. - * + * * @param resource $conn The connection resource returned by a call to sqlsrv_connect. * @throws SqlsrvException - * + * */ -function sqlsrv_begin_transaction($conn): void +function sqlsrv_begin_transaction( $conn): void { error_clear_last(); $result = \sqlsrv_begin_transaction($conn); @@ -29,18 +29,18 @@ function sqlsrv_begin_transaction($conn): void /** - * Cancels a statement. Any results associated with the statement that have not - * been consumed are deleted. After sqlsrv_cancel has been - * called, the specified statement can be re-executed if it was created with - * sqlsrv_prepare. Calling sqlsrv_cancel - * is not necessary if all the results associated with the statement have been + * Cancels a statement. Any results associated with the statement that have not + * been consumed are deleted. After sqlsrv_cancel has been + * called, the specified statement can be re-executed if it was created with + * sqlsrv_prepare. Calling sqlsrv_cancel + * is not necessary if all the results associated with the statement have been * consumed. - * + * * @param resource $stmt The statement resource to be cancelled. * @throws SqlsrvException - * + * */ -function sqlsrv_cancel($stmt): void +function sqlsrv_cancel( $stmt): void { error_clear_last(); $result = \sqlsrv_cancel($stmt); @@ -52,42 +52,42 @@ function sqlsrv_cancel($stmt): void /** * Returns information about the client and specified connection - * + * * @param resource $conn The connection about which information is returned. - * @return array Returns an associative array with keys described in the table below. - * + * @return array Returns an associative array with keys described in the table below. + * * Array returned by sqlsrv_client_info - * - * - * + * + * + * * Key * Description - * - * - * - * + * + * + * + * * DriverDllName * SQLNCLI10.DLL - * - * + * + * * DriverODBCVer * ODBC version (xx.yy) - * - * + * + * * DriverVer * SQL Server Native Client DLL version (10.5.xxx) - * - * + * + * * ExtensionVer * php_sqlsrv.dll version (2.0.xxx.x) - * - * - * - * + * + * + * + * * @throws SqlsrvException - * + * */ -function sqlsrv_client_info($conn): array +function sqlsrv_client_info( $conn): array { error_clear_last(); $result = \sqlsrv_client_info($conn); @@ -100,12 +100,12 @@ function sqlsrv_client_info($conn): array /** * Closes an open connection and releases resourses associated with the connection. - * + * * @param resource $conn The connection to be closed. * @throws SqlsrvException - * + * */ -function sqlsrv_close($conn): void +function sqlsrv_close( $conn): void { error_clear_last(); $result = \sqlsrv_close($conn); @@ -116,20 +116,20 @@ function sqlsrv_close($conn): void /** - * Commits a transaction that was begun with sqlsrv_begin_transaction. - * The connection is returned to auto-commit mode after sqlsrv_commit - * is called. The transaction that is committed includes all statements that were - * executed after the call to sqlsrv_begin_transaction. - * Explicit transactions should be started and committed or rolled back using these - * functions instead of executing SQL statements that begin and commit/roll back - * transactions. For more information, see + * Commits a transaction that was begun with sqlsrv_begin_transaction. + * The connection is returned to auto-commit mode after sqlsrv_commit + * is called. The transaction that is committed includes all statements that were + * executed after the call to sqlsrv_begin_transaction. + * Explicit transactions should be started and committed or rolled back using these + * functions instead of executing SQL statements that begin and commit/roll back + * transactions. For more information, see * SQLSRV Transactions. - * + * * @param resource $conn The connection on which the transaction is to be committed. * @throws SqlsrvException - * + * */ -function sqlsrv_commit($conn): void +function sqlsrv_commit( $conn): void { error_clear_last(); $result = \sqlsrv_commit($conn); @@ -141,47 +141,47 @@ function sqlsrv_commit($conn): void /** * Changes the driver error handling and logging configurations. - * - * @param string $setting The name of the setting to set. The possible values are + * + * @param string $setting The name of the setting to set. The possible values are * "WarningsReturnAsErrors", "LogSubsystems", and "LogSeverity". * @param mixed $value The value of the specified setting. The following table shows possible values: - * + * * Error and Logging Setting Options - * - * - * + * + * + * * Setting * Options - * - * - * - * + * + * + * + * * WarningsReturnAsErrors * 1 (TRUE) or 0 (FALSE) - * - * + * + * * LogSubsystems - * SQLSRV_LOG_SYSTEM_ALL (-1) - * SQLSRV_LOG_SYSTEM_CONN (2) - * SQLSRV_LOG_SYSTEM_INIT (1) - * SQLSRV_LOG_SYSTEM_OFF (0) - * SQLSRV_LOG_SYSTEM_STMT (4) + * SQLSRV_LOG_SYSTEM_ALL (-1) + * SQLSRV_LOG_SYSTEM_CONN (2) + * SQLSRV_LOG_SYSTEM_INIT (1) + * SQLSRV_LOG_SYSTEM_OFF (0) + * SQLSRV_LOG_SYSTEM_STMT (4) * SQLSRV_LOG_SYSTEM_UTIL (8) - * - * + * + * * LogSeverity - * SQLSRV_LOG_SEVERITY_ALL (-1) - * SQLSRV_LOG_SEVERITY_ERROR (1) - * SQLSRV_LOG_SEVERITY_NOTICE (4) + * SQLSRV_LOG_SEVERITY_ALL (-1) + * SQLSRV_LOG_SEVERITY_ERROR (1) + * SQLSRV_LOG_SEVERITY_NOTICE (4) * SQLSRV_LOG_SEVERITY_WARNING (2) - * - * - * - * + * + * + * + * * @throws SqlsrvException - * + * */ -function sqlsrv_configure(string $setting, $value): void +function sqlsrv_configure(string $setting, $value): void { error_clear_last(); $result = \sqlsrv_configure($setting, $value); @@ -192,15 +192,15 @@ function sqlsrv_configure(string $setting, $value): void /** - * Executes a statement prepared with sqlsrv_prepare. This - * function is ideal for executing a prepared statement multiple times with + * Executes a statement prepared with sqlsrv_prepare. This + * function is ideal for executing a prepared statement multiple times with * different parameter values. - * + * * @param resource $stmt A statement resource returned by sqlsrv_prepare. * @throws SqlsrvException - * + * */ -function sqlsrv_execute($stmt): void +function sqlsrv_execute( $stmt): void { error_clear_last(); $result = \sqlsrv_execute($stmt); @@ -211,19 +211,19 @@ function sqlsrv_execute($stmt): void /** - * Frees all resources for the specified statement. The statement cannot be used - * after sqlsrv_free_stmt has been called on it. If - * sqlsrv_free_stmt is called on an in-progress statement - * that alters server state, statement execution is terminated and the statement + * Frees all resources for the specified statement. The statement cannot be used + * after sqlsrv_free_stmt has been called on it. If + * sqlsrv_free_stmt is called on an in-progress statement + * that alters server state, statement execution is terminated and the statement * is rolled back. - * - * @param resource $stmt The statement for which resources are freed. - * Note that NULL is a valid parameter value. This allows the function to be + * + * @param resource $stmt The statement for which resources are freed. + * Note that NULL is a valid parameter value. This allows the function to be * called multiple times in a script. * @throws SqlsrvException - * + * */ -function sqlsrv_free_stmt($stmt): void +function sqlsrv_free_stmt( $stmt): void { error_clear_last(); $result = \sqlsrv_free_stmt($stmt); @@ -234,29 +234,29 @@ function sqlsrv_free_stmt($stmt): void /** - * Gets field data from the currently selected row. Fields must be accessed in + * Gets field data from the currently selected row. Fields must be accessed in * order. Field indices start at 0. - * - * @param resource $stmt A statement resource returned by sqlsrv_query or + * + * @param resource $stmt A statement resource returned by sqlsrv_query or * sqlsrv_execute. - * @param int $fieldIndex The index of the field to be retrieved. Field indices start at 0. Fields - * must be accessed in order. i.e. If you access field index 1, then field + * @param int $fieldIndex The index of the field to be retrieved. Field indices start at 0. Fields + * must be accessed in order. i.e. If you access field index 1, then field * index 0 will not be available. - * @param int $getAsType The PHP data type for the returned field data. If this parameter is not + * @param int $getAsType The PHP data type for the returned field data. If this parameter is not * set, the field data will be returned as its default PHP data type. - * For information about default PHP data types, see - * Default PHP Data Types + * For information about default PHP data types, see + * Default PHP Data Types * in the Microsoft SQLSRV documentation. * @return mixed Returns data from the specified field on success. * @throws SqlsrvException - * + * */ -function sqlsrv_get_field($stmt, int $fieldIndex, int $getAsType = null) +function sqlsrv_get_field( $stmt, int $fieldIndex, int $getAsType = null) { error_clear_last(); if ($getAsType !== null) { $result = \sqlsrv_get_field($stmt, $fieldIndex, $getAsType); - } else { + }else { $result = \sqlsrv_get_field($stmt, $fieldIndex); } if ($result === false) { @@ -267,16 +267,16 @@ function sqlsrv_get_field($stmt, int $fieldIndex, int $getAsType = null) /** - * Makes the next result of the specified statement active. Results include result + * Makes the next result of the specified statement active. Results include result * sets, row counts, and output parameters. - * + * * @param resource $stmt The statement on which the next result is being called. - * @return bool|null Returns TRUE if the next result was successfully retrieved, FALSE if an error + * @return bool|null Returns TRUE if the next result was successfully retrieved, FALSE if an error * occurred, and NULL if there are no more results to retrieve. * @throws SqlsrvException - * + * */ -function sqlsrv_next_result($stmt): ?bool +function sqlsrv_next_result( $stmt): ?bool { error_clear_last(); $result = \sqlsrv_next_result($stmt); @@ -289,15 +289,15 @@ function sqlsrv_next_result($stmt): ?bool /** * Retrieves the number of fields (columns) on a statement. - * - * @param resource $stmt The statement for which the number of fields is returned. - * sqlsrv_num_fields can be called on a statement before + * + * @param resource $stmt The statement for which the number of fields is returned. + * sqlsrv_num_fields can be called on a statement before * or after statement execution. * @return int Returns the number of fields on success. * @throws SqlsrvException - * + * */ -function sqlsrv_num_fields($stmt): int +function sqlsrv_num_fields( $stmt): int { error_clear_last(); $result = \sqlsrv_num_fields($stmt); @@ -309,23 +309,23 @@ function sqlsrv_num_fields($stmt): int /** - * Retrieves the number of rows in a result set. This function requires that the - * statement resource be created with a static or keyset cursor. For more information, - * see sqlsrv_query, sqlsrv_prepare, - * or Specifying a Cursor Type and Selecting Rows + * Retrieves the number of rows in a result set. This function requires that the + * statement resource be created with a static or keyset cursor. For more information, + * see sqlsrv_query, sqlsrv_prepare, + * or Specifying a Cursor Type and Selecting Rows * in the Microsoft SQLSRV documentation. - * - * @param resource $stmt The statement for which the row count is returned. The statement resource - * must be created with a static or keyset cursor. For more information, see - * sqlsrv_query, sqlsrv_prepare, or - * Specifying a Cursor Type and Selecting Rows + * + * @param resource $stmt The statement for which the row count is returned. The statement resource + * must be created with a static or keyset cursor. For more information, see + * sqlsrv_query, sqlsrv_prepare, or + * Specifying a Cursor Type and Selecting Rows * in the Microsoft SQLSRV documentation. - * @return int Returns the number of rows retrieved on success. + * @return int Returns the number of rows retrieved on success. * If a forward cursor (the default) or dynamic cursor is used, FALSE is returned. * @throws SqlsrvException - * + * */ -function sqlsrv_num_rows($stmt): int +function sqlsrv_num_rows( $stmt): int { error_clear_last(); $result = \sqlsrv_num_rows($stmt); @@ -337,34 +337,34 @@ function sqlsrv_num_rows($stmt): int /** - * Prepares a query for execution. This function is ideal for preparing a query + * Prepares a query for execution. This function is ideal for preparing a query * that will be executed multiple times with different parameter values. - * + * * @param resource $conn A connection resource returned by sqlsrv_connect. * @param string $sql The string that defines the query to be prepared and executed. - * @param array $params An array specifying parameter information when executing a parameterized + * @param array $params An array specifying parameter information when executing a parameterized * query. Array elements can be any of the following: - * + * * A literal value * A PHP variable - * An array with this structure: + * An array with this structure: * array($value [, $direction [, $phpType [, $sqlType]]]) - * + * * The following table describes the elements in the array structure above: - * @param array $options An array specifying query property options. The supported keys are described + * @param array $options An array specifying query property options. The supported keys are described * in the following table: * @return resource Returns a statement resource on success. * @throws SqlsrvException - * + * */ -function sqlsrv_prepare($conn, string $sql, array $params = null, array $options = null) +function sqlsrv_prepare( $conn, string $sql, array $params = null, array $options = null) { error_clear_last(); if ($options !== null) { $result = \sqlsrv_prepare($conn, $sql, $params, $options); } elseif ($params !== null) { $result = \sqlsrv_prepare($conn, $sql, $params); - } else { + }else { $result = \sqlsrv_prepare($conn, $sql); } if ($result === false) { @@ -376,32 +376,32 @@ function sqlsrv_prepare($conn, string $sql, array $params = null, array $options /** * Prepares and executes a query. - * + * * @param resource $conn A connection resource returned by sqlsrv_connect. * @param string $sql The string that defines the query to be prepared and executed. - * @param array $params An array specifying parameter information when executing a parameterized query. + * @param array $params An array specifying parameter information when executing a parameterized query. * Array elements can be any of the following: - * + * * A literal value * A PHP variable - * An array with this structure: + * An array with this structure: * array($value [, $direction [, $phpType [, $sqlType]]]) - * + * * The following table describes the elements in the array structure above: - * @param array $options An array specifying query property options. The supported keys are described + * @param array $options An array specifying query property options. The supported keys are described * in the following table: * @return resource Returns a statement resource on success. * @throws SqlsrvException - * + * */ -function sqlsrv_query($conn, string $sql, array $params = null, array $options = null) +function sqlsrv_query( $conn, string $sql, array $params = null, array $options = null) { error_clear_last(); if ($options !== null) { $result = \sqlsrv_query($conn, $sql, $params, $options); } elseif ($params !== null) { $result = \sqlsrv_query($conn, $sql, $params); - } else { + }else { $result = \sqlsrv_query($conn, $sql); } if ($result === false) { @@ -412,14 +412,14 @@ function sqlsrv_query($conn, string $sql, array $params = null, array $options = /** - * Rolls back a transaction that was begun with sqlsrv_begin_transaction + * Rolls back a transaction that was begun with sqlsrv_begin_transaction * and returns the connection to auto-commit mode. - * + * * @param resource $conn The connection resource returned by a call to sqlsrv_connect. * @throws SqlsrvException - * + * */ -function sqlsrv_rollback($conn): void +function sqlsrv_rollback( $conn): void { error_clear_last(); $result = \sqlsrv_rollback($conn); @@ -427,3 +427,5 @@ function sqlsrv_rollback($conn): void throw SqlsrvException::createFromPhpError(); } } + + diff --git a/generated/ssdeep.php b/generated/ssdeep.php index 662fc9b9..1976d786 100644 --- a/generated/ssdeep.php +++ b/generated/ssdeep.php @@ -6,15 +6,15 @@ /** * Calculates the match score between signature1 - * and signature2 using + * and signature2 using * context-triggered piecewise hashing, and returns the match * score. - * + * * @param string $signature1 The first fuzzy hash signature string. * @param string $signature2 The second fuzzy hash signature string. * @return int Returns an integer from 0 to 100 on success, FALSE otherwise. * @throws SsdeepException - * + * */ function ssdeep_fuzzy_compare(string $signature1, string $signature2): int { @@ -28,15 +28,15 @@ function ssdeep_fuzzy_compare(string $signature1, string $signature2): int /** - * ssdeep_fuzzy_hash_filename calculates the hash - * of the file specified by file_name using - * context-triggered piecewise + * ssdeep_fuzzy_hash_filename calculates the hash + * of the file specified by file_name using + * context-triggered piecewise * hashing, and returns that hash. - * + * * @param string $file_name The filename of the file to hash. * @return string Returns a string on success, FALSE otherwise. * @throws SsdeepException - * + * */ function ssdeep_fuzzy_hash_filename(string $file_name): string { @@ -50,14 +50,14 @@ function ssdeep_fuzzy_hash_filename(string $file_name): string /** - * ssdeep_fuzzy_hash calculates the hash of - * to_hash using + * ssdeep_fuzzy_hash calculates the hash of + * to_hash using * context-triggered piecewise hashing, and returns that hash. - * + * * @param string $to_hash The input string. * @return string Returns a string on success, FALSE otherwise. * @throws SsdeepException - * + * */ function ssdeep_fuzzy_hash(string $to_hash): string { @@ -68,3 +68,5 @@ function ssdeep_fuzzy_hash(string $to_hash): string } return $result; } + + diff --git a/generated/ssh2.php b/generated/ssh2.php index 96af9df3..c6209856 100644 --- a/generated/ssh2.php +++ b/generated/ssh2.php @@ -6,14 +6,14 @@ /** * Authenticate over SSH using the ssh agent - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @param string $username Remote user name. * @throws Ssh2Exception - * + * */ -function ssh2_auth_agent($session, string $username): void +function ssh2_auth_agent( $session, string $username): void { error_clear_last(); $result = \ssh2_auth_agent($session, $username); @@ -25,28 +25,28 @@ function ssh2_auth_agent($session, string $username): void /** * Authenticate using a public hostkey read from a file. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. - * @param string $username - * @param string $hostname - * @param string $pubkeyfile - * @param string $privkeyfile + * @param string $username + * @param string $hostname + * @param string $pubkeyfile + * @param string $privkeyfile * @param string $passphrase If privkeyfile is encrypted (which it should * be), the passphrase must be provided. * @param string $local_username If local_username is omitted, then the value * for username will be used for it. * @throws Ssh2Exception - * + * */ -function ssh2_auth_hostbased_file($session, string $username, string $hostname, string $pubkeyfile, string $privkeyfile, string $passphrase = null, string $local_username = null): void +function ssh2_auth_hostbased_file( $session, string $username, string $hostname, string $pubkeyfile, string $privkeyfile, string $passphrase = null, string $local_username = null): void { error_clear_last(); if ($local_username !== null) { $result = \ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile, $passphrase, $local_username); } elseif ($passphrase !== null) { $result = \ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile, $passphrase); - } else { + }else { $result = \ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile); } if ($result === false) { @@ -58,15 +58,15 @@ function ssh2_auth_hostbased_file($session, string $username, string $hostname, /** * Authenticate over SSH using a plain password. Since version 0.12 this function * also supports keyboard_interactive method. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @param string $username Remote user name. * @param string $password Password for username * @throws Ssh2Exception - * + * */ -function ssh2_auth_password($session, string $username, string $password): void +function ssh2_auth_password( $session, string $username, string $password): void { error_clear_last(); $result = \ssh2_auth_password($session, $username, $password); @@ -78,25 +78,25 @@ function ssh2_auth_password($session, string $username, string $password): void /** * Authenticate using a public key read from a file. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. - * @param string $username + * @param string $username * @param string $pubkeyfile The public key file needs to be in OpenSSH's format. It should look something like: - * + * * ssh-rsa AAAAB3NzaC1yc2EAAA....NX6sqSnHA8= rsa-key-20121110 - * @param string $privkeyfile + * @param string $privkeyfile * @param string $passphrase If privkeyfile is encrypted (which it should * be), the passphrase must be provided. * @throws Ssh2Exception - * + * */ -function ssh2_auth_pubkey_file($session, string $username, string $pubkeyfile, string $privkeyfile, string $passphrase = null): void +function ssh2_auth_pubkey_file( $session, string $username, string $pubkeyfile, string $privkeyfile, string $passphrase = null): void { error_clear_last(); if ($passphrase !== null) { $result = \ssh2_auth_pubkey_file($session, $username, $pubkeyfile, $privkeyfile, $passphrase); - } else { + }else { $result = \ssh2_auth_pubkey_file($session, $username, $pubkeyfile, $privkeyfile); } if ($result === false) { @@ -107,97 +107,97 @@ function ssh2_auth_pubkey_file($session, string $username, string $pubkeyfile, s /** * Establish a connection to a remote SSH server. - * + * * Once connected, the client should verify the server's hostkey using * ssh2_fingerprint, then authenticate using either * password or public key. - * - * @param string $host - * @param int $port + * + * @param string $host + * @param int $port * @param array $methods methods may be an associative array with up to four parameters * as described below. - * - * + * + * * methods may be an associative array * with any or all of the following parameters. - * - * - * + * + * + * * Index * Meaning * Supported Values* - * - * - * - * + * + * + * + * * kex - * + * * List of key exchange methods to advertise, comma separated * in order of preference. - * - * + * + * * diffie-hellman-group1-sha1, * diffie-hellman-group14-sha1, and * diffie-hellman-group-exchange-sha1 - * - * - * + * + * + * * hostkey - * + * * List of hostkey methods to advertise, comma separated * in order of preference. - * - * + * + * * ssh-rsa and * ssh-dss - * - * - * + * + * + * * client_to_server - * + * * Associative array containing crypt, compression, and * message authentication code (MAC) method preferences * for messages sent from client to server. - * - * - * - * + * + * + * + * * server_to_client - * + * * Associative array containing crypt, compression, and * message authentication code (MAC) method preferences * for messages sent from server to client. - * - * - * - * - * - * - * + * + * + * + * + * + * + * * * - Supported Values are dependent on methods supported by underlying library. * See libssh2 documentation for additional * information. - * - * - * + * + * + * * client_to_server and * server_to_client may be an associative array * with any or all of the following parameters. - * - * - * - * + * + * + * + * * Index * Meaning * Supported Values* - * - * - * - * + * + * + * + * * crypt * List of crypto methods to advertise, comma separated * in order of preference. - * + * * rijndael-cbc@lysator.liu.se, * aes256-cbc, * aes192-cbc, @@ -207,102 +207,102 @@ function ssh2_auth_pubkey_file($session, string $username, string $pubkeyfile, s * cast128-cbc, * arcfour, and * none** - * - * - * + * + * + * * comp * List of compression methods to advertise, comma separated * in order of preference. - * + * * zlib and * none - * - * - * + * + * + * * mac * List of MAC methods to advertise, comma separated * in order of preference. - * + * * hmac-sha1, * hmac-sha1-96, * hmac-ripemd160, * hmac-ripemd160@openssh.com, and * none** - * - * - * - * - * - * - * + * + * + * + * + * + * + * * Crypt and MAC method "none" - * + * * For security reasons, none is disabled by the underlying * libssh2 library unless explicitly enabled * during build time by using the appropriate ./configure options. See documentation * for the underlying library for more information. - * - * - * + * + * + * * For security reasons, none is disabled by the underlying * libssh2 library unless explicitly enabled * during build time by using the appropriate ./configure options. See documentation * for the underlying library for more information. * @param array $callbacks callbacks may be an associative array with any * or all of the following parameters. - * - * + * + * * Callbacks parameters - * - * - * - * + * + * + * + * * Index * Meaning * Prototype - * - * - * - * + * + * + * + * * ignore - * + * * Name of function to call when an * SSH2_MSG_IGNORE packet is received - * + * * void ignore_cb($message) - * - * + * + * * debug - * + * * Name of function to call when an * SSH2_MSG_DEBUG packet is received - * + * * void debug_cb($message, $language, $always_display) - * - * + * + * * macerror - * + * * Name of function to call when a packet is received but the * message authentication code failed. If the callback returns * TRUE, the mismatch will be ignored, otherwise the connection * will be terminated. - * + * * bool macerror_cb($packet) - * - * + * + * * disconnect - * + * * Name of function to call when an * SSH2_MSG_DISCONNECT packet is received - * + * * void disconnect_cb($reason, $message, $language) - * - * - * - * + * + * + * + * * @return resource Returns a resource on success. * @throws Ssh2Exception - * + * */ function ssh2_connect(string $host, int $port = 22, array $methods = null, array $callbacks = null) { @@ -311,7 +311,7 @@ function ssh2_connect(string $host, int $port = 22, array $methods = null, array $result = \ssh2_connect($host, $port, $methods, $callbacks); } elseif ($methods !== null) { $result = \ssh2_connect($host, $port, $methods); - } else { + }else { $result = \ssh2_connect($host, $port); } if ($result === false) { @@ -323,13 +323,13 @@ function ssh2_connect(string $host, int $port = 22, array $methods = null, array /** * Close a connection to a remote SSH server. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @throws Ssh2Exception - * + * */ -function ssh2_disconnect($session): void +function ssh2_disconnect( $session): void { error_clear_last(); $result = \ssh2_disconnect($session); @@ -341,11 +341,11 @@ function ssh2_disconnect($session): void /** * Execute a command at the remote end and allocate a channel for it. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. - * @param string $command - * @param string $pty + * @param string $command + * @param string $pty * @param array $env env may be passed as an associative array of * name/value pairs to set in the target environment. * @param int $width Width of the virtual terminal. @@ -355,9 +355,9 @@ function ssh2_disconnect($session): void * SSH2_TERM_UNIT_PIXELS. * @return resource Returns a stream on success. * @throws Ssh2Exception - * + * */ -function ssh2_exec($session, string $command, string $pty = null, array $env = null, int $width = 80, int $height = 25, int $width_height_type = SSH2_TERM_UNIT_CHARS) +function ssh2_exec( $session, string $command, string $pty = null, array $env = null, int $width = 80, int $height = 25, int $width_height_type = SSH2_TERM_UNIT_CHARS) { error_clear_last(); if ($width_height_type !== SSH2_TERM_UNIT_CHARS) { @@ -370,7 +370,7 @@ function ssh2_exec($session, string $command, string $pty = null, array $env = n $result = \ssh2_exec($session, $command, $pty, $env); } elseif ($pty !== null) { $result = \ssh2_exec($session, $command, $pty); - } else { + }else { $result = \ssh2_exec($session, $command); } if ($result === false) { @@ -381,8 +381,55 @@ function ssh2_exec($session, string $command, string $pty = null, array $env = n /** - * - * + * Accepts a connection created by a listener. + * + * @param resource $listener An SSH2 Listener resource, obtained from a call to ssh2_forward_listen. + * @return Returns a stream resource. + * @throws Ssh2Exception + * + */ +function ssh2_forward_accept( $listener) +{ + error_clear_last(); + $result = \ssh2_forward_accept($listener); + if ($result === false) { + throw Ssh2Exception::createFromPhpError(); + } + return $result; +} + + +/** + * Binds a port on the remote server and listen for connections. + * + * @param resource $session An SSH Session resource, obtained from a call to ssh2_connect. + * @param int $port The port of the remote server. + * @param string $host + * @param int $max_connections + * @return Returns an SSH2 Listener. + * @throws Ssh2Exception + * + */ +function ssh2_forward_listen( $session, int $port, string $host = null, int $max_connections = 16) +{ + error_clear_last(); + if ($max_connections !== 16) { + $result = \ssh2_forward_listen($session, $port, $host, $max_connections); + } elseif ($host !== null) { + $result = \ssh2_forward_listen($session, $port, $host); + }else { + $result = \ssh2_forward_listen($session, $port); + } + if ($result === false) { + throw Ssh2Exception::createFromPhpError(); + } + return $result; +} + + +/** + * + * * @param resource $pkey Publickey Subsystem resource created by ssh2_publickey_init. * @param string $algoname Publickey algorithm (e.g.): ssh-dss, ssh-rsa * @param string $blob Publickey blob as raw binary data @@ -393,14 +440,14 @@ function ssh2_exec($session, string $command, string $pty = null, array $env = n * If the server is unable to support an attribute marked mandatory, * it will abort the add process. * @throws Ssh2Exception - * + * */ -function ssh2_publickey_add($pkey, string $algoname, string $blob, bool $overwrite = false, array $attributes = null): void +function ssh2_publickey_add( $pkey, string $algoname, string $blob, bool $overwrite = false, array $attributes = null): void { error_clear_last(); if ($attributes !== null) { $result = \ssh2_publickey_add($pkey, $algoname, $blob, $overwrite, $attributes); - } else { + }else { $result = \ssh2_publickey_add($pkey, $algoname, $blob, $overwrite); } if ($result === false) { @@ -411,20 +458,20 @@ function ssh2_publickey_add($pkey, string $algoname, string $blob, bool $overwri /** * Request the Publickey subsystem from an already connected SSH2 server. - * + * * The publickey subsystem allows an already connected and authenticated * client to manage the list of authorized public keys stored on the * target server in an implementation agnostic manner. * If the remote server does not support the publickey subsystem, * the ssh2_publickey_init function will return FALSE. - * - * @param resource $session + * + * @param resource $session * @return resource Returns an SSH2 Publickey Subsystem resource for use * with all other ssh2_publickey_*() methods. * @throws Ssh2Exception - * + * */ -function ssh2_publickey_init($session) +function ssh2_publickey_init( $session) { error_clear_last(); $result = \ssh2_publickey_init($session); @@ -437,14 +484,14 @@ function ssh2_publickey_init($session) /** * Removes an authorized publickey. - * + * * @param resource $pkey Publickey Subsystem Resource * @param string $algoname Publickey algorithm (e.g.): ssh-dss, ssh-rsa * @param string $blob Publickey blob as raw binary data * @throws Ssh2Exception - * + * */ -function ssh2_publickey_remove($pkey, string $algoname, string $blob): void +function ssh2_publickey_remove( $pkey, string $algoname, string $blob): void { error_clear_last(); $result = \ssh2_publickey_remove($pkey, $algoname, $blob); @@ -456,15 +503,15 @@ function ssh2_publickey_remove($pkey, string $algoname, string $blob): void /** * Copy a file from the remote server to the local filesystem using the SCP protocol. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @param string $remote_file Path to the remote file. * @param string $local_file Path to the local file. * @throws Ssh2Exception - * + * */ -function ssh2_scp_recv($session, string $remote_file, string $local_file): void +function ssh2_scp_recv( $session, string $remote_file, string $local_file): void { error_clear_last(); $result = \ssh2_scp_recv($session, $remote_file, $local_file); @@ -476,7 +523,7 @@ function ssh2_scp_recv($session, string $remote_file, string $local_file): void /** * Copy a file from the local filesystem to the remote server using the SCP protocol. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @param string $local_file Path to the local file. @@ -484,9 +531,9 @@ function ssh2_scp_recv($session, string $remote_file, string $local_file): void * @param int $create_mode The file will be created with the mode specified by * create_mode. * @throws Ssh2Exception - * + * */ -function ssh2_scp_send($session, string $local_file, string $remote_file, int $create_mode = 0644): void +function ssh2_scp_send( $session, string $local_file, string $remote_file, int $create_mode = 0644): void { error_clear_last(); $result = \ssh2_scp_send($session, $local_file, $remote_file, $create_mode); @@ -496,17 +543,38 @@ function ssh2_scp_send($session, string $local_file, string $remote_file, int $c } +/** + * Sends an EOF to the stream; this is typically used to close standard input, + * while keeping output and error alive. For example, one can send a remote + * process some data over standard input, close it to start processing, and + * still be able to read out the results without creating additional files. + * + * @param resource $channel An SSH stream; can be acquired through functions like ssh2_fetch_stream + * or ssh2_connect. + * @throws Ssh2Exception + * + */ +function ssh2_send_eof( $channel): void +{ + error_clear_last(); + $result = \ssh2_send_eof($channel); + if ($result === false) { + throw Ssh2Exception::createFromPhpError(); + } +} + + /** * Attempts to change the mode of the specified file to that given in * mode. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. * @param string $filename Path to the file. * @param int $mode Permissions on the file. See the chmod for more details on this parameter. * @throws Ssh2Exception - * + * */ -function ssh2_sftp_chmod($sftp, string $filename, int $mode): void +function ssh2_sftp_chmod( $sftp, string $filename, int $mode): void { error_clear_last(); $result = \ssh2_sftp_chmod($sftp, $filename, $mode); @@ -519,19 +587,20 @@ function ssh2_sftp_chmod($sftp, string $filename, int $mode): void /** * Creates a directory on the remote file server with permissions set to * mode. - * + * * This function is similar to using mkdir with the * ssh2.sftp:// wrapper. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. * @param string $dirname Path of the new directory. * @param int $mode Permissions on the new directory. + * The actual mode is affected by the current umask. * @param bool $recursive If recursive is TRUE any parent directories * required for dirname will be automatically created as well. * @throws Ssh2Exception - * + * */ -function ssh2_sftp_mkdir($sftp, string $dirname, int $mode = 0777, bool $recursive = false): void +function ssh2_sftp_mkdir( $sftp, string $dirname, int $mode = 0777, bool $recursive = false): void { error_clear_last(); $result = \ssh2_sftp_mkdir($sftp, $dirname, $mode, $recursive); @@ -543,14 +612,14 @@ function ssh2_sftp_mkdir($sftp, string $dirname, int $mode = 0777, bool $recursi /** * Renames a file on the remote filesystem. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. * @param string $from The current file that is being renamed. * @param string $to The new file name that replaces from. * @throws Ssh2Exception - * + * */ -function ssh2_sftp_rename($sftp, string $from, string $to): void +function ssh2_sftp_rename( $sftp, string $from, string $to): void { error_clear_last(); $result = \ssh2_sftp_rename($sftp, $from, $to); @@ -562,16 +631,16 @@ function ssh2_sftp_rename($sftp, string $from, string $to): void /** * Removes a directory from the remote file server. - * + * * This function is similar to using rmdir with the * ssh2.sftp:// wrapper. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. - * @param string $dirname + * @param string $dirname * @throws Ssh2Exception - * + * */ -function ssh2_sftp_rmdir($sftp, string $dirname): void +function ssh2_sftp_rmdir( $sftp, string $dirname): void { error_clear_last(); $result = \ssh2_sftp_rmdir($sftp, $dirname); @@ -584,14 +653,14 @@ function ssh2_sftp_rmdir($sftp, string $dirname): void /** * Creates a symbolic link named link on the remote * filesystem pointing to target. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. * @param string $target Target of the symbolic link. - * @param string $link + * @param string $link * @throws Ssh2Exception - * + * */ -function ssh2_sftp_symlink($sftp, string $target, string $link): void +function ssh2_sftp_symlink( $sftp, string $target, string $link): void { error_clear_last(); $result = \ssh2_sftp_symlink($sftp, $target, $link); @@ -603,13 +672,13 @@ function ssh2_sftp_symlink($sftp, string $target, string $link): void /** * Deletes a file on the remote filesystem. - * + * * @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp. - * @param string $filename + * @param string $filename * @throws Ssh2Exception - * + * */ -function ssh2_sftp_unlink($sftp, string $filename): void +function ssh2_sftp_unlink( $sftp, string $filename): void { error_clear_last(); $result = \ssh2_sftp_unlink($sftp, $filename); @@ -621,16 +690,16 @@ function ssh2_sftp_unlink($sftp, string $filename): void /** * Request the SFTP subsystem from an already connected SSH2 server. - * + * * @param resource $session An SSH connection link identifier, obtained from a call to * ssh2_connect. * @return resource This method returns an SSH2 SFTP resource for use with * all other ssh2_sftp_*() methods and the * ssh2.sftp:// fopen wrapper. * @throws Ssh2Exception - * + * */ -function ssh2_sftp($session) +function ssh2_sftp( $session) { error_clear_last(); $result = \ssh2_sftp($session); @@ -639,3 +708,34 @@ function ssh2_sftp($session) } return $result; } + + +/** + * Open a shell at the remote end and allocate a stream for it. + * + * @param resource $session An SSH connection link identifier, obtained from a call to + * ssh2_connect. + * @param string $term_type term_type should correspond to one of the + * entries in the target system's /etc/termcap file. + * @param array $env env may be passed as an associative array of + * name/value pairs to set in the target environment. + * @param int $width Width of the virtual terminal. + * @param int $height Height of the virtual terminal. + * @param int $width_height_type width_height_type should be one of + * SSH2_TERM_UNIT_CHARS or + * SSH2_TERM_UNIT_PIXELS. + * @return resource Returns a stream resource on success. + * @throws Ssh2Exception + * + */ +function ssh2_shell( $session, string $term_type = "vanilla", array $env = null, int $width = 80, int $height = 25, int $width_height_type = SSH2_TERM_UNIT_CHARS) +{ + error_clear_last(); + $result = \ssh2_shell($session, $term_type, $env, $width, $height, $width_height_type); + if ($result === false) { + throw Ssh2Exception::createFromPhpError(); + } + return $result; +} + + diff --git a/generated/stream.php b/generated/stream.php index 573d0295..07a232a9 100644 --- a/generated/stream.php +++ b/generated/stream.php @@ -6,19 +6,17 @@ /** * Sets parameters on the specified context. - * - * @param resource $stream_or_context The stream or context to apply the parameters too. - * @param array $params An array of parameters to set. - * - * params should be an associative array of the structure: + * + * @param resource $context The stream or context to apply the parameters too. + * @param array $params An associative array of parameters to be set in the following format: * $params['paramname'] = "paramvalue";. * @throws StreamException - * + * */ -function stream_context_set_params($stream_or_context, array $params): void +function stream_context_set_params( $context, array $params): void { error_clear_last(); - $result = \stream_context_set_params($stream_or_context, $params); + $result = \stream_context_set_params($context, $params); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -26,25 +24,25 @@ function stream_context_set_params($stream_or_context, array $params): void /** - * Makes a copy of up to maxlength bytes + * Makes a copy of up to length bytes * of data from the current position (or from the * offset position, if specified) in - * source to dest. If - * maxlength is not specified, all remaining content in - * source will be copied. - * - * @param resource $source The source stream - * @param resource $dest The destination stream - * @param int $maxlength Maximum bytes to copy + * from to to. If + * length is NULL, all remaining content in + * from will be copied. + * + * @param resource $from The source stream + * @param resource $to The destination stream + * @param $length Maximum bytes to copy. By default all bytes left are copied. * @param int $offset The offset where to start to copy data * @return int Returns the total count of bytes copied. * @throws StreamException - * + * */ -function stream_copy_to_stream($source, $dest, int $maxlength = -1, int $offset = 0): int +function stream_copy_to_stream( $from, $to, $length = null, int $offset = 0): int { error_clear_last(); - $result = \stream_copy_to_stream($source, $dest, $maxlength, $offset); + $result = \stream_copy_to_stream($from, $to, $length, $offset); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -55,7 +53,7 @@ function stream_copy_to_stream($source, $dest, int $maxlength = -1, int $offset /** * Adds filtername to the list of filters * attached to stream. - * + * * @param resource $stream The target stream. * @param string $filtername The filter name. * @param int $read_write By default, stream_filter_append will @@ -69,7 +67,7 @@ function stream_copy_to_stream($source, $dest, int $maxlength = -1, int $offset * STREAM_FILTER_WRITE, and/or * STREAM_FILTER_ALL can also be passed to the * read_write parameter to override this behavior. - * @param mixed $params This filter will be added with the specified + * @param mixed $params This filter will be added with the specified * params to the end of * the list and will therefore be called last during stream operations. * To add a filter to the beginning of the list, use @@ -77,20 +75,20 @@ function stream_copy_to_stream($source, $dest, int $maxlength = -1, int $offset * @return resource Returns a resource on success. The resource can be * used to refer to this filter instance during a call to * stream_filter_remove. - * + * * FALSE is returned if stream is not a resource or * if filtername cannot be located. * @throws StreamException - * + * */ -function stream_filter_append($stream, string $filtername, int $read_write = null, $params = null) +function stream_filter_append( $stream, string $filtername, int $read_write = null, $params = null) { error_clear_last(); if ($params !== null) { $result = \stream_filter_append($stream, $filtername, $read_write, $params); } elseif ($read_write !== null) { $result = \stream_filter_append($stream, $filtername, $read_write); - } else { + }else { $result = \stream_filter_append($stream, $filtername); } if ($result === false) { @@ -103,7 +101,7 @@ function stream_filter_append($stream, string $filtername, int $read_write = nul /** * Adds filtername to the list of filters * attached to stream. - * + * * @param resource $stream The target stream. * @param string $filtername The filter name. * @param int $read_write By default, stream_filter_prepend will @@ -126,20 +124,20 @@ function stream_filter_append($stream, string $filtername, int $read_write = nul * @return resource Returns a resource on success. The resource can be * used to refer to this filter instance during a call to * stream_filter_remove. - * + * * FALSE is returned if stream is not a resource or * if filtername cannot be located. * @throws StreamException - * + * */ -function stream_filter_prepend($stream, string $filtername, int $read_write = null, $params = null) +function stream_filter_prepend( $stream, string $filtername, int $read_write = null, $params = null) { error_clear_last(); if ($params !== null) { $result = \stream_filter_prepend($stream, $filtername, $read_write, $params); } elseif ($read_write !== null) { $result = \stream_filter_prepend($stream, $filtername, $read_write); - } else { + }else { $result = \stream_filter_prepend($stream, $filtername); } if ($result === false) { @@ -154,9 +152,9 @@ function stream_filter_prepend($stream, string $filtername, int $read_write = nu * your own filter on any registered stream used with all the other * filesystem functions (such as fopen, * fread etc.). - * - * @param string $filtername The filter name to be registered. - * @param string $classname To implement a filter, you need to define a class as an extension of + * + * @param string $filter_name The filter name to be registered. + * @param string $class To implement a filter, you need to define a class as an extension of * php_user_filter with a number of member * functions. When performing read/write operations on the stream * to which your filter is attached, PHP will pass the data through your @@ -165,12 +163,12 @@ function stream_filter_prepend($stream, string $filtername, int $read_write = nu * exactly as described in php_user_filter - doing * otherwise will lead to undefined behaviour. * @throws StreamException - * + * */ -function stream_filter_register(string $filtername, string $classname): void +function stream_filter_register(string $filter_name, string $class): void { error_clear_last(); - $result = \stream_filter_register($filtername, $classname); + $result = \stream_filter_register($filter_name, $class); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -183,12 +181,12 @@ function stream_filter_register(string $filtername, string $classname): void * stream_filter_append. Any data remaining in the * filter's internal buffer will be flushed through to the next filter before * removing it. - * + * * @param resource $stream_filter The stream filter to be removed. * @throws StreamException - * + * */ -function stream_filter_remove($stream_filter): void +function stream_filter_remove( $stream_filter): void { error_clear_last(); $result = \stream_filter_remove($stream_filter); @@ -202,22 +200,56 @@ function stream_filter_remove($stream_filter): void * Identical to file_get_contents, except that * stream_get_contents operates on an already open * stream resource and returns the remaining contents in a string, up to - * maxlength bytes and starting at the specified + * length bytes and starting at the specified * offset. - * - * @param resource $handle A stream resource (e.g. returned from fopen) - * @param int $maxlength The maximum bytes to read. Defaults to -1 (read all the remaining + * + * @param resource $stream A stream resource (e.g. returned from fopen) + * @param $length The maximum bytes to read. Defaults to NULL (read all the remaining * buffer). * @param int $offset Seek to the specified offset before reading. If this number is negative, * no seeking will occur and reading will start from the current position. * @return string Returns a string. * @throws StreamException - * + * */ -function stream_get_contents($handle, int $maxlength = -1, int $offset = -1): string +function stream_get_contents( $stream, $length = null, int $offset = -1): string { error_clear_last(); - $result = \stream_get_contents($handle, $maxlength, $offset); + $result = \stream_get_contents($stream, $length, $offset); + if ($result === false) { + throw StreamException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets a line from the given handle. + * + * Reading ends when length bytes have been read, when + * the non-empty string specified by ending is found (which is + * not included in the return value), or on EOF + * (whichever comes first). + * + * This function is nearly identical to fgets except in + * that it allows end of line delimiters other than the standard \n, \r, and + * \r\n, and does not return the delimiter itself. + * + * @param resource $stream A valid file handle. + * @param int $length The maximum number of bytes to read from the handle. + * Negative values are not supported. + * Zero (0) means the default socket chunk size, + * i.e. 8192 bytes. + * @param string $ending An optional string delimiter. + * @return string Returns a string of up to length bytes read from the file + * pointed to by stream. + * @throws StreamException + * + */ +function stream_get_line( $stream, int $length, string $ending = ""): string +{ + error_clear_last(); + $result = \stream_get_line($stream, $length, $ending); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -228,12 +260,12 @@ function stream_get_contents($handle, int $maxlength = -1, int $offset = -1): st /** * Determines if stream stream refers to a valid terminal type device. * This is a more portable version of posix_isatty, since it works on Windows systems too. - * - * @param resource $stream + * + * @param resource $stream * @throws StreamException - * + * */ -function stream_isatty($stream): void +function stream_isatty( $stream): void { error_clear_last(); $result = \stream_isatty($stream); @@ -245,11 +277,11 @@ function stream_isatty($stream): void /** * Resolve filename against the include path according to the same rules as fopen/include. - * + * * @param string $filename The filename to resolve. * @return string Returns a string containing the resolved absolute filename. * @throws StreamException - * + * */ function stream_resolve_include_path(string $filename): string { @@ -264,12 +296,12 @@ function stream_resolve_include_path(string $filename): string /** * Sets blocking or non-blocking mode on a stream. - * + * * This function works for any stream that supports non-blocking mode * (currently, regular files and socket streams). - * + * * @param resource $stream The stream. - * @param bool $mode If mode is FALSE, the given stream + * @param bool $enable If enable is FALSE, the given stream * will be switched to non-blocking mode, and if TRUE, it * will be switched to blocking mode. This affects calls like * fgets and fread @@ -278,12 +310,12 @@ function stream_resolve_include_path(string $filename): string * while in blocking mode it will wait for data to become available * on the stream. * @throws StreamException - * + * */ -function stream_set_blocking($stream, bool $mode): void +function stream_set_blocking( $stream, bool $enable): void { error_clear_last(); - $result = \stream_set_blocking($stream, $mode); + $result = \stream_set_blocking($stream, $enable); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -294,18 +326,18 @@ function stream_set_blocking($stream, bool $mode): void * Sets the timeout value on stream, * expressed in the sum of seconds and * microseconds. - * + * * When the stream times out, the 'timed_out' key of the array returned by * stream_get_meta_data is set to TRUE, although no * error/warning is generated. - * + * * @param resource $stream The target stream. * @param int $seconds The seconds part of the timeout to be set. * @param int $microseconds The microseconds part of the timeout to be set. * @throws StreamException - * + * */ -function stream_set_timeout($stream, int $seconds, int $microseconds = 0): void +function stream_set_timeout( $stream, int $seconds, int $microseconds = 0): void { error_clear_last(); $result = \stream_set_timeout($stream, $seconds, $microseconds); @@ -318,29 +350,24 @@ function stream_set_timeout($stream, int $seconds, int $microseconds = 0): void /** * Accept a connection on a socket previously created by * stream_socket_server. - * - * @param resource $server_socket The server socket to accept a connection from. + * + * @param resource $socket The server socket to accept a connection from. * @param float $timeout Override the default socket accept timeout. Time should be given in - * seconds. - * @param string|null $peername Will be set to the name (address) of the client which connected, if + * seconds. By default, default_socket_timeout + * is used. + * @param string $peer_name Will be set to the name (address) of the client which connected, if * included and available from the selected transport. - * + * * Can also be determined later using * stream_socket_get_name. * @return resource Returns a stream to the accepted socket connection. * @throws StreamException - * + * */ -function stream_socket_accept($server_socket, float $timeout = null, ?string &$peername = null) +function stream_socket_accept( $socket, float $timeout = null, string &$peer_name = null) { error_clear_last(); - if ($peername !== null) { - $result = \stream_socket_accept($server_socket, $timeout, $peername); - } elseif ($timeout !== null) { - $result = \stream_socket_accept($server_socket, $timeout); - } else { - $result = \stream_socket_accept($server_socket); - } + $result = \stream_socket_accept($socket, $timeout, $peer_name); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -350,35 +377,36 @@ function stream_socket_accept($server_socket, float $timeout = null, ?string &$p /** * Initiates a stream or datagram connection to the destination specified - * by remote_socket. The type of socket created + * by address. The type of socket created * is determined by the transport specified using standard URL formatting: * transport://target. For Internet Domain sockets * (AF_INET) such as TCP and UDP, the target portion - * of the remote_socket parameter should consist of + * of the address parameter should consist of * a hostname or IP address followed by a colon and a port number. For Unix * domain sockets, the target portion should point * to the socket file on the filesystem. - * - * @param string $remote_socket Address to the socket to connect to. - * @param int $errno Will be set to the system level error number if connection fails. - * @param string $errstr Will be set to the system level error message if the connection fails. + * + * @param string $address Address to the socket to connect to. + * @param int $error_code Will be set to the system level error number if connection fails. + * @param string $error_message Will be set to the system level error message if the connection fails. * @param float $timeout Number of seconds until the connect() system call - * should timeout. - * - * + * should timeout. By default, default_socket_timeout + * is used. + * + * * This parameter only applies when not making asynchronous * connection attempts. - * - * - * - * + * + * + * + * * To set a timeout for reading/writing data over the socket, use the * stream_set_timeout, as the * timeout only applies while making connecting * the socket. - * - * - * + * + * + * * To set a timeout for reading/writing data over the socket, use the * stream_set_timeout, as the * timeout only applies while making connecting @@ -395,20 +423,33 @@ function stream_socket_accept($server_socket, float $timeout = null, ?string &$p * fwrite, fclose, and * feof), FALSE on failure. * @throws StreamException - * + * */ -function stream_socket_client(string $remote_socket, int &$errno = null, string &$errstr = null, float $timeout = null, int $flags = STREAM_CLIENT_CONNECT, $context = null) +function stream_socket_client(string $address, int &$error_code = null, string &$error_message = null, float $timeout = null, int $flags = STREAM_CLIENT_CONNECT, $context = null) { error_clear_last(); - if ($context !== null) { - $result = \stream_socket_client($remote_socket, $errno, $errstr, $timeout, $flags, $context); - } elseif ($flags !== STREAM_CLIENT_CONNECT) { - $result = \stream_socket_client($remote_socket, $errno, $errstr, $timeout, $flags); - } elseif ($timeout !== null) { - $result = \stream_socket_client($remote_socket, $errno, $errstr, $timeout); - } else { - $result = \stream_socket_client($remote_socket, $errno, $errstr); + $result = \stream_socket_client($address, $error_code, $error_message, $timeout, $flags, $context); + if ($result === false) { + throw StreamException::createFromPhpError(); } + return $result; +} + + +/** + * Returns the local or remote name of a given socket connection. + * + * @param resource $socket The socket to get the name of. + * @param bool $remote If set to TRUE the remote socket name will be returned, if set + * to FALSE the local socket name will be returned. + * @return string The name of the socket. + * @throws StreamException + * + */ +function stream_socket_get_name( $socket, bool $remote): string +{ + error_clear_last(); + $result = \stream_socket_get_name($socket, $remote); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -420,7 +461,7 @@ function stream_socket_client(string $remote_socket, int &$errno = null, string * stream_socket_pair creates a pair of connected, * indistinguishable socket streams. This function is commonly used in IPC * (Inter-Process Communication). - * + * * @param int $domain The protocol family to be used: STREAM_PF_INET, * STREAM_PF_INET6 or * STREAM_PF_UNIX @@ -437,7 +478,7 @@ function stream_socket_client(string $remote_socket, int &$errno = null, string * STREAM_IPPROTO_UDP * @return resource[] Returns an array with the two socket resources on success. * @throws StreamException - * + * */ function stream_socket_pair(int $domain, int $type, int $protocol): iterable { @@ -450,56 +491,139 @@ function stream_socket_pair(int $domain, int $type, int $protocol): iterable } +/** + * stream_socket_recvfrom accepts + * data from a remote socket up to length bytes. + * + * @param resource $socket The remote socket. + * @param int $length The number of bytes to receive from the socket. + * @param int $flags The value of flags can be any combination + * of the following: + * + * Possible values for flags + * + * + * + * STREAM_OOB + * + * Process OOB (out-of-band) data. + * + * + * + * STREAM_PEEK + * + * Retrieve data from the socket, but do not consume the buffer. + * Subsequent calls to fread or + * stream_socket_recvfrom will see + * the same data. + * + * + * + * + * + * @param $address If address is provided it will be populated with + * the address of the remote socket. + * @return string Returns the read data, as a string. + * @throws StreamException + * + */ +function stream_socket_recvfrom( $socket, int $length, int $flags = 0, &$address = null): string +{ + error_clear_last(); + $result = \stream_socket_recvfrom($socket, $length, $flags, $address); + if ($result === false) { + throw StreamException::createFromPhpError(); + } + return $result; +} + + +/** + * Sends the specified data through the + * socket. + * + * @param resource $socket The socket to send data to. + * @param string $data The data to be sent. + * @param int $flags The value of flags can be any combination + * of the following: + * + * possible values for flags + * + * + * + * STREAM_OOB + * + * Process OOB (out-of-band) data. + * + * + * + * + * + * @param string $address The address specified when the socket stream was created will be used + * unless an alternate address is specified in address. + * + * If specified, it must be in dotted quad (or [ipv6]) format. + * @return int Returns a result code, as an integer. + * @throws StreamException + * + */ +function stream_socket_sendto( $socket, string $data, int $flags = 0, string $address = ""): int +{ + error_clear_last(); + $result = \stream_socket_sendto($socket, $data, $flags, $address); + if ($result === false) { + throw StreamException::createFromPhpError(); + } + return $result; +} + + /** * Creates a stream or datagram socket on the specified - * local_socket. - * + * address. + * * This function only creates a socket, to begin accepting connections * use stream_socket_accept. - * - * @param string $local_socket The type of socket created is determined by the transport specified + * + * @param string $address The type of socket created is determined by the transport specified * using standard URL formatting: transport://target. - * + * * For Internet Domain sockets (AF_INET) such as TCP and UDP, the - * target portion of the + * target portion of the * remote_socket parameter should consist of a * hostname or IP address followed by a colon and a port number. For * Unix domain sockets, the target portion should * point to the socket file on the filesystem. - * + * * Depending on the environment, Unix domain sockets may not be available. * A list of available transports can be retrieved using * stream_get_transports. See * for a list of bulitin transports. - * @param int $errno If the optional errno and errstr + * @param int $error_code If the optional error_code and error_message * arguments are present they will be set to indicate the actual system * level error that occurred in the system-level socket(), * bind(), and listen() calls. If - * the value returned in errno is + * the value returned in error_code is * 0 and the function returned FALSE, it is an * indication that the error occurred before the bind() - * call. This is most likely due to a problem initializing the socket. - * Note that the errno and - * errstr arguments will always be passed by reference. - * @param string $errstr See errno description. + * call. This is most likely due to a problem initializing the socket. + * Note that the error_code and + * error_message arguments will always be passed by reference. + * @param string $error_message See error_code description. * @param int $flags A bitmask field which may be set to any combination of socket creation * flags. - * + * * For UDP sockets, you must use STREAM_SERVER_BIND as * the flags parameter. - * @param resource $context + * @param resource $context * @return resource Returns the created stream. * @throws StreamException - * + * */ -function stream_socket_server(string $local_socket, int &$errno = null, string &$errstr = null, int $flags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context = null) +function stream_socket_server(string $address, int &$error_code = null, string &$error_message = null, int $flags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context = null) { error_clear_last(); - if ($context !== null) { - $result = \stream_socket_server($local_socket, $errno, $errstr, $flags, $context); - } else { - $result = \stream_socket_server($local_socket, $errno, $errstr, $flags); - } + $result = \stream_socket_server($address, $error_code, $error_message, $flags, $context); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -509,21 +633,21 @@ function stream_socket_server(string $local_socket, int &$errno = null, string & /** * Shutdowns (partially or not) a full-duplex connection. - * + * * @param resource $stream An open stream (opened with stream_socket_client, * for example) - * @param int $how One of the following constants: STREAM_SHUT_RD + * @param int $mode One of the following constants: STREAM_SHUT_RD * (disable further receptions), STREAM_SHUT_WR * (disable further transmissions) or * STREAM_SHUT_RDWR (disable further receptions and * transmissions). * @throws StreamException - * + * */ -function stream_socket_shutdown($stream, int $how): void +function stream_socket_shutdown( $stream, int $mode): void { error_clear_last(); - $result = \stream_socket_shutdown($stream, $how); + $result = \stream_socket_shutdown($stream, $mode); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -531,14 +655,14 @@ function stream_socket_shutdown($stream, int $how): void /** - * Tells whether the stream supports locking through + * Tells whether the stream supports locking through * flock. - * + * * @param resource $stream The stream to check. * @throws StreamException - * + * */ -function stream_supports_lock($stream): void +function stream_supports_lock( $stream): void { error_clear_last(); $result = \stream_supports_lock($stream); @@ -552,19 +676,20 @@ function stream_supports_lock($stream): void * Allows you to implement your own protocol handlers and streams for use * with all the other filesystem functions (such as fopen, * fread etc.). - * + * * @param string $protocol The wrapper name to be registered. - * @param string $classname The classname which implements the protocol. + * Valid protocol names must contain alphanumerics, dots (.), plusses (+), or hyphens (-) only. + * @param string $class The classname which implements the protocol. * @param int $flags Should be set to STREAM_IS_URL if * protocol is a URL protocol. Default is 0, local * stream. * @throws StreamException - * + * */ -function stream_wrapper_register(string $protocol, string $classname, int $flags = 0): void +function stream_wrapper_register(string $protocol, string $class, int $flags = 0): void { error_clear_last(); - $result = \stream_wrapper_register($protocol, $classname, $flags); + $result = \stream_wrapper_register($protocol, $class, $flags); if ($result === false) { throw StreamException::createFromPhpError(); } @@ -574,10 +699,10 @@ function stream_wrapper_register(string $protocol, string $classname, int $flags /** * Restores a built-in wrapper previously unregistered with * stream_wrapper_unregister. - * - * @param string $protocol + * + * @param string $protocol * @throws StreamException - * + * */ function stream_wrapper_restore(string $protocol): void { @@ -594,10 +719,10 @@ function stream_wrapper_restore(string $protocol): void * has been disabled you may override it with a user-defined wrapper using * stream_wrapper_register or reenable it later on with * stream_wrapper_restore. - * - * @param string $protocol + * + * @param string $protocol * @throws StreamException - * + * */ function stream_wrapper_unregister(string $protocol): void { @@ -607,3 +732,5 @@ function stream_wrapper_unregister(string $protocol): void throw StreamException::createFromPhpError(); } } + + diff --git a/generated/strings.php b/generated/strings.php index 9bc72841..f8deb797 100644 --- a/generated/strings.php +++ b/generated/strings.php @@ -6,16 +6,16 @@ /** * convert_uudecode decodes a uuencoded string. - * - * @param string $data The uuencoded data. + * + * @param string $string The uuencoded data. * @return string Returns the decoded data as a string. * @throws StringsException - * + * */ -function convert_uudecode(string $data): string +function convert_uudecode(string $string): string { error_clear_last(); - $result = \convert_uudecode($data); + $result = \convert_uudecode($string); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -24,22 +24,50 @@ function convert_uudecode(string $data): string /** - * convert_uuencode encodes a string using the uuencode - * algorithm. - * - * Uuencode translates all strings (including binary data) into printable - * characters, making them safe for network transmissions. Uuencoded data is - * about 35% larger than the original. - * - * @param string $data The data to be encoded. - * @return string Returns the uuencoded data. + * Counts the number of occurrences of every byte-value (0..255) in + * string and returns it in various ways. + * + * @param string $string The examined string. + * @param int $mode See return values. + * @return mixed Depending on mode + * count_chars returns one of the following: + * + * + * + * 0 - an array with the byte-value as key and the frequency of + * every byte as value. + * + * + * + * + * 1 - same as 0 but only byte-values with a frequency greater + * than zero are listed. + * + * + * + * + * 2 - same as 0 but only byte-values with a frequency equal to + * zero are listed. + * + * + * + * + * 3 - a string containing all unique characters is returned. + * + * + * + * + * 4 - a string containing all not used characters is returned. + * + * + * * @throws StringsException - * + * */ -function convert_uuencode(string $data): string +function count_chars(string $string, int $mode = 0) { error_clear_last(); - $result = \convert_uuencode($data); + $result = \count_chars($string, $mode); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -49,16 +77,16 @@ function convert_uuencode(string $data): string /** * Decodes a hexadecimally encoded binary string. - * - * @param string $data Hexadecimal representation of data. + * + * @param string $string Hexadecimal representation of data. * @return string Returns the binary representation of the given data. * @throws StringsException - * + * */ -function hex2bin(string $data): string +function hex2bin(string $string): string { error_clear_last(); - $result = \hex2bin($data); + $result = \hex2bin($string); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -69,21 +97,21 @@ function hex2bin(string $data): string /** * Calculates the MD5 hash of the file specified by the * filename parameter using the - * RSA Data Security, Inc. + * RSA Data Security, Inc. * MD5 Message-Digest Algorithm, and returns that hash. * The hash is a 32-character hexadecimal number. - * + * * @param string $filename The filename - * @param bool $raw_output When TRUE, returns the digest in raw binary format with a length of + * @param bool $binary When TRUE, returns the digest in raw binary format with a length of * 16. * @return string Returns a string on success, FALSE otherwise. * @throws StringsException - * + * */ -function md5_file(string $filename, bool $raw_output = false): string +function md5_file(string $filename, bool $binary = false): string { error_clear_last(); - $result = \md5_file($filename, $raw_output); + $result = \md5_file($filename, $binary); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -92,30 +120,32 @@ function md5_file(string $filename, bool $raw_output = false): string /** - * Calculates the metaphone key of str. - * + * Calculates the metaphone key of string. + * * Similar to soundex metaphone creates the same key for * similar sounding words. It's more accurate than * soundex as it knows the basic rules of English * pronunciation. The metaphone generated keys are of variable length. - * + * * Metaphone was developed by Lawrence Philips * <lphilips at verity dot com>. It is described in ["Practical * Algorithms for Programmers", Binstock & Rex, Addison Wesley, * 1995]. - * - * @param string $str The input string. - * @param int $phonemes This parameter restricts the returned metaphone key to - * phonemes characters in length. + * + * @param string $string The input string. + * @param int $max_phonemes This parameter restricts the returned metaphone key to + * max_phonemes characters in length. + * However, the resulting phonemes are always transcribed completely, so the + * resulting string length may be slightly longer than max_phonemes. * The default value of 0 means no restriction. * @return string Returns the metaphone key as a string. * @throws StringsException - * + * */ -function metaphone(string $str, int $phonemes = 0): string +function metaphone(string $string, int $max_phonemes = 0): string { error_clear_last(); - $result = \metaphone($str, $phonemes); + $result = \metaphone($string, $max_phonemes); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -124,48 +154,19 @@ function metaphone(string $str, int $phonemes = 0): string /** - * - * + * + * * @param string $filename The filename of the file to hash. - * @param bool $raw_output When TRUE, returns the digest in raw binary format with a length of + * @param bool $binary When TRUE, returns the digest in raw binary format with a length of * 20. * @return string Returns a string on success, FALSE otherwise. * @throws StringsException - * + * */ -function sha1_file(string $filename, bool $raw_output = false): string +function sha1_file(string $filename, bool $binary = false): string { error_clear_last(); - $result = \sha1_file($filename, $raw_output); - if ($result === false) { - throw StringsException::createFromPhpError(); - } - return $result; -} - - -/** - * Calculates the soundex key of str. - * - * Soundex keys have the property that words pronounced similarly - * produce the same soundex key, and can thus be used to simplify - * searches in databases where you know the pronunciation but not - * the spelling. This soundex function returns a string 4 characters - * long, starting with a letter. - * - * This particular soundex function is one described by Donald Knuth - * in "The Art Of Computer Programming, vol. 3: Sorting And - * Searching", Addison-Wesley (1973), pp. 391-392. - * - * @param string $str The input string. - * @return string Returns the soundex key as a string. - * @throws StringsException - * - */ -function soundex(string $str): string -{ - error_clear_last(); - $result = \soundex($str); + $result = \sha1_file($filename, $binary); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -176,265 +177,276 @@ function soundex(string $str): string /** * Returns a string produced according to the formatting string * format. - * + * * @param string $format The format string is composed of zero or more directives: * ordinary characters (excluding %) that are * copied directly to the result and conversion * specifications, each of which results in fetching its * own parameter. - * + * * A conversion specification follows this prototype: * %[argnum$][flags][width][.precision]specifier. - * + * * An integer followed by a dollar sign $, * to specify which number argument to treat in the conversion. - * - * + * + * * Flags - * - * - * + * + * + * * Flag * Description - * - * - * - * + * + * + * + * * - - * + * * Left-justify within the given field width; * Right justification is the default - * - * - * + * + * + * * + - * + * * Prefix positive numbers with a plus sign * +; Default only negative * are prefixed with a negative sign. - * - * - * + * + * + * * (space) - * + * * Pads the result with spaces. * This is the default. - * - * - * + * + * + * * 0 - * + * * Only left-pads numbers with zeros. * With s specifiers this can * also right-pad with zeros. - * - * - * + * + * + * * '(char) - * + * * Pads the result with the character (char). - * - * - * - * - * - * + * + * + * + * + * + * * An integer that says how many characters (minimum) * this conversion should result in. - * + * * A period . followed by an integer * who's meaning depends on the specifier: - * - * - * + * + * + * * For e, E, * f and F * specifiers: this is the number of digits to be printed * after the decimal point (by default, this is 6). - * - * - * - * - * For g and G + * + * + * + * + * For g, G, + * h and H * specifiers: this is the maximum number of significant * digits to be printed. - * - * - * - * + * + * + * + * * For s specifier: it acts as a cutoff point, * setting a maximum character limit to the string. - * - * - * - * - * + * + * + * + * + * * If the period is specified without an explicit value for precision, * 0 is assumed. - * - * - * - * + * + * + * + * * Specifiers - * - * - * + * + * + * * Specifier * Description - * - * - * - * + * + * + * + * * % - * + * * A literal percent character. No argument is required. - * - * - * + * + * + * * b - * + * * The argument is treated as an integer and presented * as a binary number. - * - * - * + * + * + * * c - * + * * The argument is treated as an integer and presented * as the character with that ASCII. - * - * - * + * + * + * * d - * + * * The argument is treated as an integer and presented * as a (signed) decimal number. - * - * - * + * + * + * * e - * + * * The argument is treated as scientific notation (e.g. 1.2e+2). - * The precision specifier stands for the number of digits after the - * decimal point since PHP 5.2.1. In earlier versions, it was taken as - * number of significant digits (one less). - * - * - * + * + * + * * E - * + * * Like the e specifier but uses * uppercase letter (e.g. 1.2E+2). - * - * - * + * + * + * * f - * + * * The argument is treated as a float and presented * as a floating-point number (locale aware). - * - * - * + * + * + * * F - * + * * The argument is treated as a float and presented * as a floating-point number (non-locale aware). - * Available as of PHP 5.0.3. - * - * - * + * + * + * * g - * - * + * + * * General format. - * - * + * + * * Let P equal the precision if nonzero, 6 if the precision is omitted, * or 1 if the precision is zero. * Then, if a conversion with style E would have an exponent of X: - * - * + * + * * If P > X ≥ −4, the conversion is with style f and precision P − (X + 1). * Otherwise, the conversion is with style e and precision P − 1. - * - * - * - * + * + * + * + * * G - * + * * Like the g specifier but uses * E and f. - * - * - * + * + * + * + * h + * + * Like the g specifier but uses F. + * Available as of PHP 8.0.0. + * + * + * + * H + * + * Like the g specifier but uses + * E and F. Available as of PHP 8.0.0. + * + * + * * o - * + * * The argument is treated as an integer and presented * as an octal number. - * - * - * + * + * + * * s - * + * * The argument is treated and presented as a string. - * - * - * + * + * + * * u - * + * * The argument is treated as an integer and presented * as an unsigned decimal number. - * - * - * + * + * + * * x - * + * * The argument is treated as an integer and presented * as a hexadecimal number (with lowercase letters). - * - * - * + * + * + * * X - * + * * The argument is treated as an integer and presented * as a hexadecimal number (with uppercase letters). - * - * - * - * - * - * + * + * + * + * + * + * * General format. - * + * * Let P equal the precision if nonzero, 6 if the precision is omitted, * or 1 if the precision is zero. * Then, if a conversion with style E would have an exponent of X: - * + * * If P > X ≥ −4, the conversion is with style f and precision P − (X + 1). * Otherwise, the conversion is with style e and precision P − 1. - * + * * The c type specifier ignores padding and width - * + * * Attempting to use a combination of the string and width specifiers with character sets that require more than one byte per character may result in unexpected results - * + * * Variables will be co-erced to a suitable type for the specifier: - * + * * Type Handling - * - * - * + * + * + * * Type * Specifiers - * - * - * - * + * + * + * + * * string * s - * - * - * integer - * + * + * + * int + * * d, * u, * c, @@ -442,101 +454,34 @@ function soundex(string $str): string * x, * X, * b - * - * - * - * double - * - * g, - * G, + * + * + * + * float + * * e, * E, * f, - * F - * - * - * - * - * - * @param mixed $params + * F, + * g, + * G, + * h, + * H + * + * + * + * + * + * @param mixed $values * @return string Returns a string produced according to the formatting string * format. * @throws StringsException - * - */ -function sprintf(string $format, ...$params): string -{ - error_clear_last(); - if ($params !== []) { - $result = \sprintf($format, ...$params); - } else { - $result = \sprintf($format); - } - if ($result === false) { - throw StringsException::createFromPhpError(); - } - return $result; -} - - -/** - * Returns the portion of string specified by the - * start and length parameters. - * - * @param string $string The input string. - * @param int $start If start is non-negative, the returned string - * will start at the start'th position in - * string, counting from zero. For instance, - * in the string 'abcdef', the character at - * position 0 is 'a', the - * character at position 2 is - * 'c', and so forth. - * - * If start is negative, the returned string - * will start at the start'th character - * from the end of string. - * - * If string is less than - * start characters long, FALSE will be returned. - * - * - * Using a negative start - * - * - * ]]> - * - * - * @param int $length If length is given and is positive, the string - * returned will contain at most length characters - * beginning from start (depending on the length of - * string). - * - * If length is given and is negative, then that many - * characters will be omitted from the end of string - * (after the start position has been calculated when a - * start is negative). If - * start denotes the position of this truncation or - * beyond, FALSE will be returned. - * - * If length is given and is 0, - * FALSE or NULL, an empty string will be returned. - * - * If length is omitted, the substring starting from - * start until the end of the string will be - * returned. - * @return string Returns the extracted part of string;, or - * an empty string. - * @throws StringsException - * + * */ -function substr(string $string, int $start, int $length = null): string +function sprintf(string $format, $values): string { error_clear_last(); - if ($length !== null) { - $result = \substr($string, $start, $length); - } else { - $result = \substr($string, $start); - } + $result = \sprintf($format, $values); if ($result === false) { throw StringsException::createFromPhpError(); } @@ -547,265 +492,276 @@ function substr(string $string, int $start, int $length = null): string /** * Operates as sprintf but accepts an array of * arguments, rather than a variable number of arguments. - * + * * @param string $format The format string is composed of zero or more directives: * ordinary characters (excluding %) that are * copied directly to the result and conversion * specifications, each of which results in fetching its * own parameter. - * + * * A conversion specification follows this prototype: * %[argnum$][flags][width][.precision]specifier. - * + * * An integer followed by a dollar sign $, * to specify which number argument to treat in the conversion. - * - * + * + * * Flags - * - * - * + * + * + * * Flag * Description - * - * - * - * + * + * + * + * * - - * + * * Left-justify within the given field width; * Right justification is the default - * - * - * + * + * + * * + - * + * * Prefix positive numbers with a plus sign * +; Default only negative * are prefixed with a negative sign. - * - * - * + * + * + * * (space) - * + * * Pads the result with spaces. * This is the default. - * - * - * + * + * + * * 0 - * + * * Only left-pads numbers with zeros. * With s specifiers this can * also right-pad with zeros. - * - * - * + * + * + * * '(char) - * + * * Pads the result with the character (char). - * - * - * - * - * - * + * + * + * + * + * + * * An integer that says how many characters (minimum) * this conversion should result in. - * + * * A period . followed by an integer * who's meaning depends on the specifier: - * - * - * + * + * + * * For e, E, * f and F * specifiers: this is the number of digits to be printed * after the decimal point (by default, this is 6). - * - * - * - * - * For g and G + * + * + * + * + * For g, G, + * h and H * specifiers: this is the maximum number of significant * digits to be printed. - * - * - * - * + * + * + * + * * For s specifier: it acts as a cutoff point, * setting a maximum character limit to the string. - * - * - * - * - * + * + * + * + * + * * If the period is specified without an explicit value for precision, * 0 is assumed. - * - * - * - * + * + * + * + * * Specifiers - * - * - * + * + * + * * Specifier * Description - * - * - * - * + * + * + * + * * % - * + * * A literal percent character. No argument is required. - * - * - * + * + * + * * b - * + * * The argument is treated as an integer and presented * as a binary number. - * - * - * + * + * + * * c - * + * * The argument is treated as an integer and presented * as the character with that ASCII. - * - * - * + * + * + * * d - * + * * The argument is treated as an integer and presented * as a (signed) decimal number. - * - * - * + * + * + * * e - * + * * The argument is treated as scientific notation (e.g. 1.2e+2). - * The precision specifier stands for the number of digits after the - * decimal point since PHP 5.2.1. In earlier versions, it was taken as - * number of significant digits (one less). - * - * - * + * + * + * * E - * + * * Like the e specifier but uses * uppercase letter (e.g. 1.2E+2). - * - * - * + * + * + * * f - * + * * The argument is treated as a float and presented * as a floating-point number (locale aware). - * - * - * + * + * + * * F - * + * * The argument is treated as a float and presented * as a floating-point number (non-locale aware). - * Available as of PHP 5.0.3. - * - * - * + * + * + * * g - * - * + * + * * General format. - * - * + * + * * Let P equal the precision if nonzero, 6 if the precision is omitted, * or 1 if the precision is zero. * Then, if a conversion with style E would have an exponent of X: - * - * + * + * * If P > X ≥ −4, the conversion is with style f and precision P − (X + 1). * Otherwise, the conversion is with style e and precision P − 1. - * - * - * - * + * + * + * + * * G - * + * * Like the g specifier but uses * E and f. - * - * - * + * + * + * + * h + * + * Like the g specifier but uses F. + * Available as of PHP 8.0.0. + * + * + * + * H + * + * Like the g specifier but uses + * E and F. Available as of PHP 8.0.0. + * + * + * * o - * + * * The argument is treated as an integer and presented * as an octal number. - * - * - * + * + * + * * s - * + * * The argument is treated and presented as a string. - * - * - * + * + * + * * u - * + * * The argument is treated as an integer and presented * as an unsigned decimal number. - * - * - * + * + * + * * x - * + * * The argument is treated as an integer and presented * as a hexadecimal number (with lowercase letters). - * - * - * + * + * + * * X - * + * * The argument is treated as an integer and presented * as a hexadecimal number (with uppercase letters). - * - * - * - * - * - * + * + * + * + * + * + * * General format. - * + * * Let P equal the precision if nonzero, 6 if the precision is omitted, * or 1 if the precision is zero. * Then, if a conversion with style E would have an exponent of X: - * + * * If P > X ≥ −4, the conversion is with style f and precision P − (X + 1). * Otherwise, the conversion is with style e and precision P − 1. - * + * * The c type specifier ignores padding and width - * + * * Attempting to use a combination of the string and width specifiers with character sets that require more than one byte per character may result in unexpected results - * + * * Variables will be co-erced to a suitable type for the specifier: - * + * * Type Handling - * - * - * + * + * + * * Type * Specifiers - * - * - * - * + * + * + * + * * string * s - * - * - * integer - * + * + * + * int + * * d, * u, * c, @@ -813,34 +769,38 @@ function substr(string $string, int $start, int $length = null): string * x, * X, * b - * - * - * - * double - * - * g, - * G, + * + * + * + * float + * * e, * E, * f, - * F - * - * - * - * - * - * @param array $args + * F, + * g, + * G, + * h, + * H + * + * + * + * + * + * @param array $values * @return string Return array values as a formatted string according to * format. * @throws StringsException - * + * */ -function vsprintf(string $format, array $args): string +function vsprintf(string $format, array $values): string { error_clear_last(); - $result = \vsprintf($format, $args); + $result = \vsprintf($format, $values); if ($result === false) { throw StringsException::createFromPhpError(); } return $result; } + + diff --git a/generated/swoole.php b/generated/swoole.php index 334d96bd..e9318894 100644 --- a/generated/swoole.php +++ b/generated/swoole.php @@ -5,14 +5,14 @@ use Safe\Exceptions\SwooleException; /** - * - * + * + * * @param string $filename The filename being written. * @param string $content The content writing to the file. * @param int $offset The offset. - * @param callable $callback + * @param callable $callback * @throws SwooleException - * + * */ function swoole_async_write(string $filename, string $content, int $offset = null, callable $callback = null): void { @@ -21,7 +21,7 @@ function swoole_async_write(string $filename, string $content, int $offset = nul $result = \swoole_async_write($filename, $content, $offset, $callback); } elseif ($offset !== null) { $result = \swoole_async_write($filename, $content, $offset); - } else { + }else { $result = \swoole_async_write($filename, $content); } if ($result === false) { @@ -31,14 +31,14 @@ function swoole_async_write(string $filename, string $content, int $offset = nul /** - * - * + * + * * @param string $filename The filename being written. * @param string $content The content writing to the file. - * @param callable $callback - * @param int $flags + * @param callable $callback + * @param int $flags * @throws SwooleException - * + * */ function swoole_async_writefile(string $filename, string $content, callable $callback = null, int $flags = 0): void { @@ -47,7 +47,7 @@ function swoole_async_writefile(string $filename, string $content, callable $cal $result = \swoole_async_writefile($filename, $content, $callback, $flags); } elseif ($callback !== null) { $result = \swoole_async_writefile($filename, $content, $callback); - } else { + }else { $result = \swoole_async_writefile($filename, $content); } if ($result === false) { @@ -57,11 +57,11 @@ function swoole_async_writefile(string $filename, string $content, callable $cal /** - * - * - * @param callable $callback + * + * + * @param callable $callback * @throws SwooleException - * + * */ function swoole_event_defer(callable $callback): void { @@ -74,11 +74,11 @@ function swoole_event_defer(callable $callback): void /** - * - * - * @param int $fd + * + * + * @param int $fd * @throws SwooleException - * + * */ function swoole_event_del(int $fd): void { @@ -91,12 +91,12 @@ function swoole_event_del(int $fd): void /** - * - * - * @param int $fd - * @param string $data + * + * + * @param int $fd + * @param string $data * @throws SwooleException - * + * */ function swoole_event_write(int $fd, string $data): void { @@ -106,3 +106,5 @@ function swoole_event_write(int $fd, string $data): void throw SwooleException::createFromPhpError(); } } + + diff --git a/generated/uodbc.php b/generated/uodbc.php index 89775c82..98428192 100644 --- a/generated/uodbc.php +++ b/generated/uodbc.php @@ -6,28 +6,28 @@ /** * Toggles autocommit behaviour. - * + * * By default, auto-commit is on for a connection. Disabling * auto-commit is equivalent with starting a transaction. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param bool $OnOff If OnOff is TRUE, auto-commit is enabled, if + * @param bool $enable If enable is TRUE, auto-commit is enabled, if * it is FALSE auto-commit is disabled. - * @return mixed Without the OnOff parameter, this function returns - * auto-commit status for connection_id. Non-zero is + * @return mixed Without the enable parameter, this function returns + * auto-commit status for odbc. Non-zero is * returned if auto-commit is on, 0 if it is off, or FALSE if an error * occurs. - * - * If OnOff is set, this function returns TRUE on + * + * If enable is set, this function returns TRUE on * success. * @throws UodbcException - * + * */ -function odbc_autocommit($connection_id, bool $OnOff = false) +function odbc_autocommit( $odbc, bool $enable = false) { error_clear_last(); - $result = \odbc_autocommit($connection_id, $OnOff); + $result = \odbc_autocommit($odbc, $enable); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -41,7 +41,7 @@ function odbc_autocommit($connection_id, bool $OnOff = false) * LONGVARBINARY. * The default mode can be set using the * uodbc.defaultbinmode php.ini directive. - * + * * When binary SQL data is converted to character C data (ODBC_BINMODE_CONVERT), each byte * (8 bits) of source data is represented as two ASCII characters. * These characters are the ASCII character representation of the @@ -49,95 +49,95 @@ function odbc_autocommit($connection_id, bool $OnOff = false) * 00000001 is converted to * "01" and a binary 11111111 * is converted to "FF". - * + * * While the handling of BINARY and VARBINARY * columns only depend on the binmode, the handling of LONGVARBINARY * columns also depends on the longreadlen as well: - * + * * LONGVARBINARY handling - * - * - * + * + * + * * binmode * longreadlen * result - * - * - * - * + * + * + * + * * ODBC_BINMODE_PASSTHRU * 0 * passthru - * - * + * + * * ODBC_BINMODE_RETURN * 0 * passthru - * - * + * + * * ODBC_BINMODE_CONVERT * 0 * passthru - * - * + * + * * ODBC_BINMODE_PASSTHRU * >0 * passthru - * - * + * + * * ODBC_BINMODE_RETURN * >0 * return as is - * - * + * + * * ODBC_BINMODE_CONVERT * >0 * return as char - * - * - * - * - * + * + * + * + * + * * If odbc_fetch_into is used, passthru means that an * empty string is returned for these columns. * If odbc_result is used, passthru means that the data are * sent directly to the client (i.e. printed). - * - * @param int $result_id The result identifier. - * - * If result_id is 0, the + * + * @param resource $statement The result identifier. + * + * If statement is 0, the * settings apply as default for new results. * @param int $mode Possible values for mode are: - * - * - * + * + * + * * ODBC_BINMODE_PASSTHRU: Passthru BINARY data - * - * - * - * + * + * + * + * * ODBC_BINMODE_RETURN: Return as is - * - * - * - * + * + * + * + * * ODBC_BINMODE_CONVERT: Convert to char and return - * - * - * - * - * + * + * + * + * + * * Handling of binary long * columns is also affected by odbc_longreadlen. - * - * + * + * * @throws UodbcException - * + * */ -function odbc_binmode(int $result_id, int $mode): void +function odbc_binmode( $statement, int $mode): void { error_clear_last(); - $result = \odbc_binmode($result_id, $mode); + $result = \odbc_binmode($statement, $mode); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -146,28 +146,28 @@ function odbc_binmode(int $result_id, int $mode): void /** * Lists columns and associated privileges for the given table. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). * @param string $schema The schema ('owner' in ODBC 2 parlance). * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $table_name The table name. + * @param string $table The table name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $column_name The column name. + * @param string $column The column name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. * @return resource Returns an ODBC result identifier. * This result identifier can be used to fetch a list of columns and * associated privileges. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME @@ -176,15 +176,15 @@ function odbc_binmode(int $result_id, int $mode): void * GRANTEE * PRIVILEGE * IS_GRANTABLE - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_columnprivileges($connection_id, string $catalog, string $schema, string $table_name, string $column_name) +function odbc_columnprivileges( $odbc, string $catalog, string $schema, string $table, string $column) { error_clear_last(); - $result = \odbc_columnprivileges($connection_id, $catalog, $schema, $table_name, $column_name); + $result = \odbc_columnprivileges($odbc, $catalog, $schema, $table, $column); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -194,26 +194,26 @@ function odbc_columnprivileges($connection_id, string $catalog, string $schema, /** * Lists all columns in the requested range. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). - * @param string $schema The schema ('owner' in ODBC 2 parlance). + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $schema The schema ('owner' in ODBC 2 parlance). * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $table_name The table name. + * @param $table The table name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $column_name The column name. + * @param $column The column name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME @@ -232,25 +232,15 @@ function odbc_columnprivileges($connection_id, string $catalog, string $schema, * CHAR_OCTET_LENGTH * ORDINAL_POSITION * IS_NULLABLE - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_columns($connection_id, string $catalog = null, string $schema = null, string $table_name = null, string $column_name = null) +function odbc_columns( $odbc, $catalog = null, $schema = null, $table = null, $column = null) { error_clear_last(); - if ($column_name !== null) { - $result = \odbc_columns($connection_id, $catalog, $schema, $table_name, $column_name); - } elseif ($table_name !== null) { - $result = \odbc_columns($connection_id, $catalog, $schema, $table_name); - } elseif ($schema !== null) { - $result = \odbc_columns($connection_id, $catalog, $schema); - } elseif ($catalog !== null) { - $result = \odbc_columns($connection_id, $catalog); - } else { - $result = \odbc_columns($connection_id); - } + $result = \odbc_columns($odbc, $catalog, $schema, $table, $column); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -260,27 +250,89 @@ function odbc_columns($connection_id, string $catalog = null, string $schema = n /** * Commits all pending transactions on the connection. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. * @throws UodbcException - * + * */ -function odbc_commit($connection_id): void +function odbc_commit( $odbc): void { error_clear_last(); - $result = \odbc_commit($connection_id); + $result = \odbc_commit($odbc); if ($result === false) { throw UodbcException::createFromPhpError(); } } +/** + * + * + * @param string $dsn The database source name for the connection. Alternatively, a + * DSN-less connection string can be used. + * @param string $user The username. + * @param string $password The password. + * @param int $cursor_option This sets the type of cursor to be used + * for this connection. This parameter is not normally needed, but + * can be useful for working around problems with some ODBC drivers. + * + * + * + * + * SQL_CUR_USE_IF_NEEDED + * + * + * + * + * SQL_CUR_USE_ODBC + * + * + * + * + * SQL_CUR_USE_DRIVER + * + * + * + * @return resource Returns an ODBC connection. + * @throws UodbcException + * + */ +function odbc_connect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) +{ + error_clear_last(); + $result = \odbc_connect($dsn, $user, $password, $cursor_option); + if ($result === false) { + throw UodbcException::createFromPhpError(); + } + return $result; +} + + +/** + * Gets the cursorname for the given result_id. + * + * @param resource $statement The result identifier. + * @return string Returns the cursor name, as a string. + * @throws UodbcException + * + */ +function odbc_cursor( $statement): string +{ + error_clear_last(); + $result = \odbc_cursor($statement); + if ($result === false) { + throw UodbcException::createFromPhpError(); + } + return $result; +} + + /** * This function will return the list of available DSN (after calling it * several times). - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. * @param int $fetch_type The fetch_type can be one of two constant types: * SQL_FETCH_FIRST, SQL_FETCH_NEXT. @@ -289,12 +341,12 @@ function odbc_commit($connection_id): void * @return array Returns FALSE on error, an array upon success, and NULL after fetching * the last available DSN. * @throws UodbcException - * + * */ -function odbc_data_source($connection_id, int $fetch_type): array +function odbc_data_source( $odbc, int $fetch_type): array { error_clear_last(); - $result = \odbc_data_source($connection_id, $fetch_type); + $result = \odbc_data_source($odbc, $fetch_type); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -304,24 +356,19 @@ function odbc_data_source($connection_id, int $fetch_type): array /** * Sends an SQL statement to the database server. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $query_string The SQL statement. - * @param int $flags This parameter is currently not used. + * @param string $query The SQL statement. * @return resource Returns an ODBC result identifier if the SQL command was executed * successfully. * @throws UodbcException - * + * */ -function odbc_exec($connection_id, string $query_string, int $flags = null) +function odbc_exec( $odbc, string $query) { error_clear_last(); - if ($flags !== null) { - $result = \odbc_exec($connection_id, $query_string, $flags); - } else { - $result = \odbc_exec($connection_id, $query_string); - } + $result = \odbc_exec($odbc, $query); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -331,28 +378,24 @@ function odbc_exec($connection_id, string $query_string, int $flags = null) /** * Executes a statement prepared with odbc_prepare. - * - * @param resource $result_id The result id resource, from odbc_prepare. - * @param array $parameters_array Parameters in parameter_array will be + * + * @param resource $statement The result id resource, from odbc_prepare. + * @param array $params Parameters in params will be * substituted for placeholders in the prepared statement in order. * Elements of this array will be converted to strings by calling this * function. - * - * Any parameters in parameter_array which + * + * Any parameters in params which * start and end with single quotes will be taken as the name of a * file to read and send to the database server as the data for the * appropriate placeholder. * @throws UodbcException - * + * */ -function odbc_execute($result_id, array $parameters_array = null): void +function odbc_execute( $statement, array $params = []): void { error_clear_last(); - if ($parameters_array !== null) { - $result = \odbc_execute($result_id, $parameters_array); - } else { - $result = \odbc_execute($result_id); - } + $result = \odbc_execute($statement, $params); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -361,26 +404,22 @@ function odbc_execute($result_id, array $parameters_array = null): void /** * Fetch one result row into array. - * - * @param resource $result_id The result resource. - * @param array|null $result_array The result array + * + * @param resource $statement The result resource. + * @param array $array The result array * that can be of any type since it will be converted to type * array. The array will contain the column values starting at array * index 0. - * @param int $rownumber The row number. + * @param int $row The row number. * @return int Returns the number of columns in the result; * FALSE on error. * @throws UodbcException - * + * */ -function odbc_fetch_into($result_id, ?array &$result_array, int $rownumber = null): int +function odbc_fetch_into( $statement, array &$array, int $row = 0): int { error_clear_last(); - if ($rownumber !== null) { - $result = \odbc_fetch_into($result_id, $result_array, $rownumber); - } else { - $result = \odbc_fetch_into($result_id, $result_array); - } + $result = \odbc_fetch_into($statement, $array, $row); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -391,17 +430,17 @@ function odbc_fetch_into($result_id, ?array &$result_array, int $rownumber = nul /** * Gets the length of the field referenced by number in the given result * identifier. - * - * @param resource $result_id The result identifier. - * @param int $field_number The field number. Field numbering starts at 1. + * + * @param resource $statement The result identifier. + * @param int $field The field number. Field numbering starts at 1. * @return int Returns the field length. * @throws UodbcException - * + * */ -function odbc_field_len($result_id, int $field_number): int +function odbc_field_len( $statement, int $field): int { error_clear_last(); - $result = \odbc_field_len($result_id, $field_number); + $result = \odbc_field_len($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -412,17 +451,17 @@ function odbc_field_len($result_id, int $field_number): int /** * Gets the name of the field occupying the given column number in the given * result identifier. - * - * @param resource $result_id The result identifier. - * @param int $field_number The field number. Field numbering starts at 1. + * + * @param resource $statement The result identifier. + * @param int $field The field number. Field numbering starts at 1. * @return string Returns the field name as a string. * @throws UodbcException - * + * */ -function odbc_field_name($result_id, int $field_number): string +function odbc_field_name( $statement, int $field): string { error_clear_last(); - $result = \odbc_field_name($result_id, $field_number); + $result = \odbc_field_name($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -433,18 +472,18 @@ function odbc_field_name($result_id, int $field_number): string /** * Gets the number of the column slot that corresponds to the named field in * the given result identifier. - * - * @param resource $result_id The result identifier. - * @param string $field_name The field name. + * + * @param resource $statement The result identifier. + * @param string $field The field name. * @return int Returns the field number as a integer. * Field numbering starts at 1. * @throws UodbcException - * + * */ -function odbc_field_num($result_id, string $field_name): int +function odbc_field_num( $statement, string $field): int { error_clear_last(); - $result = \odbc_field_num($result_id, $field_name); + $result = \odbc_field_num($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -455,17 +494,17 @@ function odbc_field_num($result_id, string $field_name): int /** * Gets the scale of the field referenced by number in the given result * identifier. - * - * @param resource $result_id The result identifier. - * @param int $field_number The field number. Field numbering starts at 1. + * + * @param resource $statement The result identifier. + * @param int $field The field number. Field numbering starts at 1. * @return int Returns the field scale as a integer. * @throws UodbcException - * + * */ -function odbc_field_scale($result_id, int $field_number): int +function odbc_field_scale( $statement, int $field): int { error_clear_last(); - $result = \odbc_field_scale($result_id, $field_number); + $result = \odbc_field_scale($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -476,17 +515,17 @@ function odbc_field_scale($result_id, int $field_number): int /** * Gets the SQL type of the field referenced by number in the given result * identifier. - * - * @param resource $result_id The result identifier. - * @param int $field_number The field number. Field numbering starts at 1. + * + * @param resource $statement The result identifier. + * @param int $field The field number. Field numbering starts at 1. * @return string Returns the field type as a string. * @throws UodbcException - * + * */ -function odbc_field_type($result_id, int $field_number): string +function odbc_field_type( $statement, int $field): string { error_clear_last(); - $result = \odbc_field_type($result_id, $field_number); + $result = \odbc_field_type($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -498,19 +537,19 @@ function odbc_field_type($result_id, int $field_number): string * Retrieves a list of foreign keys in the specified table or a list of * foreign keys in other tables that refer to the primary key in the * specified table - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $pk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the primary key table. + * @param $pk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the primary key table. * @param string $pk_schema The schema ('owner' in ODBC 2 parlance) of the primary key table. * @param string $pk_table The primary key table. * @param string $fk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the foreign key table. * @param string $fk_schema The schema ('owner' in ODBC 2 parlance) of the foreign key table. * @param string $fk_table The foreign key table. * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * PKTABLE_CAT * PKTABLE_SCHEM * PKTABLE_NAME @@ -525,15 +564,15 @@ function odbc_field_type($result_id, int $field_number): string * FK_NAME * PK_NAME * DEFERRABILITY - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_foreignkeys($connection_id, string $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table) +function odbc_foreignkeys( $odbc, $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table) { error_clear_last(); - $result = \odbc_foreignkeys($connection_id, $pk_catalog, $pk_schema, $pk_table, $fk_catalog, $fk_schema, $fk_table); + $result = \odbc_foreignkeys($odbc, $pk_catalog, $pk_schema, $pk_table, $fk_catalog, $fk_schema, $fk_table); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -543,15 +582,15 @@ function odbc_foreignkeys($connection_id, string $pk_catalog, string $pk_schema, /** * Retrieves information about data types supported by the data source. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. * @param int $data_type The data type, which can be used to restrict the information to a * single data type. * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * TYPE_NAME * DATA_TYPE * PRECISION @@ -567,20 +606,16 @@ function odbc_foreignkeys($connection_id, string $pk_catalog, string $pk_schema, * LOCAL_TYPE_NAME * MINIMUM_SCALE * MAXIMUM_SCALE - * - * + * + * * The result set is ordered by DATA_TYPE and TYPE_NAME. * @throws UodbcException - * + * */ -function odbc_gettypeinfo($connection_id, int $data_type = null) +function odbc_gettypeinfo( $odbc, int $data_type = 0) { error_clear_last(); - if ($data_type !== null) { - $result = \odbc_gettypeinfo($connection_id, $data_type); - } else { - $result = \odbc_gettypeinfo($connection_id); - } + $result = \odbc_gettypeinfo($odbc, $data_type); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -592,45 +627,77 @@ function odbc_gettypeinfo($connection_id, int $data_type = null) * Controls handling of LONG, LONGVARCHAR and LONGVARBINARY columns. * The default length can be set using the * uodbc.defaultlrl php.ini directive. - * - * @param resource $result_id The result identifier. + * + * @param resource $statement The result identifier. * @param int $length The number of bytes returned to PHP is controlled by the parameter * length. If it is set to 0, long column data is passed through to the * client (i.e. printed) when retrieved with odbc_result. * @throws UodbcException - * + * + */ +function odbc_longreadlen( $statement, int $length): void +{ + error_clear_last(); + $result = \odbc_longreadlen($statement, $length); + if ($result === false) { + throw UodbcException::createFromPhpError(); + } +} + + +/** + * Opens a persistent database connection. + * + * This function is much like + * odbc_connect, except that the connection is + * not really closed when the script has finished. Future requests + * for a connection with the same dsn, + * user, password + * combination (via odbc_connect and + * odbc_pconnect) can reuse the persistent + * connection. + * + * @param string $dsn + * @param string $user + * @param string $password + * @param int $cursor_option + * @return resource Returns an ODBC connection. + * error. + * @throws UodbcException + * */ -function odbc_longreadlen($result_id, int $length): void +function odbc_pconnect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) { error_clear_last(); - $result = \odbc_longreadlen($result_id, $length); + $result = \odbc_pconnect($dsn, $user, $password, $cursor_option); if ($result === false) { throw UodbcException::createFromPhpError(); } + return $result; } /** * Prepares a statement for execution. The result identifier can be used * later to execute the statement with odbc_execute. - * + * * Some databases (such as IBM DB2, MS SQL Server, and Oracle) support * stored procedures that accept parameters of type IN, INOUT, and OUT as * defined by the ODBC specification. However, the Unified ODBC driver * currently only supports parameters of type IN to stored procedures. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $query_string The query string statement being prepared. + * @param string $query The query string statement being prepared. * @return resource Returns an ODBC result identifier if the SQL command was prepared * successfully. * @throws UodbcException - * + * */ -function odbc_prepare($connection_id, string $query_string) +function odbc_prepare( $odbc, string $query) { error_clear_last(); - $result = \odbc_prepare($connection_id, $query_string); + $result = \odbc_prepare($odbc, $query); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -641,31 +708,133 @@ function odbc_prepare($connection_id, string $query_string) /** * Returns a result identifier that can be used to fetch the column names * that comprise the primary key for a table. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). * @param string $schema The schema ('owner' in ODBC 2 parlance). - * @param string $table + * @param string $table * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME * COLUMN_NAME * KEY_SEQ * PK_NAME - * + * + * Drivers can report additional columns. + * @throws UodbcException + * + */ +function odbc_primarykeys( $odbc, $catalog, string $schema, string $table) +{ + error_clear_last(); + $result = \odbc_primarykeys($odbc, $catalog, $schema, $table); + if ($result === false) { + throw UodbcException::createFromPhpError(); + } + return $result; +} + + +/** + * Retrieve information about parameters to procedures. + * + * @param resource $odbc The ODBC connection identifier, + * see odbc_connect for details. + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $schema The schema ('owner' in ODBC 2 parlance). + * This parameter accepts the following search patterns: + * % to match zero or more characters, + * and _ to match a single character. + * @param $procedure The proc. + * This parameter accepts the following search patterns: + * % to match zero or more characters, + * and _ to match a single character. + * @param string $column The column. + * This parameter accepts the following search patterns: + * % to match zero or more characters, + * and _ to match a single character. + * @return resource Returns the list of input and output parameters, as well as the + * columns that make up the result set for the specified procedures. + * Returns an ODBC result identifier. + * + * The result set has the following columns: + * + * PROCEDURE_CAT + * PROCEDURE_SCHEM + * PROCEDURE_NAME + * COLUMN_NAME + * COLUMN_TYPE + * DATA_TYPE + * TYPE_NAME + * COLUMN_SIZE + * BUFFER_LENGTH + * DECIMAL_DIGITS + * NUM_PREC_RADIX + * NULLABLE + * REMARKS + * COLUMN_DEF + * SQL_DATA_TYPE + * SQL_DATETIME_SUB + * CHAR_OCTET_LENGTH + * ORDINAL_POSITION + * IS_NULLABLE + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_primarykeys($connection_id, string $catalog, string $schema, string $table) +function odbc_procedurecolumns( $odbc, $catalog = null, $schema = null, $procedure = null, string $column = null) { error_clear_last(); - $result = \odbc_primarykeys($connection_id, $catalog, $schema, $table); + $result = \odbc_procedurecolumns($odbc, $catalog, $schema, $procedure, $column); + if ($result === false) { + throw UodbcException::createFromPhpError(); + } + return $result; +} + + +/** + * Lists all procedures in the requested range. + * + * @param resource $odbc The ODBC connection identifier, + * see odbc_connect for details. + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $schema The schema ('owner' in ODBC 2 parlance). + * This parameter accepts the following search patterns: + * % to match zero or more characters, + * and _ to match a single character. + * @param $procedure The name. + * This parameter accepts the following search patterns: + * % to match zero or more characters, + * and _ to match a single character. + * @return resource Returns an ODBC + * result identifier containing the information. + * + * The result set has the following columns: + * + * PROCEDURE_CAT + * PROCEDURE_SCHEM + * PROCEDURE_NAME + * NUM_INPUT_PARAMS + * NUM_OUTPUT_PARAMS + * NUM_RESULT_SETS + * REMARKS + * PROCEDURE_TYPE + * + * Drivers can report additional columns. + * @throws UodbcException + * + */ +function odbc_procedures( $odbc, $catalog = null, $schema = null, $procedure = null) +{ + error_clear_last(); + $result = \odbc_procedures($odbc, $catalog, $schema, $procedure); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -677,24 +846,20 @@ function odbc_primarykeys($connection_id, string $catalog, string $schema, strin * Prints all rows from a result identifier produced by * odbc_exec. The result is printed in HTML table format. * The data is not escaped. - * + * * This function is not supposed to be used in production environments; it is * merely meant for development purposes, to get a result set quickly rendered. - * - * @param resource $result_id The result identifier. + * + * @param resource $statement The result identifier. * @param string $format Additional overall table formatting. * @return int Returns the number of rows in the result. * @throws UodbcException - * + * */ -function odbc_result_all($result_id, string $format = null): int +function odbc_result_all( $statement, string $format = ""): int { error_clear_last(); - if ($format !== null) { - $result = \odbc_result_all($result_id, $format); - } else { - $result = \odbc_result_all($result_id); - } + $result = \odbc_result_all($statement, $format); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -704,20 +869,20 @@ function odbc_result_all($result_id, string $format = null): int /** * Get result data - * - * @param resource $result_id The ODBC resource. + * + * @param resource $statement The ODBC resource. * @param mixed $field The field name being retrieved. It can either be an integer containing * the column number of the field you want; or it can be a string * containing the name of the field. * @return mixed Returns the string contents of the field, FALSE on error, NULL for * NULL data, or TRUE for binary data. * @throws UodbcException - * + * */ -function odbc_result($result_id, $field) +function odbc_result( $statement, $field) { error_clear_last(); - $result = \odbc_result($result_id, $field); + $result = \odbc_result($statement, $field); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -727,16 +892,16 @@ function odbc_result($result_id, $field) /** * Rolls back all pending statements on the connection. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. * @throws UodbcException - * + * */ -function odbc_rollback($connection_id): void +function odbc_rollback( $odbc): void { error_clear_last(); - $result = \odbc_rollback($connection_id); + $result = \odbc_rollback($odbc); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -752,7 +917,7 @@ function odbc_rollback($connection_id): void * certainly need a good ODBC reference to explain all the different * options and values that can be used. Different driver versions * support different options. - * + * * Because the effects may vary depending on the ODBC driver, use of * this function in scripts to be made publicly available is * strongly discouraged. Also, some ODBC options are not available @@ -761,22 +926,22 @@ function odbc_rollback($connection_id): void * particular job it can make PHP work so your boss doesn't tell you * to use a commercial product, that's all that really * matters. - * - * @param resource $id Is a connection id or result id on which to change the settings. + * + * @param resource $odbc Is a connection id or result id on which to change the settings. * For SQLSetConnectOption(), this is a connection id. * For SQLSetStmtOption(), this is a result id. - * @param int $function Is the ODBC function to use. The value should be + * @param int $which Is the ODBC function to use. The value should be * 1 for SQLSetConnectOption() and * 2 for SQLSetStmtOption(). * @param int $option The option to set. - * @param int $param The value for the given option. + * @param int $value The value for the given option. * @throws UodbcException - * + * */ -function odbc_setoption($id, int $function, int $option, int $param): void +function odbc_setoption( $odbc, int $which, int $option, int $value): void { error_clear_last(); - $result = \odbc_setoption($id, $function, $option, $param); + $result = \odbc_setoption($odbc, $which, $option, $value); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -787,11 +952,11 @@ function odbc_setoption($id, int $function, int $option, int $param): void * Retrieves either the optimal set of columns that uniquely identifies a * row in the table, or columns that are automatically updated when any * value in the row is updated by a transaction. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param int $type - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param int $type + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). * @param string $schema The schema ('owner' in ODBC 2 parlance). * @param string $table The table. * @param int $scope The scope, which orders the result set. @@ -800,9 +965,9 @@ function odbc_setoption($id, int $function, int $option, int $param): void * @param int $nullable Determines whether to return special columns that can have a NULL value. * One of SQL_NO_NULLS or SQL_NULLABLE . * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * SCOPE * COLUMN_NAME * DATA_TYPE @@ -811,15 +976,15 @@ function odbc_setoption($id, int $function, int $option, int $param): void * BUFFER_LENGTH * DECIMAL_DIGITS * PSEUDO_COLUMN - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_specialcolumns($connection_id, int $type, string $catalog, string $schema, string $table, int $scope, int $nullable) +function odbc_specialcolumns( $odbc, int $type, $catalog, string $schema, string $table, int $scope, int $nullable) { error_clear_last(); - $result = \odbc_specialcolumns($connection_id, $type, $catalog, $schema, $table, $scope, $nullable); + $result = \odbc_specialcolumns($odbc, $type, $catalog, $schema, $table, $scope, $nullable); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -829,21 +994,21 @@ function odbc_specialcolumns($connection_id, int $type, string $catalog, string /** * Get statistics about a table and its indexes. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). * @param string $schema The schema ('owner' in ODBC 2 parlance). - * @param string $table_name The table name. + * @param string $table The table name. * @param int $unique The type of the index. * One of SQL_INDEX_UNIQUE or SQL_INDEX_ALL. * @param int $accuracy One of SQL_ENSURE or SQL_QUICK. * The latter requests that the driver retrieve the CARDINALITY and * PAGES only if they are readily available from the server. * @return resource Returns an ODBC result identifier. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME @@ -857,15 +1022,15 @@ function odbc_specialcolumns($connection_id, int $type, string $catalog, string * CARDINALITY * PAGES * FILTER_CONDITION - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_statistics($connection_id, string $catalog, string $schema, string $table_name, int $unique, int $accuracy) +function odbc_statistics( $odbc, $catalog, string $schema, string $table, int $unique, int $accuracy) { error_clear_last(); - $result = \odbc_statistics($connection_id, $catalog, $schema, $table_name, $unique, $accuracy); + $result = \odbc_statistics($odbc, $catalog, $schema, $table, $unique, $accuracy); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -876,22 +1041,22 @@ function odbc_statistics($connection_id, string $catalog, string $schema, string /** * Lists tables in the requested range and the privileges associated * with each table. - * - * @param resource $connection_id The ODBC connection identifier, + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). * @param string $schema The schema ('owner' in ODBC 2 parlance). * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $name The name. + * @param string $table The name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. * @return resource An ODBC result identifier. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME @@ -899,15 +1064,15 @@ function odbc_statistics($connection_id, string $catalog, string $schema, string * GRANTEE * PRIVILEGE * IS_GRANTABLE - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_tableprivileges($connection_id, string $catalog, string $schema, string $name) +function odbc_tableprivileges( $odbc, $catalog, string $schema, string $table) { error_clear_last(); - $result = \odbc_tableprivileges($connection_id, $catalog, $schema, $name); + $result = \odbc_tableprivileges($odbc, $catalog, $schema, $table); if ($result === false) { throw UodbcException::createFromPhpError(); } @@ -917,57 +1082,57 @@ function odbc_tableprivileges($connection_id, string $catalog, string $schema, s /** * Lists all tables in the requested range. - * + * * To support enumeration of qualifiers, owners, and table types, * the following special semantics for the * catalog, schema, - * name, and + * table, and * table_type are available: - * - * - * + * + * + * * If catalog is a single percent * character (%) and schema and - * name are empty strings, then the result + * table are empty strings, then the result * set contains a list of valid qualifiers for the data * source. (All columns except the TABLE_QUALIFIER column contain * NULLs.) - * - * - * - * + * + * + * + * * If schema is a single percent character * (%) and catalog and - * name are empty strings, then the result + * table are empty strings, then the result * set contains a list of valid owners for the data source. (All * columns except the TABLE_OWNER column contain * NULLs.) - * - * - * - * + * + * + * + * * If table_type is a single percent * character (%) and catalog, - * schema and name + * schema and table * are empty strings, then the result set contains a list of * valid table types for the data source. (All columns except the * TABLE_TYPE column contain NULLs.) - * - * - * - * - * @param resource $connection_id The ODBC connection identifier, + * + * + * + * + * @param resource $odbc The ODBC connection identifier, * see odbc_connect for details. - * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance). - * @param string $schema The schema ('owner' in ODBC 2 parlance). + * @param $catalog The catalog ('qualifier' in ODBC 2 parlance). + * @param $schema The schema ('owner' in ODBC 2 parlance). * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $name The name. + * @param $table The name. * This parameter accepts the following search patterns: * % to match zero or more characters, * and _ to match a single character. - * @param string $types If table_type is not an empty string, it + * @param $types If table_type is not an empty string, it * must contain a list of comma-separated values for the types of * interest; each value may be enclosed in single quotes (') or * unquoted. For example, 'TABLE','VIEW' or TABLE, VIEW. If the @@ -975,35 +1140,27 @@ function odbc_tableprivileges($connection_id, string $catalog, string $schema, s * odbc_tables does not return any results for * that type. * @return resource Returns an ODBC result identifier containing the information. - * + * * The result set has the following columns: - * + * * TABLE_CAT * TABLE_SCHEM * TABLE_NAME * TABLE_TYPE * REMARKS - * + * * Drivers can report additional columns. * @throws UodbcException - * + * */ -function odbc_tables($connection_id, string $catalog = null, string $schema = null, string $name = null, string $types = null) +function odbc_tables( $odbc, $catalog = null, $schema = null, $table = null, $types = null) { error_clear_last(); - if ($types !== null) { - $result = \odbc_tables($connection_id, $catalog, $schema, $name, $types); - } elseif ($name !== null) { - $result = \odbc_tables($connection_id, $catalog, $schema, $name); - } elseif ($schema !== null) { - $result = \odbc_tables($connection_id, $catalog, $schema); - } elseif ($catalog !== null) { - $result = \odbc_tables($connection_id, $catalog); - } else { - $result = \odbc_tables($connection_id); - } + $result = \odbc_tables($odbc, $catalog, $schema, $table, $types); if ($result === false) { throw UodbcException::createFromPhpError(); } return $result; } + + diff --git a/generated/uopz.php b/generated/uopz.php index ae0ee8f8..59378a25 100644 --- a/generated/uopz.php +++ b/generated/uopz.php @@ -6,11 +6,11 @@ /** * Makes class extend parent - * + * * @param string $class The name of the class to extend * @param string $parent The name of the class to inherit * @throws UopzException - * + * */ function uopz_extend(string $class, string $parent): void { @@ -24,11 +24,11 @@ function uopz_extend(string $class, string $parent): void /** * Makes class implement interface - * - * @param string $class - * @param string $interface + * + * @param string $class + * @param string $interface * @throws UopzException - * + * */ function uopz_implement(string $class, string $interface): void { @@ -38,3 +38,5 @@ function uopz_implement(string $class, string $interface): void throw UopzException::createFromPhpError(); } } + + diff --git a/generated/url.php b/generated/url.php index 56c08b55..68b6bc3d 100644 --- a/generated/url.php +++ b/generated/url.php @@ -5,9 +5,9 @@ use Safe\Exceptions\UrlException; /** - * Decodes a base64 encoded data. - * - * @param string $data The encoded data. + * Decodes a base64 encoded string. + * + * @param string $string The encoded data. * @param bool $strict If the strict parameter is set to TRUE * then the base64_decode function will return * FALSE if the input contains character from outside the base64 @@ -15,12 +15,12 @@ * @return string Returns the decoded data. The returned data may be * binary. * @throws UrlException - * + * */ -function base64_decode(string $data, bool $strict = false): string +function base64_decode(string $string, bool $strict = false): string { error_clear_last(); - $result = \base64_decode($data, $strict); + $result = \base64_decode($string, $strict); if ($result === false) { throw UrlException::createFromPhpError(); } @@ -31,25 +31,69 @@ function base64_decode(string $data, bool $strict = false): string /** * get_headers returns an array with the headers sent * by the server in response to a HTTP request. - * + * * @param string $url The target URL. - * @param int $format If the optional format parameter is set to non-zero, - * get_headers parses the response and sets the + * @param bool $associative If the optional associative parameter is set to true, + * get_headers parses the response and sets the * array's keys. * @param resource $context A valid context resource created with - * stream_context_create. + * stream_context_create, or NULL to use the + * default context. * @return array Returns an indexed or associative array with the headers. * @throws UrlException - * + * */ -function get_headers(string $url, int $format = 0, $context = null): array +function get_headers(string $url, bool $associative = false, $context = null): array { error_clear_last(); - if ($context !== null) { - $result = \get_headers($url, $format, $context); - } else { - $result = \get_headers($url, $format); + $result = \get_headers($url, $associative, $context); + if ($result === false) { + throw UrlException::createFromPhpError(); } + return $result; +} + + +/** + * Opens filename and parses it line by line for + * <meta> tags in the file. The parsing stops at + * </head>. + * + * @param string $filename The path to the HTML file, as a string. This can be a local file or an + * URL. + * + * + * What get_meta_tags parses + * + * + * + * + * + * + * ]]> + * + * + * @param bool $use_include_path Setting use_include_path to TRUE will result + * in PHP trying to open the file along the standard include path as per + * the include_path directive. + * This is used for local files, not URLs. + * @return array Returns an array with all the parsed meta tags. + * + * The value of the name property becomes the key, the value of the content + * property becomes the value of the returned array, so you can easily use + * standard array functions to traverse it or access single values. + * Special characters in the value of the name property are substituted with + * '_', the rest is converted to lower case. If two meta tags have the same + * name, only the last one is returned. + * + * Returns FALSE on failure. + * @throws UrlException + * + */ +function get_meta_tags(string $filename, bool $use_include_path = false): array +{ + error_clear_last(); + $result = \get_meta_tags($filename, $use_include_path); if ($result === false) { throw UrlException::createFromPhpError(); } @@ -61,14 +105,13 @@ function get_headers(string $url, int $format = 0, $context = null): array * This function parses a URL and returns an associative array containing any * of the various components of the URL that are present. * The values of the array elements are not URL decoded. - * + * * This function is not meant to validate - * the given URL, it only breaks it up into the above listed parts. Partial + * the given URL, it only breaks it up into the parts listed below. Partial and invalid * URLs are also accepted, parse_url tries its best to * parse them correctly. - * - * @param string $url The URL to parse. Invalid characters are replaced by - * _. + * + * @param string $url The URL to parse. * @param int $component Specify one of PHP_URL_SCHEME, * PHP_URL_HOST, PHP_URL_PORT, * PHP_URL_USER, PHP_URL_PASS, @@ -76,62 +119,75 @@ function get_headers(string $url, int $format = 0, $context = null): array * or PHP_URL_FRAGMENT to retrieve just a specific * URL component as a string (except when * PHP_URL_PORT is given, in which case the return - * value will be an integer). + * value will be an int). * @return mixed On seriously malformed URLs, parse_url. - * + * * If the component parameter is omitted, an * associative array is returned. At least one element will be * present within the array. Potential keys within this array are: - * - * - * + * + * + * * scheme - e.g. http - * - * - * - * - * host - * - * - * - * + * + * + * + * + * host + * + * + * + * * port - * - * - * - * + * + * + * + * * user - * - * - * - * + * + * + * + * * pass - * - * - * - * + * + * + * + * * path - * - * - * - * + * + * + * + * * query - after the question mark ? - * - * - * - * + * + * + * + * * fragment - after the hashmark # - * - * - * - * + * + * + * + * * If the component parameter is specified, * parse_url returns a string (or an - * integer, in the case of PHP_URL_PORT) + * int, in the case of PHP_URL_PORT) * instead of an array. If the requested component doesn't exist * within the given URL, NULL will be returned. + * As of PHP 8.0.0, parse_url distinguishes absent and empty + * queries and fragments: + * + * + * + * + * + * + * + * Previously all cases resulted in query and fragment being NULL. + * + * Note that control characters (cf. ctype_cntrl) in the + * components are replaced with underscores (_). * @throws UrlException - * + * */ function parse_url(string $url, int $component = -1) { @@ -142,3 +198,5 @@ function parse_url(string $url, int $component = -1) } return $result; } + + diff --git a/generated/var.php b/generated/var.php index 14609f22..63ff6872 100644 --- a/generated/var.php +++ b/generated/var.php @@ -7,50 +7,50 @@ /** * Set the type of variable var to * type. - * + * * @param mixed $var The variable being converted. * @param string $type Possibles values of type are: - * - * - * + * + * + * * "boolean" or "bool" - * - * - * - * + * + * + * + * * "integer" or "int" - * - * - * - * + * + * + * + * * "float" or "double" - * - * - * - * + * + * + * + * * "string" - * - * - * - * + * + * + * + * * "array" - * - * - * - * + * + * + * + * * "object" - * - * - * - * + * + * + * + * * "null" - * - * - * + * + * + * * @throws VarException - * + * */ -function settype(&$var, string $type): void +function settype( &$var, string $type): void { error_clear_last(); $result = \settype($var, $type); @@ -58,3 +58,5 @@ function settype(&$var, string $type): void throw VarException::createFromPhpError(); } } + + diff --git a/generated/xdiff.php b/generated/xdiff.php index 27feef39..33e2846f 100644 --- a/generated/xdiff.php +++ b/generated/xdiff.php @@ -8,13 +8,13 @@ * Makes a binary diff of two files and stores the result in a patch file. * This function works with both text and binary files. Resulting patch * file can be later applied using xdiff_file_bpatch/xdiff_string_bpatch. - * + * * @param string $old_file Path to the first file. This file acts as "old" file. * @param string $new_file Path to the second file. This file acts as "new" file. * @param string $dest Path of the resulting patch file. Resulting file contains differences * between "old" and "new" files. It is in binary format and is human-unreadable. * @throws XdiffException - * + * */ function xdiff_file_bdiff(string $old_file, string $new_file, string $dest): void { @@ -28,15 +28,15 @@ function xdiff_file_bdiff(string $old_file, string $new_file, string $dest): voi /** * Patches a file with a binary - * patch and stores the result in a file dest. - * This function accepts patches created both via xdiff_file_bdiff + * patch and stores the result in a file dest. + * This function accepts patches created both via xdiff_file_bdiff * and xdiff_file_rabdiff functions or their string counterparts. - * + * * @param string $file The original file. * @param string $patch The binary patch file. * @param string $dest Path of the resulting file. * @throws XdiffException - * + * */ function xdiff_file_bpatch(string $file, string $patch, string $dest): void { @@ -52,15 +52,15 @@ function xdiff_file_bpatch(string $file, string $patch, string $dest): void * Makes a binary diff of two files and stores the result in a patch file. * This function works with both text and binary files. Resulting patch * file can be later applied using xdiff_file_bpatch. - * + * * Starting with version 1.5.0 this function is an alias of xdiff_file_bdiff. - * + * * @param string $old_file Path to the first file. This file acts as "old" file. * @param string $new_file Path to the second file. This file acts as "new" file. * @param string $dest Path of the resulting patch file. Resulting file contains differences * between "old" and "new" files. It is in binary format and is human-unreadable. * @throws XdiffException - * + * */ function xdiff_file_diff_binary(string $old_file, string $new_file, string $dest): void { @@ -79,7 +79,7 @@ function xdiff_file_diff_binary(string $old_file, string $new_file, string $dest * specifies how many lines of context should be added around each change. * Setting minimal parameter to true will result in outputting the shortest * patch file possible (can take a long time). - * + * * @param string $old_file Path to the first file. This file acts as "old" file. * @param string $new_file Path to the second file. This file acts as "new" file. * @param string $dest Path of the resulting patch file. @@ -88,7 +88,7 @@ function xdiff_file_diff_binary(string $old_file, string $new_file, string $dest * @param bool $minimal Set this parameter to TRUE if you want to minimalize size of the result * (can take a long time). * @throws XdiffException - * + * */ function xdiff_file_diff(string $old_file, string $new_file, string $dest, int $context = 3, bool $minimal = false): void { @@ -102,17 +102,17 @@ function xdiff_file_diff(string $old_file, string $new_file, string $dest, int $ /** * Patches a file with a binary - * patch and stores the result in a file dest. - * This function accepts patches created both via xdiff_file_bdiff + * patch and stores the result in a file dest. + * This function accepts patches created both via xdiff_file_bdiff * or xdiff_file_rabdiff functions or their string counterparts. - * + * * Starting with version 1.5.0 this function is an alias of xdiff_file_bpatch. - * + * * @param string $file The original file. * @param string $patch The binary patch file. * @param string $dest Path of the resulting file. * @throws XdiffException - * + * */ function xdiff_file_patch_binary(string $file, string $patch, string $dest): void { @@ -130,16 +130,16 @@ function xdiff_file_patch_binary(string $file, string $patch, string $dest): voi * algorithm used which should result in faster execution and smaller diff produced. * This function works with both text and binary files. Resulting patch * file can be later applied using xdiff_file_bpatch/xdiff_string_bpatch. - * - * For more details about differences between algorithm used please check libxdiff + * + * For more details about differences between algorithm used please check libxdiff * website. - * + * * @param string $old_file Path to the first file. This file acts as "old" file. * @param string $new_file Path to the second file. This file acts as "new" file. * @param string $dest Path of the resulting patch file. Resulting file contains differences * between "old" and "new" files. It is in binary format and is human-unreadable. * @throws XdiffException - * + * */ function xdiff_file_rabdiff(string $old_file, string $new_file, string $dest): void { @@ -153,14 +153,14 @@ function xdiff_file_rabdiff(string $old_file, string $new_file, string $dest): v /** * Patches a string str with a binary patch. - * This function accepts patches created both via xdiff_string_bdiff + * This function accepts patches created both via xdiff_string_bdiff * and xdiff_string_rabdiff functions or their file counterparts. - * + * * @param string $str The original binary string. * @param string $patch The binary patch string. * @return string Returns the patched string. * @throws XdiffException - * + * */ function xdiff_string_bpatch(string $str, string $patch): string { @@ -175,16 +175,16 @@ function xdiff_string_bpatch(string $str, string $patch): string /** * Patches a string str with a binary patch. - * This function accepts patches created both via xdiff_string_bdiff + * This function accepts patches created both via xdiff_string_bdiff * and xdiff_string_rabdiff functions or their file counterparts. - * + * * Starting with version 1.5.0 this function is an alias of xdiff_string_bpatch. - * + * * @param string $str The original binary string. * @param string $patch The binary patch string. * @return string Returns the patched string. * @throws XdiffException - * + * */ function xdiff_string_patch_binary(string $str, string $patch): string { @@ -198,26 +198,26 @@ function xdiff_string_patch_binary(string $str, string $patch): string /** - * Patches a str string with an unified patch in patch parameter - * and returns the result. patch has to be an unified diff created by - * xdiff_file_diff/xdiff_string_diff function. + * Patches a str string with an unified patch in patch parameter + * and returns the result. patch has to be an unified diff created by + * xdiff_file_diff/xdiff_string_diff function. * An optional flags parameter specifies mode of operation. Any - * rejected parts of the patch will be stored inside error variable if + * rejected parts of the patch will be stored inside error variable if * it is provided. - * + * * @param string $str The original string. - * @param string $patch The unified patch string. It has to be created using xdiff_string_diff, + * @param string $patch The unified patch string. It has to be created using xdiff_string_diff, * xdiff_file_diff functions or compatible tools. * @param int $flags flags can be either * XDIFF_PATCH_NORMAL (default mode, normal patch) * or XDIFF_PATCH_REVERSE (reversed patch). - * + * * Starting from version 1.5.0, you can also use binary OR to enable * XDIFF_PATCH_IGNORESPACE flag. * @param string|null $error If provided then rejected parts are stored inside this variable. * @return string Returns the patched string. * @throws XdiffException - * + * */ function xdiff_string_patch(string $str, string $patch, int $flags = null, ?string &$error = null): string { @@ -226,7 +226,7 @@ function xdiff_string_patch(string $str, string $patch, int $flags = null, ?stri $result = \xdiff_string_patch($str, $patch, $flags, $error); } elseif ($flags !== null) { $result = \xdiff_string_patch($str, $patch, $flags); - } else { + }else { $result = \xdiff_string_patch($str, $patch); } if ($result === false) { @@ -234,3 +234,5 @@ function xdiff_string_patch(string $str, string $patch, int $flags = null, ?stri } return $result; } + + diff --git a/generated/xml.php b/generated/xml.php index 4f9f6606..dc68ec05 100644 --- a/generated/xml.php +++ b/generated/xml.php @@ -6,32 +6,25 @@ /** * xml_parser_create_ns creates a new XML parser - * with XML namespace support and returns a resource handle referencing - * it to be used by the other XML functions. - * + * with XML namespace support and returns a XMLParser + * instance to be used by the other XML functions. + * * @param string $encoding The input encoding is automatically detected, so that the * encoding parameter specifies only the output - * encoding. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported + * encoding. The default output charset is UTF-8. The supported * encodings are ISO-8859-1, UTF-8 and * US-ASCII. * @param string $separator With a namespace aware parser tag parameters passed to the various * handler functions will consist of namespace and tag name separated by * the string specified in separator. - * @return resource Returns a resource handle for the new XML parser. + * @return resource Returns a new XMLParser instance. * @throws XmlException - * + * */ function xml_parser_create_ns(string $encoding = null, string $separator = ":") { error_clear_last(); - if ($separator !== ":") { - $result = \xml_parser_create_ns($encoding, $separator); - } elseif ($encoding !== null) { - $result = \xml_parser_create_ns($encoding); - } else { - $result = \xml_parser_create_ns(); - } + $result = \xml_parser_create_ns($encoding, $separator); if ($result === false) { throw XmlException::createFromPhpError(); } @@ -41,32 +34,25 @@ function xml_parser_create_ns(string $encoding = null, string $separator = ":") /** * xml_parser_create creates a new XML parser - * and returns a resource handle referencing it to be used by the + * and returns a XMLParser instance to be used by the * other XML functions. - * - * @param string $encoding The optional encoding specifies the character - * encoding for the input/output in PHP 4. Starting from PHP 5, the input + * + * @param string $encoding The input * encoding is automatically detected, so that the * encoding parameter specifies only the output - * encoding. In PHP 4, the default output encoding is the same as the - * input charset. If empty string is passed, the parser attempts to identify + * encoding. If empty string is passed, the parser attempts to identify * which encoding the document is encoded in by looking at the heading 3 or - * 4 bytes. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported + * 4 bytes. The default output charset is UTF-8. The supported * encodings are ISO-8859-1, UTF-8 and * US-ASCII. - * @return resource Returns a resource handle for the new XML parser. + * @return resource Returns a new XMLParser instance. * @throws XmlException - * + * */ function xml_parser_create(string $encoding = null) { error_clear_last(); - if ($encoding !== null) { - $result = \xml_parser_create($encoding); - } else { - $result = \xml_parser_create(); - } + $result = \xml_parser_create($encoding); if ($result === false) { throw XmlException::createFromPhpError(); } @@ -74,18 +60,35 @@ function xml_parser_create(string $encoding = null) } +/** + * Frees the given XML parser. + * + * @param resource $parser + * @throws XmlException + * + */ +function xml_parser_free( $parser): void +{ + error_clear_last(); + $result = \xml_parser_free($parser); + if ($result === false) { + throw XmlException::createFromPhpError(); + } +} + + /** * This function allows to use parser inside * object. All callback functions could be set with * xml_set_element_handler etc and assumed to be * methods of object. - * + * * @param resource $parser A reference to the XML parser to use inside the object. * @param object $object The object where to use the XML parser. * @throws XmlException - * + * */ -function xml_set_object($parser, object &$object): void +function xml_set_object( $parser, object $object): void { error_clear_last(); $result = \xml_set_object($parser, $object); @@ -93,3 +96,5 @@ function xml_set_object($parser, object &$object): void throw XmlException::createFromPhpError(); } } + + diff --git a/generated/xmlrpc.php b/generated/xmlrpc.php index 15364fb4..65c0a73b 100644 --- a/generated/xmlrpc.php +++ b/generated/xmlrpc.php @@ -6,13 +6,13 @@ /** * Sets xmlrpc type, base64 or datetime, for a PHP string value. - * + * * @param string|\DateTime $value Value to set the type * @param string $type 'base64' or 'datetime' * @throws XmlrpcException - * + * */ -function xmlrpc_set_type(&$value, string $type): void +function xmlrpc_set_type( &$value, string $type): void { error_clear_last(); $result = \xmlrpc_set_type($value, $type); @@ -20,3 +20,5 @@ function xmlrpc_set_type(&$value, string $type): void throw XmlrpcException::createFromPhpError(); } } + + diff --git a/generated/yaml.php b/generated/yaml.php index 38daaf75..7e5175de 100644 --- a/generated/yaml.php +++ b/generated/yaml.php @@ -6,7 +6,7 @@ /** * Convert all or part of a YAML document stream read from a file to a PHP variable. - * + * * @param string $filename Path to the file. * @param int $pos Document to extract from stream (-1 for all * documents, 0 for first document, ...). @@ -21,7 +21,7 @@ * array will be returned with one entry for each document found * in the stream. * @throws YamlException - * + * */ function yaml_parse_file(string $filename, int $pos = 0, ?int &$ndocs = null, array $callbacks = null) { @@ -36,7 +36,7 @@ function yaml_parse_file(string $filename, int $pos = 0, ?int &$ndocs = null, ar /** * Convert all or part of a YAML document stream read from a URL to a PHP variable. - * + * * @param string $url url should be of the form "scheme://...". PHP * will search for a protocol handler (also known as a wrapper) for that * scheme. If no wrappers for that protocol are registered, PHP will emit @@ -54,7 +54,7 @@ function yaml_parse_file(string $filename, int $pos = 0, ?int &$ndocs = null, ar * -1 an array will be returned with one entry * for each document found in the stream. * @throws YamlException - * + * */ function yaml_parse_url(string $url, int $pos = 0, ?int &$ndocs = null, array $callbacks = null) { @@ -69,7 +69,7 @@ function yaml_parse_url(string $url, int $pos = 0, ?int &$ndocs = null, array $c /** * Convert all or part of a YAML document stream to a PHP variable. - * + * * @param string $input The string to parse as a YAML document stream. * @param int $pos Document to extract from stream (-1 for all * documents, 0 for first document, ...). @@ -84,7 +84,7 @@ function yaml_parse_url(string $url, int $pos = 0, ?int &$ndocs = null, array $c * array will be returned with one entry for each document found * in the stream. * @throws YamlException - * + * */ function yaml_parse(string $input, int $pos = 0, ?int &$ndocs = null, array $callbacks = null) { @@ -95,3 +95,5 @@ function yaml_parse(string $input, int $pos = 0, ?int &$ndocs = null, array $cal } return $result; } + + diff --git a/generated/yaz.php b/generated/yaz.php index 29c1d33c..40905e25 100644 --- a/generated/yaz.php +++ b/generated/yaz.php @@ -6,48 +6,48 @@ /** * This function invokes a CCL parser. It converts a given CCL FIND query to - * an RPN query which may be passed to the yaz_search + * an RPN query which may be passed to the yaz_search * function to perform a search. - * - * To define a set of valid CCL fields call yaz_ccl_conf + * + * To define a set of valid CCL fields call yaz_ccl_conf * prior to this function. - * + * * @param resource $id The connection resource returned by yaz_connect. * @param string $query The CCL FIND query. - * @param array|null $result If the function was executed successfully, this will be an array + * @param array|null $result If the function was executed successfully, this will be an array * containing the valid RPN query under the key rpn. - * + * * Upon failure, three indexes are set in this array to indicate the cause - * of failure: - * - * - * + * of failure: + * + * + * * errorcode - the CCL error code (integer) - * - * - * - * + * + * + * + * * errorstring - the CCL error string - * - * - * - * + * + * + * + * * errorpos - approximate position in query of failure * (integer is character position) - * - * - * - * + * + * + * + * * errorcode - the CCL error code (integer) - * + * * errorstring - the CCL error string - * + * * errorpos - approximate position in query of failure * (integer is character position) * @throws YazException - * + * */ -function yaz_ccl_parse($id, string $query, ?array &$result): void +function yaz_ccl_parse( $id, string $query, ?array &$result): void { error_clear_last(); $result = \yaz_ccl_parse($id, $query, $result); @@ -59,12 +59,12 @@ function yaz_ccl_parse($id, string $query, ?array &$result): void /** * Closes the connection given by parameter id. - * + * * @param resource $id The connection resource returned by yaz_connect. * @throws YazException - * + * */ -function yaz_close($id): void +function yaz_close( $id): void { error_clear_last(); $result = \yaz_close($id); @@ -77,200 +77,200 @@ function yaz_close($id): void /** * This function returns a connection resource on success, zero on * failure. - * + * * yaz_connect prepares for a connection to a - * Z39.50 server. + * Z39.50 server. * This function is non-blocking and does not attempt to establish * a connection - it merely prepares a connect to be performed later when * yaz_wait is called. - * + * * @param string $zurl A string that takes the form host[:port][/database]. - * If port is omitted, port 210 is used. If database is omitted + * If port is omitted, port 210 is used. If database is omitted * Default is used. - * @param mixed $options If given as a string, it is treated as the Z39.50 V2 authentication + * @param mixed $options If given as a string, it is treated as the Z39.50 V2 authentication * string (OpenAuth). - * + * * If given as an array, the contents of the array serves as options. - * - * + * + * * user - * - * + * + * * Username for authentication. - * - * - * - * + * + * + * + * * group - * - * + * + * * Group for authentication. - * - * - * - * + * + * + * + * * password - * - * + * + * * Password for authentication. - * - * - * - * + * + * + * + * * cookie - * - * + * + * * Cookie for session (YAZ proxy). - * - * - * - * + * + * + * + * * proxy - * - * + * + * * Proxy for connection (YAZ proxy). - * - * - * - * + * + * + * + * * persistent - * - * + * + * * A boolean. If TRUE the connection is persistent; If FALSE the * connection is not persistent. By default connections are persistent. - * - * - * - * If you open a persistent connection, you won't be able to close + * + * + * + * If you open a persistent connection, you won't be able to close * it later with yaz_close. - * - * - * - * - * + * + * + * + * + * * piggyback - * - * + * + * * A boolean. If TRUE piggyback is enabled for searches; If FALSE * piggyback is disabled. By default piggyback is enabled. - * - * - * Enabling piggyback is more efficient and usually saves a - * network-round-trip for first time fetches of records. However, a + * + * + * Enabling piggyback is more efficient and usually saves a + * network-round-trip for first time fetches of records. However, a * few Z39.50 servers do not support piggyback or they ignore element * set names. For those, piggyback should be disabled. - * - * - * - * + * + * + * + * * charset - * - * - * A string that specifies character set to be used in Z39.50 + * + * + * A string that specifies character set to be used in Z39.50 * language and character set negotiation. Use strings such as: - * ISO-8859-1, UTF-8, + * ISO-8859-1, UTF-8, * UTF-16. - * - * + * + * * Most Z39.50 servers do not support this feature (and thus, this is * ignored). Many servers use the ISO-8859-1 encoding for queries and * messages. MARC21/USMARC records are not affected by this setting. - * - * - * - * - * + * + * + * + * + * * preferredMessageSize - * - * + * + * * An integer that specifies the maximum byte size of all records * to be returned by a target during retrieval. See the * Z39.50 standard for more * information. - * - * - * + * + * + * * This option is supported in PECL YAZ 1.0.5 or later. - * - * - * - * - * - * + * + * + * + * + * + * * maximumRecordSize - * - * + * + * * An integer that specifies the maximum byte size of a single record * to be returned by a target during retrieval. This * entity is referred to as Exceptional-record-size in the * Z39.50 standard. - * - * - * + * + * + * * This option is supported in PECL YAZ 1.0.5 or later. - * - * - * - * - * - * - * + * + * + * + * + * + * + * * Username for authentication. - * + * * Group for authentication. - * + * * Password for authentication. - * + * * Cookie for session (YAZ proxy). - * + * * Proxy for connection (YAZ proxy). - * + * * A boolean. If TRUE the connection is persistent; If FALSE the * connection is not persistent. By default connections are persistent. - * - * If you open a persistent connection, you won't be able to close + * + * If you open a persistent connection, you won't be able to close * it later with yaz_close. - * + * * A boolean. If TRUE piggyback is enabled for searches; If FALSE * piggyback is disabled. By default piggyback is enabled. - * - * Enabling piggyback is more efficient and usually saves a - * network-round-trip for first time fetches of records. However, a + * + * Enabling piggyback is more efficient and usually saves a + * network-round-trip for first time fetches of records. However, a * few Z39.50 servers do not support piggyback or they ignore element * set names. For those, piggyback should be disabled. - * - * A string that specifies character set to be used in Z39.50 + * + * A string that specifies character set to be used in Z39.50 * language and character set negotiation. Use strings such as: - * ISO-8859-1, UTF-8, + * ISO-8859-1, UTF-8, * UTF-16. - * + * * Most Z39.50 servers do not support this feature (and thus, this is * ignored). Many servers use the ISO-8859-1 encoding for queries and * messages. MARC21/USMARC records are not affected by this setting. - * + * * An integer that specifies the maximum byte size of all records * to be returned by a target during retrieval. See the * Z39.50 standard for more * information. - * + * * This option is supported in PECL YAZ 1.0.5 or later. - * + * * An integer that specifies the maximum byte size of a single record * to be returned by a target during retrieval. This * entity is referred to as Exceptional-record-size in the * Z39.50 standard. - * + * * This option is supported in PECL YAZ 1.0.5 or later. * @return mixed A connection resource on success, FALSE on error. * @throws YazException - * + * */ -function yaz_connect(string $zurl, $options = null) +function yaz_connect(string $zurl, $options = null) { error_clear_last(); if ($options !== null) { $result = \yaz_connect($zurl, $options); - } else { + }else { $result = \yaz_connect($zurl); } if ($result === false) { @@ -281,18 +281,18 @@ function yaz_connect(string $zurl, $options = null) /** - * This function allows you to change databases within a session by + * This function allows you to change databases within a session by * specifying one or more databases to be used in search, retrieval, etc. - * - overriding databases specified in call to + * - overriding databases specified in call to * yaz_connect. - * + * * @param resource $id The connection resource returned by yaz_connect. - * @param string $databases A string containing one or more databases. Multiple databases are + * @param string $databases A string containing one or more databases. Multiple databases are * separated by a plus sign +. * @throws YazException - * + * */ -function yaz_database($id, string $databases): void +function yaz_database( $id, string $databases): void { error_clear_last(); $result = \yaz_database($id, $databases); @@ -304,18 +304,18 @@ function yaz_database($id, string $databases): void /** * This function sets the element set name for retrieval. - * + * * Call this function before yaz_search or * yaz_present to specify the element set name for * records to be retrieved. - * + * * @param resource $id The connection resource returned by yaz_connect. * @param string $elementset Most servers support F (for full records) and * B (for brief records). * @throws YazException - * + * */ -function yaz_element($id, string $elementset): void +function yaz_element( $id, string $elementset): void { error_clear_last(); $result = \yaz_element($id, $elementset); @@ -327,15 +327,15 @@ function yaz_element($id, string $elementset): void /** * This function prepares for retrieval of records after a successful search. - * + * * The yaz_range function should be called prior to this * function to specify the range of records to be retrieved. - * + * * @param resource $id The connection resource returned by yaz_connect. * @throws YazException - * + * */ -function yaz_present($id): void +function yaz_present( $id): void { error_clear_last(); $result = \yaz_present($id); @@ -346,16 +346,16 @@ function yaz_present($id): void /** - * yaz_search prepares for a search on the given + * yaz_search prepares for a search on the given * connection. - * + * * Like yaz_connect this function is non-blocking and - * only prepares for a search to be executed later when + * only prepares for a search to be executed later when * yaz_wait is called. - * + * * @param resource $id The connection resource returned by yaz_connect. * @param string $type This parameter represents the query type - only "rpn" - * is supported now in which case the third argument specifies a Type-1 + * is supported now in which case the third argument specifies a Type-1 * query in prefix query notation. * @param string $query The RPN query is a textual representation of the Type-1 query as * defined by the Z39.50 standard. However, in the text representation @@ -364,18 +364,18 @@ function yaz_present($id): void * white space is ignored unless surrounded by double quotes. Tokens beginning * with an at-character (@) are considered operators, * otherwise they are treated as search terms. - * - * You can find information about attributes at the + * + * You can find information about attributes at the * Z39.50 Maintenance Agency * site. - * + * * If you would like to use a more friendly notation, - * use the CCL parser - functions yaz_ccl_conf and + * use the CCL parser - functions yaz_ccl_conf and * yaz_ccl_parse. * @throws YazException - * + * */ -function yaz_search($id, string $type, string $query): void +function yaz_search( $id, string $type, string $query): void { error_clear_last(); $result = \yaz_search($id, $type, $query); @@ -387,45 +387,45 @@ function yaz_search($id, string $type, string $query): void /** * This function carries out networked (blocked) activity for outstanding - * requests which have been prepared by the functions - * yaz_connect, yaz_search, - * yaz_present, yaz_scan and + * requests which have been prepared by the functions + * yaz_connect, yaz_search, + * yaz_present, yaz_scan and * yaz_itemorder. - * + * * yaz_wait returns when all servers have either * completed all requests or aborted (in case of errors). - * + * * @param array $options An associative array of options: - * - * + * + * * timeout - * - * + * + * * Sets timeout in seconds. If a server has not responded within the * timeout it is considered dead and yaz_wait * returns. The default value for timeout is 15 seconds. - * - * - * - * + * + * + * + * * event - * - * + * + * * A boolean. - * - * - * - * - * + * + * + * + * + * * Sets timeout in seconds. If a server has not responded within the * timeout it is considered dead and yaz_wait * returns. The default value for timeout is 15 seconds. - * + * * A boolean. * @return mixed Returns TRUE on success. * In event mode, returns resource. * @throws YazException - * + * */ function yaz_wait(array &$options = null) { @@ -436,3 +436,5 @@ function yaz_wait(array &$options = null) } return $result; } + + diff --git a/generated/zip.php b/generated/zip.php index 8fd22bb9..6e5f2130 100644 --- a/generated/zip.php +++ b/generated/zip.php @@ -6,12 +6,12 @@ /** * Closes the specified directory entry. - * + * * @param resource $zip_entry A directory entry previously opened zip_entry_open. * @throws ZipException - * + * */ -function zip_entry_close($zip_entry): void +function zip_entry_close( $zip_entry): void { error_clear_last(); $result = \zip_entry_close($zip_entry); @@ -21,28 +21,101 @@ function zip_entry_close($zip_entry): void } +/** + * Returns the compressed size of the specified directory entry. + * + * @param resource $zip_entry A directory entry returned by zip_read. + * @return int The compressed size. + * @throws ZipException + * + */ +function zip_entry_compressedsize( $zip_entry): int +{ + error_clear_last(); + $result = \zip_entry_compressedsize($zip_entry); + if ($result === false) { + throw ZipException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns the compression method of the directory entry specified + * by zip_entry. + * + * @param resource $zip_entry A directory entry returned by zip_read. + * @return string The compression method. + * @throws ZipException + * + */ +function zip_entry_compressionmethod( $zip_entry): string +{ + error_clear_last(); + $result = \zip_entry_compressionmethod($zip_entry); + if ($result === false) { + throw ZipException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns the actual size of the specified directory entry. + * + * @param resource $zip_entry A directory entry returned by zip_read. + * @return int The size of the directory entry. + * @throws ZipException + * + */ +function zip_entry_filesize( $zip_entry): int +{ + error_clear_last(); + $result = \zip_entry_filesize($zip_entry); + if ($result === false) { + throw ZipException::createFromPhpError(); + } + return $result; +} + + +/** + * Returns the name of the specified directory entry. + * + * @param resource $zip_entry A directory entry returned by zip_read. + * @return string The name of the directory entry. + * @throws ZipException + * + */ +function zip_entry_name( $zip_entry): string +{ + error_clear_last(); + $result = \zip_entry_name($zip_entry); + if ($result === false) { + throw ZipException::createFromPhpError(); + } + return $result; +} + + /** * Opens a directory entry in a zip file for reading. - * - * @param resource $zip A valid resource handle returned by zip_open. + * + * @param resource $zip_dp A valid resource handle returned by zip_open. * @param resource $zip_entry A directory entry returned by zip_read. * @param string $mode Any of the modes specified in the documentation of * fopen. - * + * * Currently, mode is ignored and is always * "rb". This is due to the fact that zip support * in PHP is read only access. * @throws ZipException - * + * */ -function zip_entry_open($zip, $zip_entry, string $mode = null): void +function zip_entry_open( $zip_dp, $zip_entry, string $mode = "rb"): void { error_clear_last(); - if ($mode !== null) { - $result = \zip_entry_open($zip, $zip_entry, $mode); - } else { - $result = \zip_entry_open($zip, $zip_entry); - } + $result = \zip_entry_open($zip_dp, $zip_entry, $mode); if ($result === false) { throw ZipException::createFromPhpError(); } @@ -51,21 +124,23 @@ function zip_entry_open($zip, $zip_entry, string $mode = null): void /** * Reads from an open directory entry. - * + * * @param resource $zip_entry A directory entry returned by zip_read. - * @param int $length The number of bytes to return. - * + * @param int $len The number of bytes to return. + * * This should be the uncompressed length you wish to read. * @return string Returns the data read, empty string on end of a file. * @throws ZipException - * + * */ -function zip_entry_read($zip_entry, int $length = 1024): string +function zip_entry_read( $zip_entry, int $len = 1024): string { error_clear_last(); - $result = \zip_entry_read($zip_entry, $length); + $result = \zip_entry_read($zip_entry, $len); if ($result === false) { throw ZipException::createFromPhpError(); } return $result; } + + diff --git a/generated/zlib.php b/generated/zlib.php index 4dc3ca94..fbe03678 100644 --- a/generated/zlib.php +++ b/generated/zlib.php @@ -6,7 +6,7 @@ /** * Incrementally deflates data in the specified context. - * + * * @param resource $context A context created with deflate_init. * @param string $data A chunk of data to compress. * @param int $flush_mode One of ZLIB_BLOCK, @@ -20,9 +20,9 @@ * detailed description of these constants. * @return string Returns a chunk of compressed data. * @throws ZlibException - * + * */ -function deflate_add($context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string +function deflate_add( $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string { error_clear_last(); $result = \deflate_add($context, $data, $flush_mode); @@ -36,86 +36,94 @@ function deflate_add($context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): /** * Initializes an incremental deflate context using the specified * encoding. - * + * * Note that the window option here only sets the window size * of the algorithm, differently from the zlib filters where the same parameter * also sets the encoding to use; the encoding must be set with the * encoding parameter. - * + * * Limitation: there is currently no way to set the header information on a GZIP * compressed stream, which are set as follows: GZIP signature * (\x1f\x8B); compression method (\x08 * == DEFLATE); 6 zero bytes; the operating system set to the current system * (\x00 = Windows, \x03 = Unix, etc.) - * + * * @param int $encoding One of the ZLIB_ENCODING_* constants. * @param array $options An associative array which may contain the following elements: - * - * + * + * * level - * - * + * + * * The compression level in range -1..9; defaults to -1. - * - * - * - * + * + * + * + * * memory - * - * + * + * * The compression memory level in range 1..9; defaults to 8. - * - * - * - * + * + * + * + * * window - * - * - * The zlib window size (logarithmic) in range 8..15; defaults to 15. - * - * - * - * + * + * + * The zlib window size (logarithmic) in range 8..15; + * defaults to 15. + * zlib changes a window size of 8 to 9, + * and as of zlib 1.2.8 fails with a warning, if a window size of 8 + * is requested for ZLIB_ENCODING_RAW or ZLIB_ENCODING_GZIP. + * + * + * + * * strategy - * - * + * + * * One of ZLIB_FILTERED, * ZLIB_HUFFMAN_ONLY, ZLIB_RLE, * ZLIB_FIXED or * ZLIB_DEFAULT_STRATEGY (the default). - * - * - * - * + * + * + * + * * dictionary - * - * + * + * * A string or an array of strings * of the preset dictionary (default: no preset dictionary). - * - * - * - * - * + * + * + * + * + * * The compression level in range -1..9; defaults to -1. - * + * * The compression memory level in range 1..9; defaults to 8. - * - * The zlib window size (logarithmic) in range 8..15; defaults to 15. - * + * + * The zlib window size (logarithmic) in range 8..15; + * defaults to 15. + * zlib changes a window size of 8 to 9, + * and as of zlib 1.2.8 fails with a warning, if a window size of 8 + * is requested for ZLIB_ENCODING_RAW or ZLIB_ENCODING_GZIP. + * * One of ZLIB_FILTERED, * ZLIB_HUFFMAN_ONLY, ZLIB_RLE, * ZLIB_FIXED or * ZLIB_DEFAULT_STRATEGY (the default). - * + * * A string or an array of strings * of the preset dictionary (default: no preset dictionary). * @return resource Returns a deflate context resource (zlib.deflate) on * success. * @throws ZlibException - * + * */ -function deflate_init(int $encoding, array $options = null) +function deflate_init(int $encoding, array $options = []) { error_clear_last(); $result = \deflate_init($encoding, $options); @@ -128,16 +136,16 @@ function deflate_init(int $encoding, array $options = null) /** * Closes the given gz-file pointer. - * - * @param resource $zp The gz-file pointer. It must be valid, and must point to a file + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. * @throws ZlibException - * + * */ -function gzclose($zp): void +function gzclose( $stream): void { error_clear_last(); - $result = \gzclose($zp); + $result = \gzclose($stream); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -147,20 +155,20 @@ function gzclose($zp): void /** * This function compresses the given string using the ZLIB * data format. - * + * * For details on the ZLIB compression algorithm see the document * "ZLIB Compressed Data Format * Specification version 3.3" (RFC 1950). - * + * * @param string $data The data to compress. * @param int $level The level of compression. Can be given as 0 for no compression up to 9 * for maximum compression. - * + * * If -1 is used, the default compression of the zlib library is used which is 6. * @param int $encoding One of ZLIB_ENCODING_* constants. * @return string The compressed string. * @throws ZlibException - * + * */ function gzcompress(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE): string { @@ -176,21 +184,17 @@ function gzcompress(string $data, int $level = -1, int $encoding = ZLIB_ENCODING /** * This function returns a decoded version of the input * data. - * + * * @param string $data The data to decode, encoded by gzencode. - * @param int $length The maximum length of data to decode. - * @return string The decoded string. + * @param int $max_length The maximum length of data to decode. + * @return string The decoded string, or. * @throws ZlibException - * + * */ -function gzdecode(string $data, int $length = null): string +function gzdecode(string $data, int $max_length = 0): string { error_clear_last(); - if ($length !== null) { - $result = \gzdecode($data, $length); - } else { - $result = \gzdecode($data); - } + $result = \gzdecode($data, $max_length); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -201,11 +205,11 @@ function gzdecode(string $data, int $length = null): string /** * This function compresses the given string using the DEFLATE * data format. - * + * * For details on the DEFLATE compression algorithm see the document * "DEFLATE Compressed Data Format * Specification version 1.3" (RFC 1951). - * + * * @param string $data The data to deflate. * @param int $level The level of compression. Can be given as 0 for no compression up to 9 * for maximum compression. If not given, the default compression level will @@ -213,7 +217,7 @@ function gzdecode(string $data, int $length = null): string * @param int $encoding One of ZLIB_ENCODING_* constants. * @return string The deflated string. * @throws ZlibException - * + * */ function gzdeflate(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_RAW): string { @@ -230,33 +234,51 @@ function gzdeflate(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_ * This function returns a compressed version of the input * data compatible with the output of the * gzip program. - * + * * For more information on the GZIP file format, see the document: * GZIP file format specification * version 4.3 (RFC 1952). - * + * * @param string $data The data to encode. * @param int $level The level of compression. Can be given as 0 for no compression up to 9 * for maximum compression. If not given, the default compression level will * be the default compression level of the zlib library. - * @param int $encoding_mode The encoding mode. Can be FORCE_GZIP (the default) + * @param int $encoding The encoding mode. Can be FORCE_GZIP (the default) * or FORCE_DEFLATE. - * - * Prior to PHP 5.4.0, using FORCE_DEFLATE results in - * a standard zlib deflated string (inclusive zlib headers) after a gzip - * file header but without the trailing crc32 checksum. - * - * In PHP 5.4.0 and later, FORCE_DEFLATE generates + * + * FORCE_DEFLATE generates * RFC 1950 compliant output, consisting of a zlib header, the deflated * data, and an Adler checksum. * @return string The encoded string. * @throws ZlibException - * + * + */ +function gzencode(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_GZIP): string +{ + error_clear_last(); + $result = \gzencode($data, $level, $encoding); + if ($result === false) { + throw ZlibException::createFromPhpError(); + } + return $result; +} + + +/** + * This function is identical to readgzfile, except that + * it returns the file in an array. + * + * @param string $filename The file name. + * @param int $use_include_path You can set this optional parameter to 1, if you + * want to search for the file in the include_path too. + * @return array An array containing the file, one line per cell, empty lines included, and with newlines still attached. + * @throws ZlibException + * */ -function gzencode(string $data, int $level = -1, int $encoding_mode = FORCE_GZIP): string +function gzfile(string $filename, int $use_include_path = 0): array { error_clear_last(); - $result = \gzencode($data, $level, $encoding_mode); + $result = \gzfile($filename, $use_include_path); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -266,24 +288,20 @@ function gzencode(string $data, int $level = -1, int $encoding_mode = FORCE_GZIP /** * Gets a (uncompressed) string of up to length - 1 bytes read from the given - * file pointer. Reading ends when length - 1 bytes have been read, on a + * file pointer. Reading ends when length - 1 bytes have been read, on a * newline, or on EOF (whichever comes first). - * - * @param resource $zp The gz-file pointer. It must be valid, and must point to a file + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. * @param int $length The length of data to get. * @return string The uncompressed string. * @throws ZlibException - * + * */ -function gzgets($zp, int $length = null): string +function gzgets( $stream, int $length = null): string { error_clear_last(); - if ($length !== null) { - $result = \gzgets($zp, $length); - } else { - $result = \gzgets($zp); - } + $result = \gzgets($stream, $length); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -295,22 +313,22 @@ function gzgets($zp, int $length = null): string * Identical to gzgets, except that * gzgetss attempts to strip any HTML and PHP * tags from the text it reads. - * + * * @param resource $zp The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. * @param int $length The length of data to get. - * @param string $allowable_tags You can use this optional parameter to specify tags which should not + * @param string $allowable_tags You can use this optional parameter to specify tags which should not * be stripped. * @return string The uncompressed and stripped string. * @throws ZlibException - * + * */ -function gzgetss($zp, int $length, string $allowable_tags = null): string +function gzgetss( $zp, int $length, string $allowable_tags = null): string { error_clear_last(); if ($allowable_tags !== null) { $result = \gzgetss($zp, $length, $allowable_tags); - } else { + }else { $result = \gzgetss($zp, $length); } if ($result === false) { @@ -322,21 +340,21 @@ function gzgetss($zp, int $length, string $allowable_tags = null): string /** * This function inflates a deflated string. - * + * * @param string $data The data compressed by gzdeflate. - * @param int $length The maximum length of data to decode. + * @param int $max_length The maximum length of decoded data. * @return string The original uncompressed data. - * + * * The function will return an error if the uncompressed data is more than - * 32768 times the length of the compressed input data - * or more than the optional parameter length. + * 32768 times the length of the compressed input data + * or, unless max_length is 0, more than the optional parameter max_length. * @throws ZlibException - * + * */ -function gzinflate(string $data, int $length = 0): string +function gzinflate(string $data, int $max_length = 0): string { error_clear_last(); - $result = \gzinflate($data, $length); + $result = \gzinflate($data, $max_length); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -347,18 +365,18 @@ function gzinflate(string $data, int $length = 0): string /** * Reads to EOF on the given gz-file pointer from the current position and * writes the (uncompressed) results to standard output. - * - * @param resource $zp The gz-file pointer. It must be valid, and must point to a file + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. * @return int The number of uncompressed characters read from gz * and passed through to the input. * @throws ZlibException - * + * */ -function gzpassthru($zp): int +function gzpassthru( $stream): int { error_clear_last(); - $result = \gzpassthru($zp); + $result = \gzpassthru($stream); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -367,18 +385,42 @@ function gzpassthru($zp): int /** - * Sets the file position indicator of the given gz-file pointer to the + * gzread reads up to length bytes + * from the given gz-file pointer. Reading stops when + * length (uncompressed) bytes have been read + * or EOF is reached, whichever comes first. + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file + * successfully opened by gzopen. + * @param int $length The number of bytes to read. + * @return string The data that have been read. + * @throws ZlibException + * + */ +function gzread( $stream, int $length): string +{ + error_clear_last(); + $result = \gzread($stream, $length); + if ($result === false) { + throw ZlibException::createFromPhpError(); + } + return $result; +} + + +/** + * Sets the file position indicator of the given gz-file pointer to the * beginning of the file stream. - * - * @param resource $zp The gz-file pointer. It must be valid, and must point to a file + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. * @throws ZlibException - * + * */ -function gzrewind($zp): void +function gzrewind( $stream): void { error_clear_last(); - $result = \gzrewind($zp); + $result = \gzrewind($stream); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -387,21 +429,21 @@ function gzrewind($zp): void /** * This function uncompress a compressed string. - * + * * @param string $data The data compressed by gzcompress. - * @param int $length The maximum length of data to decode. + * @param int $max_length The maximum length of data to decode. * @return string The original uncompressed data. - * + * * The function will return an error if the uncompressed data is more than - * 32768 times the length of the compressed input data - * or more than the optional parameter length. + * 32768 times the length of the compressed input data + * or more than the optional parameter max_length. * @throws ZlibException - * + * */ -function gzuncompress(string $data, int $length = 0): string +function gzuncompress(string $data, int $max_length = 0): string { error_clear_last(); - $result = \gzuncompress($data, $length); + $result = \gzuncompress($data, $max_length); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -410,17 +452,44 @@ function gzuncompress(string $data, int $length = 0): string /** - * - * - * @param resource $resource + * gzwrite writes the contents of + * data to the given gz-file. + * + * @param resource $stream The gz-file pointer. It must be valid, and must point to a file + * successfully opened by gzopen. + * @param string $data The string to write. + * @param int $length The number of uncompressed bytes to write. If supplied, writing will + * stop after length (uncompressed) bytes have been + * written or the end of data is reached, + * whichever comes first. + * @return int Returns the number of (uncompressed) bytes written to the given gz-file + * stream. + * @throws ZlibException + * + */ +function gzwrite( $stream, string $data, int $length = null): int +{ + error_clear_last(); + $result = \gzwrite($stream, $data, $length); + if ($result === false) { + throw ZlibException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param \InflateContext $context * @return int Returns number of bytes read so far. * @throws ZlibException - * + * */ -function inflate_get_read_len($resource): int +function inflate_get_read_len(\InflateContext $context): int { error_clear_last(); - $result = \inflate_get_read_len($resource); + $result = \inflate_get_read_len($context); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -430,16 +499,16 @@ function inflate_get_read_len($resource): int /** * Usually returns either ZLIB_OK or ZLIB_STREAM_END. - * - * @param resource $resource + * + * @param \InflateContext $context * @return int Returns decompression status. * @throws ZlibException - * + * */ -function inflate_get_status($resource): int +function inflate_get_status(\InflateContext $context): int { error_clear_last(); - $result = \inflate_get_status($resource); + $result = \inflate_get_status($context); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -449,12 +518,12 @@ function inflate_get_status($resource): int /** * Incrementally inflates encoded data in the specified context. - * + * * Limitation: header information from GZIP compressed data are not made * available. - * + * * @param resource $context A context created with inflate_init. - * @param string $encoded_data A chunk of compressed data. + * @param string $data A chunk of compressed data. * @param int $flush_mode One of ZLIB_BLOCK, * ZLIB_NO_FLUSH, * ZLIB_PARTIAL_FLUSH, @@ -466,12 +535,12 @@ function inflate_get_status($resource): int * detailed description of these constants. * @return string Returns a chunk of uncompressed data. * @throws ZlibException - * + * */ -function inflate_add($context, string $encoded_data, int $flush_mode = ZLIB_SYNC_FLUSH): string +function inflate_add( $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string { error_clear_last(); - $result = \inflate_add($context, $encoded_data, $flush_mode); + $result = \inflate_add($context, $data, $flush_mode); if ($result === false) { throw ZlibException::createFromPhpError(); } @@ -482,75 +551,75 @@ function inflate_add($context, string $encoded_data, int $flush_mode = ZLIB_SYNC /** * Initialize an incremental inflate context with the specified * encoding. - * + * * @param int $encoding One of the ZLIB_ENCODING_* constants. * @param array $options An associative array which may contain the following elements: - * - * + * + * * level - * - * + * + * * The compression level in range -1..9; defaults to -1. - * - * - * - * + * + * + * + * * memory - * - * + * + * * The compression memory level in range 1..9; defaults to 8. - * - * - * - * + * + * + * + * * window - * - * + * + * * The zlib window size (logarithmic) in range 8..15; defaults to 15. - * - * - * - * + * + * + * + * * strategy - * - * + * + * * One of ZLIB_FILTERED, * ZLIB_HUFFMAN_ONLY, ZLIB_RLE, * ZLIB_FIXED or * ZLIB_DEFAULT_STRATEGY (the default). - * - * - * - * + * + * + * + * * dictionary - * - * + * + * * A string or an array of strings * of the preset dictionary (default: no preset dictionary). - * - * - * - * - * + * + * + * + * + * * The compression level in range -1..9; defaults to -1. - * + * * The compression memory level in range 1..9; defaults to 8. - * + * * The zlib window size (logarithmic) in range 8..15; defaults to 15. - * + * * One of ZLIB_FILTERED, * ZLIB_HUFFMAN_ONLY, ZLIB_RLE, * ZLIB_FIXED or * ZLIB_DEFAULT_STRATEGY (the default). - * + * * A string or an array of strings * of the preset dictionary (default: no preset dictionary). * @return resource Returns an inflate context resource (zlib.inflate) on * success. * @throws ZlibException - * + * */ -function inflate_init(int $encoding, array $options = null) +function inflate_init(int $encoding, array $options = []) { error_clear_last(); $result = \inflate_init($encoding, $options); @@ -563,18 +632,18 @@ function inflate_init(int $encoding, array $options = null) /** * Reads a file, decompresses it and writes it to standard output. - * + * * readgzfile can be used to read a file which is not in - * gzip format; in this case readgzfile will directly + * gzip format; in this case readgzfile will directly * read from the file without decompression. - * + * * @param string $filename The file name. This file will be opened from the filesystem and its * contents written to standard output. * @param int $use_include_path You can set this optional parameter to 1, if you * want to search for the file in the include_path too. * @return int Returns the number of (uncompressed) bytes read from the file on success * @throws ZlibException - * + * */ function readgzfile(string $filename, int $use_include_path = 0): int { @@ -589,23 +658,21 @@ function readgzfile(string $filename, int $use_include_path = 0): int /** * Uncompress any raw/gzip/zlib encoded data. - * - * @param string $data - * @param int $max_decoded_len + * + * @param string $data + * @param int $max_length * @return string Returns the uncompressed data. * @throws ZlibException - * + * */ -function zlib_decode(string $data, int $max_decoded_len = null): string +function zlib_decode(string $data, int $max_length = 0): string { error_clear_last(); - if ($max_decoded_len !== null) { - $result = \zlib_decode($data, $max_decoded_len); - } else { - $result = \zlib_decode($data); - } + $result = \zlib_decode($data, $max_length); if ($result === false) { throw ZlibException::createFromPhpError(); } return $result; } + + diff --git a/rector-migrate-0.7.php b/rector-migrate-0.7.php index d1c59970..5dde3116 100644 --- a/rector-migrate-0.7.php +++ b/rector-migrate-0.7.php @@ -13,8 +13,8 @@ ->call('configure', [[ RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [ 'apache_getenv' => 'Safe\apache_getenv', 'apache_get_version' => 'Safe\apache_get_version', + 'apache_lookup_uri' => 'Safe\apache_lookup_uri', 'apache_request_headers' => 'Safe\apache_request_headers', - 'apache_reset_timeout' => 'Safe\apache_reset_timeout', 'apache_response_headers' => 'Safe\apache_response_headers', 'apache_setenv' => 'Safe\apache_setenv', 'apcu_cache_info' => 'Safe\apcu_cache_info', @@ -24,14 +24,11 @@ 'apcu_inc' => 'Safe\apcu_inc', 'apcu_sma_info' => 'Safe\apcu_sma_info', 'apc_fetch' => 'Safe\apc_fetch', - 'array_combine' => 'Safe\array_combine', - 'array_flip' => 'Safe\array_flip', 'array_replace' => 'Safe\array_replace', 'array_replace_recursive' => 'Safe\array_replace_recursive', 'array_walk_recursive' => 'Safe\array_walk_recursive', - 'arsort' => 'Safe\arsort', - 'asort' => 'Safe\asort', 'base64_decode' => 'Safe\base64_decode', + 'bindtextdomain' => 'Safe\bindtextdomain', 'bzclose' => 'Safe\bzclose', 'bzflush' => 'Safe\bzflush', 'bzread' => 'Safe\bzread', @@ -42,30 +39,71 @@ 'chown' => 'Safe\chown', 'chroot' => 'Safe\chroot', 'class_alias' => 'Safe\class_alias', - 'class_implements' => 'Safe\class_implements', - 'class_parents' => 'Safe\class_parents', - 'class_uses' => 'Safe\class_uses', 'cli_set_process_title' => 'Safe\cli_set_process_title', 'closelog' => 'Safe\closelog', + 'com_create_guid' => 'Safe\com_create_guid', 'com_event_sink' => 'Safe\com_event_sink', 'com_load_typelib' => 'Safe\com_load_typelib', 'com_print_typeinfo' => 'Safe\com_print_typeinfo', 'convert_uudecode' => 'Safe\convert_uudecode', - 'convert_uuencode' => 'Safe\convert_uuencode', 'copy' => 'Safe\copy', + 'count_chars' => 'Safe\count_chars', 'create_function' => 'Safe\create_function', + 'cubrid_bind' => 'Safe\cubrid_bind', + 'cubrid_column_names' => 'Safe\cubrid_column_names', + 'cubrid_column_types' => 'Safe\cubrid_column_types', + 'cubrid_col_size' => 'Safe\cubrid_col_size', + 'cubrid_commit' => 'Safe\cubrid_commit', + 'cubrid_connect' => 'Safe\cubrid_connect', + 'cubrid_connect_with_url' => 'Safe\cubrid_connect_with_url', + 'cubrid_current_oid' => 'Safe\cubrid_current_oid', + 'cubrid_disconnect' => 'Safe\cubrid_disconnect', + 'cubrid_drop' => 'Safe\cubrid_drop', 'cubrid_free_result' => 'Safe\cubrid_free_result', 'cubrid_get_charset' => 'Safe\cubrid_get_charset', + 'cubrid_get_class_name' => 'Safe\cubrid_get_class_name', 'cubrid_get_client_info' => 'Safe\cubrid_get_client_info', 'cubrid_get_db_parameter' => 'Safe\cubrid_get_db_parameter', + 'cubrid_get_query_timeout' => 'Safe\cubrid_get_query_timeout', 'cubrid_get_server_info' => 'Safe\cubrid_get_server_info', 'cubrid_insert_id' => 'Safe\cubrid_insert_id', + 'cubrid_lob2_bind' => 'Safe\cubrid_lob2_bind', + 'cubrid_lob2_close' => 'Safe\cubrid_lob2_close', + 'cubrid_lob2_export' => 'Safe\cubrid_lob2_export', + 'cubrid_lob2_import' => 'Safe\cubrid_lob2_import', 'cubrid_lob2_new' => 'Safe\cubrid_lob2_new', + 'cubrid_lob2_read' => 'Safe\cubrid_lob2_read', + 'cubrid_lob2_seek' => 'Safe\cubrid_lob2_seek', + 'cubrid_lob2_seek64' => 'Safe\cubrid_lob2_seek64', 'cubrid_lob2_size' => 'Safe\cubrid_lob2_size', 'cubrid_lob2_size64' => 'Safe\cubrid_lob2_size64', 'cubrid_lob2_tell' => 'Safe\cubrid_lob2_tell', 'cubrid_lob2_tell64' => 'Safe\cubrid_lob2_tell64', + 'cubrid_lob2_write' => 'Safe\cubrid_lob2_write', + 'cubrid_lob_close' => 'Safe\cubrid_lob_close', + 'cubrid_lob_export' => 'Safe\cubrid_lob_export', + 'cubrid_lob_get' => 'Safe\cubrid_lob_get', + 'cubrid_lob_send' => 'Safe\cubrid_lob_send', + 'cubrid_lob_size' => 'Safe\cubrid_lob_size', + 'cubrid_lock_read' => 'Safe\cubrid_lock_read', + 'cubrid_lock_write' => 'Safe\cubrid_lock_write', + 'cubrid_move_cursor' => 'Safe\cubrid_move_cursor', + 'cubrid_next_result' => 'Safe\cubrid_next_result', + 'cubrid_pconnect' => 'Safe\cubrid_pconnect', + 'cubrid_pconnect_with_url' => 'Safe\cubrid_pconnect_with_url', + 'cubrid_prepare' => 'Safe\cubrid_prepare', + 'cubrid_put' => 'Safe\cubrid_put', + 'cubrid_rollback' => 'Safe\cubrid_rollback', + 'cubrid_schema' => 'Safe\cubrid_schema', + 'cubrid_seq_drop' => 'Safe\cubrid_seq_drop', + 'cubrid_seq_insert' => 'Safe\cubrid_seq_insert', + 'cubrid_seq_put' => 'Safe\cubrid_seq_put', + 'cubrid_set_add' => 'Safe\cubrid_set_add', + 'cubrid_set_autocommit' => 'Safe\cubrid_set_autocommit', 'cubrid_set_db_parameter' => 'Safe\cubrid_set_db_parameter', + 'cubrid_set_drop' => 'Safe\cubrid_set_drop', + 'cubrid_set_query_timeout' => 'Safe\cubrid_set_query_timeout', + 'curl_copy_handle' => 'Safe\curl_copy_handle', 'curl_escape' => 'Safe\curl_escape', 'curl_exec' => 'Safe\curl_exec', 'curl_getinfo' => 'Safe\curl_getinfo', @@ -77,7 +115,6 @@ 'curl_share_errno' => 'Safe\curl_share_errno', 'curl_share_setopt' => 'Safe\curl_share_setopt', 'curl_unescape' => 'Safe\curl_unescape', - 'date' => 'Safe\date', 'date_parse' => 'Safe\date_parse', 'date_parse_from_format' => 'Safe\date_parse_from_format', 'date_sunrise' => 'Safe\date_sunrise', @@ -103,6 +140,7 @@ 'disk_total_space' => 'Safe\disk_total_space', 'dl' => 'Safe\dl', 'dns_get_record' => 'Safe\dns_get_record', + 'dom_import_simplexml' => 'Safe\dom_import_simplexml', 'eio_busy' => 'Safe\eio_busy', 'eio_chmod' => 'Safe\eio_chmod', 'eio_chown' => 'Safe\eio_chown', @@ -112,6 +150,7 @@ 'eio_event_loop' => 'Safe\eio_event_loop', 'eio_fallocate' => 'Safe\eio_fallocate', 'eio_fchmod' => 'Safe\eio_fchmod', + 'eio_fchown' => 'Safe\eio_fchown', 'eio_fdatasync' => 'Safe\eio_fdatasync', 'eio_fstat' => 'Safe\eio_fstat', 'eio_fstatvfs' => 'Safe\eio_fstatvfs', @@ -141,16 +180,20 @@ 'eio_utime' => 'Safe\eio_utime', 'eio_write' => 'Safe\eio_write', 'error_log' => 'Safe\error_log', + 'exec' => 'Safe\exec', 'fastcgi_finish_request' => 'Safe\fastcgi_finish_request', 'fbird_blob_cancel' => 'Safe\fbird_blob_cancel', 'fclose' => 'Safe\fclose', + 'fdatasync' => 'Safe\fdatasync', 'fflush' => 'Safe\fflush', + 'fgetcsv' => 'Safe\fgetcsv', 'file' => 'Safe\file', 'fileatime' => 'Safe\fileatime', 'filectime' => 'Safe\filectime', 'fileinode' => 'Safe\fileinode', 'filemtime' => 'Safe\filemtime', 'fileowner' => 'Safe\fileowner', + 'fileperms' => 'Safe\fileperms', 'filesize' => 'Safe\filesize', 'file_get_contents' => 'Safe\file_get_contents', 'file_put_contents' => 'Safe\file_put_contents', @@ -163,6 +206,8 @@ 'fputcsv' => 'Safe\fputcsv', 'fread' => 'Safe\fread', 'fsockopen' => 'Safe\fsockopen', + 'fstat' => 'Safe\fstat', + 'fsync' => 'Safe\fsync', 'ftp_alloc' => 'Safe\ftp_alloc', 'ftp_append' => 'Safe\ftp_append', 'ftp_cdup' => 'Safe\ftp_cdup', @@ -177,10 +222,12 @@ 'ftp_login' => 'Safe\ftp_login', 'ftp_mkdir' => 'Safe\ftp_mkdir', 'ftp_mlsd' => 'Safe\ftp_mlsd', + 'ftp_nb_put' => 'Safe\ftp_nb_put', 'ftp_nlist' => 'Safe\ftp_nlist', 'ftp_pasv' => 'Safe\ftp_pasv', 'ftp_put' => 'Safe\ftp_put', 'ftp_pwd' => 'Safe\ftp_pwd', + 'ftp_raw' => 'Safe\ftp_raw', 'ftp_rename' => 'Safe\ftp_rename', 'ftp_rmdir' => 'Safe\ftp_rmdir', 'ftp_site' => 'Safe\ftp_site', @@ -200,19 +247,25 @@ 'getopt' => 'Safe\getopt', 'getprotobyname' => 'Safe\getprotobyname', 'getprotobynumber' => 'Safe\getprotobynumber', + 'getrusage' => 'Safe\getrusage', + 'getservbyport' => 'Safe\getservbyport', 'get_headers' => 'Safe\get_headers', + 'get_include_path' => 'Safe\get_include_path', + 'get_meta_tags' => 'Safe\get_meta_tags', 'glob' => 'Safe\glob', - 'gmdate' => 'Safe\gmdate', + 'gmmktime' => 'Safe\gmmktime', 'gmp_binomial' => 'Safe\gmp_binomial', 'gmp_export' => 'Safe\gmp_export', 'gmp_import' => 'Safe\gmp_import', 'gmp_random_seed' => 'Safe\gmp_random_seed', + 'gmstrftime' => 'Safe\gmstrftime', 'gnupg_adddecryptkey' => 'Safe\gnupg_adddecryptkey', 'gnupg_addencryptkey' => 'Safe\gnupg_addencryptkey', 'gnupg_addsignkey' => 'Safe\gnupg_addsignkey', 'gnupg_cleardecryptkeys' => 'Safe\gnupg_cleardecryptkeys', 'gnupg_clearencryptkeys' => 'Safe\gnupg_clearencryptkeys', 'gnupg_clearsignkeys' => 'Safe\gnupg_clearsignkeys', + 'gnupg_deletekey' => 'Safe\gnupg_deletekey', 'gnupg_setarmor' => 'Safe\gnupg_setarmor', 'gnupg_setsignmode' => 'Safe\gnupg_setsignmode', 'gzclose' => 'Safe\gzclose', @@ -220,18 +273,22 @@ 'gzdecode' => 'Safe\gzdecode', 'gzdeflate' => 'Safe\gzdeflate', 'gzencode' => 'Safe\gzencode', + 'gzfile' => 'Safe\gzfile', 'gzgets' => 'Safe\gzgets', 'gzgetss' => 'Safe\gzgetss', 'gzinflate' => 'Safe\gzinflate', 'gzpassthru' => 'Safe\gzpassthru', + 'gzread' => 'Safe\gzread', 'gzrewind' => 'Safe\gzrewind', 'gzuncompress' => 'Safe\gzuncompress', + 'gzwrite' => 'Safe\gzwrite', 'hash_hkdf' => 'Safe\hash_hkdf', 'hash_update_file' => 'Safe\hash_update_file', 'header_register_callback' => 'Safe\header_register_callback', 'hex2bin' => 'Safe\hex2bin', 'highlight_file' => 'Safe\highlight_file', 'highlight_string' => 'Safe\highlight_string', + 'hrtime' => 'Safe\hrtime', 'ibase_add_user' => 'Safe\ibase_add_user', 'ibase_backup' => 'Safe\ibase_backup', 'ibase_blob_cancel' => 'Safe\ibase_blob_cancel', @@ -258,6 +315,7 @@ 'iconv' => 'Safe\iconv', 'iconv_get_encoding' => 'Safe\iconv_get_encoding', 'iconv_set_encoding' => 'Safe\iconv_set_encoding', + 'idate' => 'Safe\idate', 'image2wbmp' => 'Safe\image2wbmp', 'imageaffine' => 'Safe\imageaffine', 'imageaffinematrixconcat' => 'Safe\imageaffinematrixconcat', @@ -265,12 +323,14 @@ 'imagealphablending' => 'Safe\imagealphablending', 'imageantialias' => 'Safe\imageantialias', 'imagearc' => 'Safe\imagearc', + 'imageavif' => 'Safe\imageavif', 'imagebmp' => 'Safe\imagebmp', 'imagechar' => 'Safe\imagechar', 'imagecharup' => 'Safe\imagecharup', 'imagecolorat' => 'Safe\imagecolorat', 'imagecolordeallocate' => 'Safe\imagecolordeallocate', 'imagecolormatch' => 'Safe\imagecolormatch', + 'imagecolorset' => 'Safe\imagecolorset', 'imageconvolution' => 'Safe\imageconvolution', 'imagecopy' => 'Safe\imagecopy', 'imagecopymerge' => 'Safe\imagecopymerge', @@ -278,6 +338,7 @@ 'imagecopyresampled' => 'Safe\imagecopyresampled', 'imagecopyresized' => 'Safe\imagecopyresized', 'imagecreate' => 'Safe\imagecreate', + 'imagecreatefromavif' => 'Safe\imagecreatefromavif', 'imagecreatefrombmp' => 'Safe\imagecreatefrombmp', 'imagecreatefromgd' => 'Safe\imagecreatefromgd', 'imagecreatefromgd2' => 'Safe\imagecreatefromgd2', @@ -285,6 +346,7 @@ 'imagecreatefromgif' => 'Safe\imagecreatefromgif', 'imagecreatefromjpeg' => 'Safe\imagecreatefromjpeg', 'imagecreatefrompng' => 'Safe\imagecreatefrompng', + 'imagecreatefromtga' => 'Safe\imagecreatefromtga', 'imagecreatefromwbmp' => 'Safe\imagecreatefromwbmp', 'imagecreatefromwebp' => 'Safe\imagecreatefromwebp', 'imagecreatefromxbm' => 'Safe\imagecreatefromxbm', @@ -298,11 +360,12 @@ 'imagefill' => 'Safe\imagefill', 'imagefilledarc' => 'Safe\imagefilledarc', 'imagefilledellipse' => 'Safe\imagefilledellipse', - 'imagefilledpolygon' => 'Safe\imagefilledpolygon', 'imagefilledrectangle' => 'Safe\imagefilledrectangle', 'imagefilltoborder' => 'Safe\imagefilltoborder', 'imagefilter' => 'Safe\imagefilter', 'imageflip' => 'Safe\imageflip', + 'imageftbbox' => 'Safe\imageftbbox', + 'imagefttext' => 'Safe\imagefttext', 'imagegammacorrect' => 'Safe\imagegammacorrect', 'imagegd' => 'Safe\imagegd', 'imagegd2' => 'Safe\imagegd2', @@ -313,10 +376,9 @@ 'imagelayereffect' => 'Safe\imagelayereffect', 'imageline' => 'Safe\imageline', 'imageloadfont' => 'Safe\imageloadfont', - 'imageopenpolygon' => 'Safe\imageopenpolygon', 'imagepng' => 'Safe\imagepng', - 'imagepolygon' => 'Safe\imagepolygon', 'imagerectangle' => 'Safe\imagerectangle', + 'imageresolution' => 'Safe\imageresolution', 'imagerotate' => 'Safe\imagerotate', 'imagesavealpha' => 'Safe\imagesavealpha', 'imagescale' => 'Safe\imagescale', @@ -337,29 +399,49 @@ 'imagewbmp' => 'Safe\imagewbmp', 'imagewebp' => 'Safe\imagewebp', 'imagexbm' => 'Safe\imagexbm', + 'image_type_to_extension' => 'Safe\image_type_to_extension', + 'imap_8bit' => 'Safe\imap_8bit', 'imap_append' => 'Safe\imap_append', + 'imap_base64' => 'Safe\imap_base64', + 'imap_binary' => 'Safe\imap_binary', + 'imap_body' => 'Safe\imap_body', + 'imap_bodystruct' => 'Safe\imap_bodystruct', 'imap_check' => 'Safe\imap_check', 'imap_clearflag_full' => 'Safe\imap_clearflag_full', 'imap_close' => 'Safe\imap_close', 'imap_createmailbox' => 'Safe\imap_createmailbox', 'imap_deletemailbox' => 'Safe\imap_deletemailbox', + 'imap_fetchbody' => 'Safe\imap_fetchbody', + 'imap_fetchheader' => 'Safe\imap_fetchheader', + 'imap_fetchmime' => 'Safe\imap_fetchmime', 'imap_fetchstructure' => 'Safe\imap_fetchstructure', + 'imap_fetch_overview' => 'Safe\imap_fetch_overview', 'imap_gc' => 'Safe\imap_gc', + 'imap_getacl' => 'Safe\imap_getacl', + 'imap_getmailboxes' => 'Safe\imap_getmailboxes', + 'imap_getsubscribed' => 'Safe\imap_getsubscribed', 'imap_headerinfo' => 'Safe\imap_headerinfo', + 'imap_headers' => 'Safe\imap_headers', + 'imap_listscan' => 'Safe\imap_listscan', + 'imap_lsub' => 'Safe\imap_lsub', 'imap_mail' => 'Safe\imap_mail', 'imap_mailboxmsginfo' => 'Safe\imap_mailboxmsginfo', 'imap_mail_compose' => 'Safe\imap_mail_compose', 'imap_mail_copy' => 'Safe\imap_mail_copy', 'imap_mail_move' => 'Safe\imap_mail_move', + 'imap_mime_header_decode' => 'Safe\imap_mime_header_decode', 'imap_mutf7_to_utf8' => 'Safe\imap_mutf7_to_utf8', 'imap_num_msg' => 'Safe\imap_num_msg', 'imap_open' => 'Safe\imap_open', + 'imap_qprint' => 'Safe\imap_qprint', 'imap_renamemailbox' => 'Safe\imap_renamemailbox', + 'imap_rfc822_write_address' => 'Safe\imap_rfc822_write_address', 'imap_savebody' => 'Safe\imap_savebody', 'imap_setacl' => 'Safe\imap_setacl', 'imap_setflag_full' => 'Safe\imap_setflag_full', 'imap_set_quota' => 'Safe\imap_set_quota', 'imap_sort' => 'Safe\imap_sort', + 'imap_status' => 'Safe\imap_status', 'imap_subscribe' => 'Safe\imap_subscribe', 'imap_thread' => 'Safe\imap_thread', 'imap_timeout' => 'Safe\imap_timeout', @@ -371,18 +453,6 @@ 'inflate_get_read_len' => 'Safe\inflate_get_read_len', 'inflate_get_status' => 'Safe\inflate_get_status', 'inflate_init' => 'Safe\inflate_init', - 'ingres_autocommit' => 'Safe\ingres_autocommit', - 'ingres_close' => 'Safe\ingres_close', - 'ingres_commit' => 'Safe\ingres_commit', - 'ingres_connect' => 'Safe\ingres_connect', - 'ingres_execute' => 'Safe\ingres_execute', - 'ingres_field_name' => 'Safe\ingres_field_name', - 'ingres_field_type' => 'Safe\ingres_field_type', - 'ingres_free_result' => 'Safe\ingres_free_result', - 'ingres_pconnect' => 'Safe\ingres_pconnect', - 'ingres_result_seek' => 'Safe\ingres_result_seek', - 'ingres_rollback' => 'Safe\ingres_rollback', - 'ingres_set_environment' => 'Safe\ingres_set_environment', 'ini_get' => 'Safe\ini_get', 'ini_set' => 'Safe\ini_set', 'inotify_init' => 'Safe\inotify_init', @@ -393,20 +463,16 @@ 'jpeg2wbmp' => 'Safe\jpeg2wbmp', 'json_decode' => 'Safe\json_decode', 'json_encode' => 'Safe\json_encode', - 'json_last_error_msg' => 'Safe\json_last_error_msg', - 'krsort' => 'Safe\krsort', - 'ksort' => 'Safe\ksort', 'lchgrp' => 'Safe\lchgrp', 'lchown' => 'Safe\lchown', + 'ldap_8859_to_t61' => 'Safe\ldap_8859_to_t61', 'ldap_add' => 'Safe\ldap_add', - 'ldap_add_ext' => 'Safe\ldap_add_ext', 'ldap_bind' => 'Safe\ldap_bind', - 'ldap_bind_ext' => 'Safe\ldap_bind_ext', 'ldap_control_paged_result' => 'Safe\ldap_control_paged_result', 'ldap_control_paged_result_response' => 'Safe\ldap_control_paged_result_response', 'ldap_count_entries' => 'Safe\ldap_count_entries', 'ldap_delete' => 'Safe\ldap_delete', - 'ldap_delete_ext' => 'Safe\ldap_delete_ext', + 'ldap_dn2ufn' => 'Safe\ldap_dn2ufn', 'ldap_exop' => 'Safe\ldap_exop', 'ldap_exop_passwd' => 'Safe\ldap_exop_passwd', 'ldap_exop_whoami' => 'Safe\ldap_exop_whoami', @@ -420,27 +486,21 @@ 'ldap_get_option' => 'Safe\ldap_get_option', 'ldap_get_values' => 'Safe\ldap_get_values', 'ldap_get_values_len' => 'Safe\ldap_get_values_len', - 'ldap_list' => 'Safe\ldap_list', 'ldap_modify_batch' => 'Safe\ldap_modify_batch', 'ldap_mod_add' => 'Safe\ldap_mod_add', - 'ldap_mod_add_ext' => 'Safe\ldap_mod_add_ext', 'ldap_mod_del' => 'Safe\ldap_mod_del', - 'ldap_mod_del_ext' => 'Safe\ldap_mod_del_ext', 'ldap_mod_replace' => 'Safe\ldap_mod_replace', - 'ldap_mod_replace_ext' => 'Safe\ldap_mod_replace_ext', 'ldap_next_attribute' => 'Safe\ldap_next_attribute', 'ldap_parse_exop' => 'Safe\ldap_parse_exop', 'ldap_parse_result' => 'Safe\ldap_parse_result', - 'ldap_read' => 'Safe\ldap_read', 'ldap_rename' => 'Safe\ldap_rename', - 'ldap_rename_ext' => 'Safe\ldap_rename_ext', 'ldap_sasl_bind' => 'Safe\ldap_sasl_bind', - 'ldap_search' => 'Safe\ldap_search', 'ldap_set_option' => 'Safe\ldap_set_option', 'ldap_unbind' => 'Safe\ldap_unbind', 'libxml_get_last_error' => 'Safe\libxml_get_last_error', - 'libxml_set_external_entity_loader' => 'Safe\libxml_set_external_entity_loader', 'link' => 'Safe\link', + 'long2ip' => 'Safe\long2ip', + 'lstat' => 'Safe\lstat', 'lzf_compress' => 'Safe\lzf_compress', 'lzf_decompress' => 'Safe\lzf_decompress', 'mailparse_msg_extract_part_file' => 'Safe\mailparse_msg_extract_part_file', @@ -449,6 +509,7 @@ 'mailparse_msg_parse_file' => 'Safe\mailparse_msg_parse_file', 'mailparse_stream_encode' => 'Safe\mailparse_stream_encode', 'mb_chr' => 'Safe\mb_chr', + 'mb_convert_encoding' => 'Safe\mb_convert_encoding', 'mb_detect_order' => 'Safe\mb_detect_order', 'mb_encoding_aliases' => 'Safe\mb_encoding_aliases', 'mb_eregi_replace' => 'Safe\mb_eregi_replace', @@ -458,6 +519,7 @@ 'mb_ereg_search_init' => 'Safe\mb_ereg_search_init', 'mb_ereg_search_regs' => 'Safe\mb_ereg_search_regs', 'mb_ereg_search_setpos' => 'Safe\mb_ereg_search_setpos', + 'mb_get_info' => 'Safe\mb_get_info', 'mb_http_output' => 'Safe\mb_http_output', 'mb_internal_encoding' => 'Safe\mb_internal_encoding', 'mb_ord' => 'Safe\mb_ord', @@ -471,36 +533,13 @@ 'mime_content_type' => 'Safe\mime_content_type', 'mkdir' => 'Safe\mkdir', 'mktime' => 'Safe\mktime', + 'msg_get_queue' => 'Safe\msg_get_queue', 'msg_queue_exists' => 'Safe\msg_queue_exists', 'msg_receive' => 'Safe\msg_receive', 'msg_remove_queue' => 'Safe\msg_remove_queue', 'msg_send' => 'Safe\msg_send', 'msg_set_queue' => 'Safe\msg_set_queue', - 'msql_affected_rows' => 'Safe\msql_affected_rows', - 'msql_close' => 'Safe\msql_close', - 'msql_connect' => 'Safe\msql_connect', - 'msql_create_db' => 'Safe\msql_create_db', - 'msql_data_seek' => 'Safe\msql_data_seek', - 'msql_db_query' => 'Safe\msql_db_query', - 'msql_drop_db' => 'Safe\msql_drop_db', - 'msql_field_len' => 'Safe\msql_field_len', - 'msql_field_name' => 'Safe\msql_field_name', - 'msql_field_seek' => 'Safe\msql_field_seek', - 'msql_field_table' => 'Safe\msql_field_table', - 'msql_field_type' => 'Safe\msql_field_type', - 'msql_free_result' => 'Safe\msql_free_result', - 'msql_pconnect' => 'Safe\msql_pconnect', - 'msql_query' => 'Safe\msql_query', - 'msql_select_db' => 'Safe\msql_select_db', - 'mysqli_get_cache_stats' => 'Safe\mysqli_get_cache_stats', - 'mysqli_get_client_stats' => 'Safe\mysqli_get_client_stats', - 'mysqlnd_ms_dump_servers' => 'Safe\mysqlnd_ms_dump_servers', - 'mysqlnd_ms_fabric_select_global' => 'Safe\mysqlnd_ms_fabric_select_global', - 'mysqlnd_ms_fabric_select_shard' => 'Safe\mysqlnd_ms_fabric_select_shard', - 'mysqlnd_ms_get_last_used_connection' => 'Safe\mysqlnd_ms_get_last_used_connection', - 'mysqlnd_qc_clear_cache' => 'Safe\mysqlnd_qc_clear_cache', - 'mysqlnd_qc_set_is_select' => 'Safe\mysqlnd_qc_set_is_select', - 'mysqlnd_qc_set_storage_handler' => 'Safe\mysqlnd_qc_set_storage_handler', + 'msg_stat_queue' => 'Safe\msg_stat_queue', 'mysql_close' => 'Safe\mysql_close', 'mysql_connect' => 'Safe\mysql_connect', 'mysql_create_db' => 'Safe\mysql_create_db', @@ -532,19 +571,18 @@ 'mysql_tablename' => 'Safe\mysql_tablename', 'mysql_thread_id' => 'Safe\mysql_thread_id', 'mysql_unbuffered_query' => 'Safe\mysql_unbuffered_query', - 'natcasesort' => 'Safe\natcasesort', - 'natsort' => 'Safe\natsort', + 'net_get_interfaces' => 'Safe\net_get_interfaces', + 'ob_clean' => 'Safe\ob_clean', 'ob_end_clean' => 'Safe\ob_end_clean', 'ob_end_flush' => 'Safe\ob_end_flush', + 'ob_flush' => 'Safe\ob_flush', 'oci_bind_array_by_name' => 'Safe\oci_bind_array_by_name', 'oci_bind_by_name' => 'Safe\oci_bind_by_name', 'oci_cancel' => 'Safe\oci_cancel', - 'oci_close' => 'Safe\oci_close', 'oci_commit' => 'Safe\oci_commit', 'oci_connect' => 'Safe\oci_connect', 'oci_define_by_name' => 'Safe\oci_define_by_name', 'oci_execute' => 'Safe\oci_execute', - 'oci_fetch_all' => 'Safe\oci_fetch_all', 'oci_field_name' => 'Safe\oci_field_name', 'oci_field_precision' => 'Safe\oci_field_precision', 'oci_field_scale' => 'Safe\oci_field_scale', @@ -557,7 +595,6 @@ 'oci_new_connect' => 'Safe\oci_new_connect', 'oci_new_cursor' => 'Safe\oci_new_cursor', 'oci_new_descriptor' => 'Safe\oci_new_descriptor', - 'oci_num_fields' => 'Safe\oci_num_fields', 'oci_num_rows' => 'Safe\oci_num_rows', 'oci_parse' => 'Safe\oci_parse', 'oci_pconnect' => 'Safe\oci_pconnect', @@ -572,6 +609,7 @@ 'oci_set_edition' => 'Safe\oci_set_edition', 'oci_set_module_name' => 'Safe\oci_set_module_name', 'oci_set_prefetch' => 'Safe\oci_set_prefetch', + 'oci_set_prefetch_lob' => 'Safe\oci_set_prefetch_lob', 'oci_statement_type' => 'Safe\oci_statement_type', 'oci_unregister_taf_callback' => 'Safe\oci_unregister_taf_callback', 'odbc_autocommit' => 'Safe\odbc_autocommit', @@ -579,6 +617,8 @@ 'odbc_columnprivileges' => 'Safe\odbc_columnprivileges', 'odbc_columns' => 'Safe\odbc_columns', 'odbc_commit' => 'Safe\odbc_commit', + 'odbc_connect' => 'Safe\odbc_connect', + 'odbc_cursor' => 'Safe\odbc_cursor', 'odbc_data_source' => 'Safe\odbc_data_source', 'odbc_exec' => 'Safe\odbc_exec', 'odbc_execute' => 'Safe\odbc_execute', @@ -591,8 +631,11 @@ 'odbc_foreignkeys' => 'Safe\odbc_foreignkeys', 'odbc_gettypeinfo' => 'Safe\odbc_gettypeinfo', 'odbc_longreadlen' => 'Safe\odbc_longreadlen', + 'odbc_pconnect' => 'Safe\odbc_pconnect', 'odbc_prepare' => 'Safe\odbc_prepare', 'odbc_primarykeys' => 'Safe\odbc_primarykeys', + 'odbc_procedurecolumns' => 'Safe\odbc_procedurecolumns', + 'odbc_procedures' => 'Safe\odbc_procedures', 'odbc_result' => 'Safe\odbc_result', 'odbc_result_all' => 'Safe\odbc_result_all', 'odbc_rollback' => 'Safe\odbc_rollback', @@ -606,8 +649,14 @@ 'opendir' => 'Safe\opendir', 'openlog' => 'Safe\openlog', 'openssl_cipher_iv_length' => 'Safe\openssl_cipher_iv_length', + 'openssl_cms_decrypt' => 'Safe\openssl_cms_decrypt', + 'openssl_cms_encrypt' => 'Safe\openssl_cms_encrypt', + 'openssl_cms_read' => 'Safe\openssl_cms_read', + 'openssl_cms_sign' => 'Safe\openssl_cms_sign', + 'openssl_cms_verify' => 'Safe\openssl_cms_verify', 'openssl_csr_export' => 'Safe\openssl_csr_export', 'openssl_csr_export_to_file' => 'Safe\openssl_csr_export_to_file', + 'openssl_csr_get_public_key' => 'Safe\openssl_csr_get_public_key', 'openssl_csr_get_subject' => 'Safe\openssl_csr_get_subject', 'openssl_csr_new' => 'Safe\openssl_csr_new', 'openssl_csr_sign' => 'Safe\openssl_csr_sign', @@ -615,6 +664,7 @@ 'openssl_dh_compute_key' => 'Safe\openssl_dh_compute_key', 'openssl_digest' => 'Safe\openssl_digest', 'openssl_encrypt' => 'Safe\openssl_encrypt', + 'openssl_get_curve_names' => 'Safe\openssl_get_curve_names', 'openssl_open' => 'Safe\openssl_open', 'openssl_pbkdf2' => 'Safe\openssl_pbkdf2', 'openssl_pkcs7_decrypt' => 'Safe\openssl_pkcs7_decrypt', @@ -624,6 +674,7 @@ 'openssl_pkcs12_export' => 'Safe\openssl_pkcs12_export', 'openssl_pkcs12_export_to_file' => 'Safe\openssl_pkcs12_export_to_file', 'openssl_pkcs12_read' => 'Safe\openssl_pkcs12_read', + 'openssl_pkey_derive' => 'Safe\openssl_pkey_derive', 'openssl_pkey_export' => 'Safe\openssl_pkey_export', 'openssl_pkey_export_to_file' => 'Safe\openssl_pkey_export_to_file', 'openssl_pkey_get_private' => 'Safe\openssl_pkey_get_private', @@ -636,6 +687,11 @@ 'openssl_random_pseudo_bytes' => 'Safe\openssl_random_pseudo_bytes', 'openssl_seal' => 'Safe\openssl_seal', 'openssl_sign' => 'Safe\openssl_sign', + 'openssl_spki_export' => 'Safe\openssl_spki_export', + 'openssl_spki_export_challenge' => 'Safe\openssl_spki_export_challenge', + 'openssl_spki_new' => 'Safe\openssl_spki_new', + 'openssl_spki_verify' => 'Safe\openssl_spki_verify', + 'openssl_verify' => 'Safe\openssl_verify', 'openssl_x509_export' => 'Safe\openssl_x509_export', 'openssl_x509_export_to_file' => 'Safe\openssl_x509_export_to_file', 'openssl_x509_fingerprint' => 'Safe\openssl_x509_fingerprint', @@ -646,123 +702,42 @@ 'parse_ini_file' => 'Safe\parse_ini_file', 'parse_ini_string' => 'Safe\parse_ini_string', 'parse_url' => 'Safe\parse_url', + 'passthru' => 'Safe\passthru', 'password_hash' => 'Safe\password_hash', - 'pcntl_exec' => 'Safe\pcntl_exec', 'pcntl_getpriority' => 'Safe\pcntl_getpriority', 'pcntl_setpriority' => 'Safe\pcntl_setpriority', 'pcntl_signal_dispatch' => 'Safe\pcntl_signal_dispatch', 'pcntl_sigprocmask' => 'Safe\pcntl_sigprocmask', - 'pcntl_strerror' => 'Safe\pcntl_strerror', - 'PDF_activate_item' => 'Safe\PDF_activate_item', - 'PDF_add_locallink' => 'Safe\PDF_add_locallink', - 'PDF_add_nameddest' => 'Safe\PDF_add_nameddest', - 'PDF_add_note' => 'Safe\PDF_add_note', - 'PDF_add_pdflink' => 'Safe\PDF_add_pdflink', - 'PDF_add_thumbnail' => 'Safe\PDF_add_thumbnail', - 'PDF_add_weblink' => 'Safe\PDF_add_weblink', - 'PDF_attach_file' => 'Safe\PDF_attach_file', - 'PDF_begin_layer' => 'Safe\PDF_begin_layer', - 'PDF_begin_page' => 'Safe\PDF_begin_page', - 'PDF_begin_page_ext' => 'Safe\PDF_begin_page_ext', - 'PDF_circle' => 'Safe\PDF_circle', - 'PDF_clip' => 'Safe\PDF_clip', - 'PDF_close' => 'Safe\PDF_close', - 'PDF_closepath' => 'Safe\PDF_closepath', - 'PDF_closepath_fill_stroke' => 'Safe\PDF_closepath_fill_stroke', - 'PDF_closepath_stroke' => 'Safe\PDF_closepath_stroke', - 'PDF_close_pdi' => 'Safe\PDF_close_pdi', - 'PDF_close_pdi_page' => 'Safe\PDF_close_pdi_page', - 'PDF_concat' => 'Safe\PDF_concat', - 'PDF_continue_text' => 'Safe\PDF_continue_text', - 'PDF_curveto' => 'Safe\PDF_curveto', - 'PDF_delete' => 'Safe\PDF_delete', - 'PDF_end_layer' => 'Safe\PDF_end_layer', - 'PDF_end_page' => 'Safe\PDF_end_page', - 'PDF_end_page_ext' => 'Safe\PDF_end_page_ext', - 'PDF_end_pattern' => 'Safe\PDF_end_pattern', - 'PDF_end_template' => 'Safe\PDF_end_template', - 'PDF_fill' => 'Safe\PDF_fill', - 'PDF_fill_stroke' => 'Safe\PDF_fill_stroke', - 'PDF_fit_image' => 'Safe\PDF_fit_image', - 'PDF_fit_pdi_page' => 'Safe\PDF_fit_pdi_page', - 'PDF_fit_textline' => 'Safe\PDF_fit_textline', - 'PDF_initgraphics' => 'Safe\PDF_initgraphics', - 'PDF_lineto' => 'Safe\PDF_lineto', - 'PDF_makespotcolor' => 'Safe\PDF_makespotcolor', - 'PDF_moveto' => 'Safe\PDF_moveto', - 'PDF_open_file' => 'Safe\PDF_open_file', - 'PDF_place_image' => 'Safe\PDF_place_image', - 'PDF_place_pdi_page' => 'Safe\PDF_place_pdi_page', - 'PDF_rect' => 'Safe\PDF_rect', - 'PDF_restore' => 'Safe\PDF_restore', - 'PDF_rotate' => 'Safe\PDF_rotate', - 'PDF_save' => 'Safe\PDF_save', - 'PDF_scale' => 'Safe\PDF_scale', - 'PDF_setcolor' => 'Safe\PDF_setcolor', - 'PDF_setdash' => 'Safe\PDF_setdash', - 'PDF_setdashpattern' => 'Safe\PDF_setdashpattern', - 'PDF_setflat' => 'Safe\PDF_setflat', - 'PDF_setfont' => 'Safe\PDF_setfont', - 'PDF_setgray' => 'Safe\PDF_setgray', - 'PDF_setgray_fill' => 'Safe\PDF_setgray_fill', - 'PDF_setgray_stroke' => 'Safe\PDF_setgray_stroke', - 'PDF_setlinejoin' => 'Safe\PDF_setlinejoin', - 'PDF_setlinewidth' => 'Safe\PDF_setlinewidth', - 'PDF_setmatrix' => 'Safe\PDF_setmatrix', - 'PDF_setmiterlimit' => 'Safe\PDF_setmiterlimit', - 'PDF_setrgbcolor' => 'Safe\PDF_setrgbcolor', - 'PDF_setrgbcolor_fill' => 'Safe\PDF_setrgbcolor_fill', - 'PDF_setrgbcolor_stroke' => 'Safe\PDF_setrgbcolor_stroke', - 'PDF_set_border_color' => 'Safe\PDF_set_border_color', - 'PDF_set_border_dash' => 'Safe\PDF_set_border_dash', - 'PDF_set_border_style' => 'Safe\PDF_set_border_style', - 'PDF_set_info' => 'Safe\PDF_set_info', - 'PDF_set_layer_dependency' => 'Safe\PDF_set_layer_dependency', - 'PDF_set_parameter' => 'Safe\PDF_set_parameter', - 'PDF_set_text_pos' => 'Safe\PDF_set_text_pos', - 'PDF_set_value' => 'Safe\PDF_set_value', - 'PDF_show' => 'Safe\PDF_show', - 'PDF_show_xy' => 'Safe\PDF_show_xy', - 'PDF_skew' => 'Safe\PDF_skew', - 'PDF_stroke' => 'Safe\PDF_stroke', + 'pcntl_sigtimedwait' => 'Safe\pcntl_sigtimedwait', + 'pcntl_sigwaitinfo' => 'Safe\pcntl_sigwaitinfo', + 'pfsockopen' => 'Safe\pfsockopen', 'pg_cancel_query' => 'Safe\pg_cancel_query', - 'pg_client_encoding' => 'Safe\pg_client_encoding', - 'pg_close' => 'Safe\pg_close', 'pg_connect' => 'Safe\pg_connect', 'pg_connection_reset' => 'Safe\pg_connection_reset', 'pg_convert' => 'Safe\pg_convert', 'pg_copy_from' => 'Safe\pg_copy_from', 'pg_copy_to' => 'Safe\pg_copy_to', - 'pg_dbname' => 'Safe\pg_dbname', 'pg_delete' => 'Safe\pg_delete', 'pg_end_copy' => 'Safe\pg_end_copy', 'pg_execute' => 'Safe\pg_execute', - 'pg_field_name' => 'Safe\pg_field_name', 'pg_field_table' => 'Safe\pg_field_table', - 'pg_field_type' => 'Safe\pg_field_type', 'pg_flush' => 'Safe\pg_flush', 'pg_free_result' => 'Safe\pg_free_result', - 'pg_host' => 'Safe\pg_host', 'pg_insert' => 'Safe\pg_insert', - 'pg_last_error' => 'Safe\pg_last_error', - 'pg_last_notice' => 'Safe\pg_last_notice', 'pg_last_oid' => 'Safe\pg_last_oid', 'pg_lo_close' => 'Safe\pg_lo_close', 'pg_lo_export' => 'Safe\pg_lo_export', 'pg_lo_import' => 'Safe\pg_lo_import', 'pg_lo_open' => 'Safe\pg_lo_open', 'pg_lo_read' => 'Safe\pg_lo_read', - 'pg_lo_read_all' => 'Safe\pg_lo_read_all', 'pg_lo_seek' => 'Safe\pg_lo_seek', 'pg_lo_truncate' => 'Safe\pg_lo_truncate', 'pg_lo_unlink' => 'Safe\pg_lo_unlink', 'pg_lo_write' => 'Safe\pg_lo_write', 'pg_meta_data' => 'Safe\pg_meta_data', - 'pg_options' => 'Safe\pg_options', 'pg_parameter_status' => 'Safe\pg_parameter_status', 'pg_pconnect' => 'Safe\pg_pconnect', 'pg_ping' => 'Safe\pg_ping', - 'pg_port' => 'Safe\pg_port', 'pg_prepare' => 'Safe\pg_prepare', 'pg_put_line' => 'Safe\pg_put_line', 'pg_query' => 'Safe\pg_query', @@ -770,21 +745,22 @@ 'pg_result_error_field' => 'Safe\pg_result_error_field', 'pg_result_seek' => 'Safe\pg_result_seek', 'pg_select' => 'Safe\pg_select', - 'pg_send_execute' => 'Safe\pg_send_execute', - 'pg_send_prepare' => 'Safe\pg_send_prepare', - 'pg_send_query' => 'Safe\pg_send_query', - 'pg_send_query_params' => 'Safe\pg_send_query_params', 'pg_socket' => 'Safe\pg_socket', 'pg_trace' => 'Safe\pg_trace', - 'pg_tty' => 'Safe\pg_tty', 'pg_update' => 'Safe\pg_update', - 'pg_version' => 'Safe\pg_version', 'phpcredits' => 'Safe\phpcredits', 'phpinfo' => 'Safe\phpinfo', + 'php_sapi_name' => 'Safe\php_sapi_name', 'png2wbmp' => 'Safe\png2wbmp', 'posix_access' => 'Safe\posix_access', + 'posix_getgrgid' => 'Safe\posix_getgrgid', 'posix_getgrnam' => 'Safe\posix_getgrnam', + 'posix_getgroups' => 'Safe\posix_getgroups', + 'posix_getlogin' => 'Safe\posix_getlogin', 'posix_getpgid' => 'Safe\posix_getpgid', + 'posix_getpwuid' => 'Safe\posix_getpwuid', + 'posix_getrlimit' => 'Safe\posix_getrlimit', + 'posix_getsid' => 'Safe\posix_getsid', 'posix_initgroups' => 'Safe\posix_initgroups', 'posix_kill' => 'Safe\posix_kill', 'posix_mkfifo' => 'Safe\posix_mkfifo', @@ -795,11 +771,13 @@ 'posix_setpgid' => 'Safe\posix_setpgid', 'posix_setrlimit' => 'Safe\posix_setrlimit', 'posix_setuid' => 'Safe\posix_setuid', + 'posix_times' => 'Safe\posix_times', + 'posix_uname' => 'Safe\posix_uname', + 'preg_grep' => 'Safe\preg_grep', 'preg_match' => 'Safe\preg_match', 'preg_match_all' => 'Safe\preg_match_all', 'preg_replace' => 'Safe\preg_replace', 'preg_split' => 'Safe\preg_split', - 'proc_get_status' => 'Safe\proc_get_status', 'proc_nice' => 'Safe\proc_nice', 'pspell_add_to_personal' => 'Safe\pspell_add_to_personal', 'pspell_add_to_session' => 'Safe\pspell_add_to_session', @@ -815,6 +793,7 @@ 'pspell_config_save_repl' => 'Safe\pspell_config_save_repl', 'pspell_new' => 'Safe\pspell_new', 'pspell_new_config' => 'Safe\pspell_new_config', + 'pspell_new_personal' => 'Safe\pspell_new_personal', 'pspell_save_wordlist' => 'Safe\pspell_save_wordlist', 'pspell_store_replacement' => 'Safe\pspell_store_replacement', 'ps_add_launchlink' => 'Safe\ps_add_launchlink', @@ -896,11 +875,17 @@ 'register_tick_function' => 'Safe\register_tick_function', 'rename' => 'Safe\rename', 'rewind' => 'Safe\rewind', - 'rewinddir' => 'Safe\rewinddir', 'rmdir' => 'Safe\rmdir', 'rpmaddtag' => 'Safe\rpmaddtag', 'rrd_create' => 'Safe\rrd_create', - 'rsort' => 'Safe\rsort', + 'rrd_first' => 'Safe\rrd_first', + 'rrd_graph' => 'Safe\rrd_graph', + 'rrd_info' => 'Safe\rrd_info', + 'rrd_lastupdate' => 'Safe\rrd_lastupdate', + 'rrd_restore' => 'Safe\rrd_restore', + 'rrd_tune' => 'Safe\rrd_tune', + 'rrd_update' => 'Safe\rrd_update', + 'rrd_xport' => 'Safe\rrd_xport', 'sapi_windows_cp_conv' => 'Safe\sapi_windows_cp_conv', 'sapi_windows_cp_set' => 'Safe\sapi_windows_cp_set', 'sapi_windows_generate_ctrl_event' => 'Safe\sapi_windows_generate_ctrl_event', @@ -911,19 +896,27 @@ 'sem_release' => 'Safe\sem_release', 'sem_remove' => 'Safe\sem_remove', 'session_abort' => 'Safe\session_abort', + 'session_create_id' => 'Safe\session_create_id', 'session_decode' => 'Safe\session_decode', 'session_destroy' => 'Safe\session_destroy', + 'session_encode' => 'Safe\session_encode', + 'session_id' => 'Safe\session_id', + 'session_module_name' => 'Safe\session_module_name', + 'session_name' => 'Safe\session_name', 'session_regenerate_id' => 'Safe\session_regenerate_id', 'session_reset' => 'Safe\session_reset', + 'session_save_path' => 'Safe\session_save_path', 'session_unset' => 'Safe\session_unset', 'session_write_close' => 'Safe\session_write_close', 'settype' => 'Safe\settype', 'set_include_path' => 'Safe\set_include_path', 'set_time_limit' => 'Safe\set_time_limit', 'sha1_file' => 'Safe\sha1_file', + 'shell_exec' => 'Safe\shell_exec', 'shmop_delete' => 'Safe\shmop_delete', 'shmop_read' => 'Safe\shmop_read', - 'shmop_write' => 'Safe\shmop_write', + 'shm_attach' => 'Safe\shm_attach', + 'shm_detach' => 'Safe\shm_detach', 'shm_put_var' => 'Safe\shm_put_var', 'shm_remove' => 'Safe\shm_remove', 'shm_remove_var' => 'Safe\shm_remove_var', @@ -935,6 +928,7 @@ 'socket_accept' => 'Safe\socket_accept', 'socket_addrinfo_bind' => 'Safe\socket_addrinfo_bind', 'socket_addrinfo_connect' => 'Safe\socket_addrinfo_connect', + 'socket_addrinfo_lookup' => 'Safe\socket_addrinfo_lookup', 'socket_bind' => 'Safe\socket_bind', 'socket_connect' => 'Safe\socket_connect', 'socket_create' => 'Safe\socket_create', @@ -958,12 +952,21 @@ 'socket_wsaprotocol_info_export' => 'Safe\socket_wsaprotocol_info_export', 'socket_wsaprotocol_info_import' => 'Safe\socket_wsaprotocol_info_import', 'socket_wsaprotocol_info_release' => 'Safe\socket_wsaprotocol_info_release', - 'sodium_crypto_pwhash' => 'Safe\sodium_crypto_pwhash', - 'sodium_crypto_pwhash_str' => 'Safe\sodium_crypto_pwhash_str', + 'sodium_crypto_aead_aes256gcm_decrypt' => 'Safe\sodium_crypto_aead_aes256gcm_decrypt', + 'sodium_crypto_aead_chacha20poly1305_decrypt' => 'Safe\sodium_crypto_aead_chacha20poly1305_decrypt', + 'sodium_crypto_aead_chacha20poly1305_encrypt' => 'Safe\sodium_crypto_aead_chacha20poly1305_encrypt', + 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => 'Safe\sodium_crypto_aead_chacha20poly1305_ietf_decrypt', + 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt' => 'Safe\sodium_crypto_aead_chacha20poly1305_ietf_encrypt', + 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt' => 'Safe\sodium_crypto_aead_xchacha20poly1305_ietf_decrypt', + 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt' => 'Safe\sodium_crypto_aead_xchacha20poly1305_ietf_encrypt', + 'sodium_crypto_auth_verify' => 'Safe\sodium_crypto_auth_verify', + 'sodium_crypto_box_open' => 'Safe\sodium_crypto_box_open', + 'sodium_crypto_box_seal_open' => 'Safe\sodium_crypto_box_seal_open', + 'sodium_crypto_generichash_update' => 'Safe\sodium_crypto_generichash_update', + 'sodium_crypto_secretbox_open' => 'Safe\sodium_crypto_secretbox_open', + 'sodium_crypto_sign_open' => 'Safe\sodium_crypto_sign_open', + 'sodium_crypto_sign_verify_detached' => 'Safe\sodium_crypto_sign_verify_detached', 'solr_get_version' => 'Safe\solr_get_version', - 'sort' => 'Safe\sort', - 'soundex' => 'Safe\soundex', - 'spl_autoload_register' => 'Safe\spl_autoload_register', 'spl_autoload_unregister' => 'Safe\spl_autoload_unregister', 'sprintf' => 'Safe\sprintf', 'sqlsrv_begin_transaction' => 'Safe\sqlsrv_begin_transaction', @@ -991,11 +994,14 @@ 'ssh2_connect' => 'Safe\ssh2_connect', 'ssh2_disconnect' => 'Safe\ssh2_disconnect', 'ssh2_exec' => 'Safe\ssh2_exec', + 'ssh2_forward_accept' => 'Safe\ssh2_forward_accept', + 'ssh2_forward_listen' => 'Safe\ssh2_forward_listen', 'ssh2_publickey_add' => 'Safe\ssh2_publickey_add', 'ssh2_publickey_init' => 'Safe\ssh2_publickey_init', 'ssh2_publickey_remove' => 'Safe\ssh2_publickey_remove', 'ssh2_scp_recv' => 'Safe\ssh2_scp_recv', 'ssh2_scp_send' => 'Safe\ssh2_scp_send', + 'ssh2_send_eof' => 'Safe\ssh2_send_eof', 'ssh2_sftp' => 'Safe\ssh2_sftp', 'ssh2_sftp_chmod' => 'Safe\ssh2_sftp_chmod', 'ssh2_sftp_mkdir' => 'Safe\ssh2_sftp_mkdir', @@ -1003,6 +1009,7 @@ 'ssh2_sftp_rmdir' => 'Safe\ssh2_sftp_rmdir', 'ssh2_sftp_symlink' => 'Safe\ssh2_sftp_symlink', 'ssh2_sftp_unlink' => 'Safe\ssh2_sftp_unlink', + 'ssh2_shell' => 'Safe\ssh2_shell', 'stream_context_set_params' => 'Safe\stream_context_set_params', 'stream_copy_to_stream' => 'Safe\stream_copy_to_stream', 'stream_filter_append' => 'Safe\stream_filter_append', @@ -1010,13 +1017,17 @@ 'stream_filter_register' => 'Safe\stream_filter_register', 'stream_filter_remove' => 'Safe\stream_filter_remove', 'stream_get_contents' => 'Safe\stream_get_contents', + 'stream_get_line' => 'Safe\stream_get_line', 'stream_isatty' => 'Safe\stream_isatty', 'stream_resolve_include_path' => 'Safe\stream_resolve_include_path', 'stream_set_blocking' => 'Safe\stream_set_blocking', 'stream_set_timeout' => 'Safe\stream_set_timeout', 'stream_socket_accept' => 'Safe\stream_socket_accept', 'stream_socket_client' => 'Safe\stream_socket_client', + 'stream_socket_get_name' => 'Safe\stream_socket_get_name', 'stream_socket_pair' => 'Safe\stream_socket_pair', + 'stream_socket_recvfrom' => 'Safe\stream_socket_recvfrom', + 'stream_socket_sendto' => 'Safe\stream_socket_sendto', 'stream_socket_server' => 'Safe\stream_socket_server', 'stream_socket_shutdown' => 'Safe\stream_socket_shutdown', 'stream_supports_lock' => 'Safe\stream_supports_lock', @@ -1025,7 +1036,6 @@ 'stream_wrapper_unregister' => 'Safe\stream_wrapper_unregister', 'strptime' => 'Safe\strptime', 'strtotime' => 'Safe\strtotime', - 'substr' => 'Safe\substr', 'swoole_async_write' => 'Safe\swoole_async_write', 'swoole_async_writefile' => 'Safe\swoole_async_writefile', 'swoole_event_defer' => 'Safe\swoole_event_defer', @@ -1034,19 +1044,20 @@ 'symlink' => 'Safe\symlink', 'syslog' => 'Safe\syslog', 'system' => 'Safe\system', + 'sys_getloadavg' => 'Safe\sys_getloadavg', 'tempnam' => 'Safe\tempnam', 'timezone_name_from_abbr' => 'Safe\timezone_name_from_abbr', 'time_nanosleep' => 'Safe\time_nanosleep', 'time_sleep_until' => 'Safe\time_sleep_until', 'tmpfile' => 'Safe\tmpfile', 'touch' => 'Safe\touch', - 'uasort' => 'Safe\uasort', - 'uksort' => 'Safe\uksort', + 'unixtojd' => 'Safe\unixtojd', 'unlink' => 'Safe\unlink', 'unpack' => 'Safe\unpack', 'uopz_extend' => 'Safe\uopz_extend', 'uopz_implement' => 'Safe\uopz_implement', - 'usort' => 'Safe\usort', + 'variant_date_to_timestamp' => 'Safe\variant_date_to_timestamp', + 'variant_round' => 'Safe\variant_round', 'virtual' => 'Safe\virtual', 'vsprintf' => 'Safe\vsprintf', 'xdiff_file_bdiff' => 'Safe\xdiff_file_bdiff', @@ -1061,6 +1072,7 @@ 'xmlrpc_set_type' => 'Safe\xmlrpc_set_type', 'xml_parser_create' => 'Safe\xml_parser_create', 'xml_parser_create_ns' => 'Safe\xml_parser_create_ns', + 'xml_parser_free' => 'Safe\xml_parser_free', 'xml_set_object' => 'Safe\xml_set_object', 'yaml_parse' => 'Safe\yaml_parse', 'yaml_parse_file' => 'Safe\yaml_parse_file', @@ -1074,6 +1086,10 @@ 'yaz_search' => 'Safe\yaz_search', 'yaz_wait' => 'Safe\yaz_wait', 'zip_entry_close' => 'Safe\zip_entry_close', + 'zip_entry_compressedsize' => 'Safe\zip_entry_compressedsize', + 'zip_entry_compressionmethod' => 'Safe\zip_entry_compressionmethod', + 'zip_entry_filesize' => 'Safe\zip_entry_filesize', + 'zip_entry_name' => 'Safe\zip_entry_name', 'zip_entry_open' => 'Safe\zip_entry_open', 'zip_entry_read' => 'Safe\zip_entry_read', 'zlib_decode' => 'Safe\zlib_decode',