Skip to content

Commit 086b944

Browse files
authored
Merge pull request thecodingmachine#96 from jderusse/update-doc
Update documentation
2 parents 4a8c8e5 + 224a2a3 commit 086b944

File tree

11 files changed

+129
-34
lines changed

11 files changed

+129
-34
lines changed

generated/com.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface =
8686
*
8787
* The type library name, e.g. Microsoft OLE DB ActiveX Data
8888
* Objects 1.0 Library.
89-
* @param int $case_insensitive The case_insensitive behaves in the same way as
90-
* the parameter with the same name in the define
89+
* @param bool $case_sensitive The case_sensitive behaves inversely to
90+
* the parameter $case_insensitive in the define
9191
* function.
9292
* @throws ComException
9393
*
9494
*/
95-
function com_load_typelib(string $typelib_name, bool $case_insensitive = true): void
95+
function com_load_typelib(string $typelib_name, bool $case_sensitive = true): void
9696
{
9797
error_clear_last();
98-
$result = \com_load_typelib($typelib_name, $case_insensitive);
98+
$result = \com_load_typelib($typelib_name, $case_sensitive);
9999
if ($result === false) {
100100
throw ComException::createFromPhpError();
101101
}

generated/funchand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ function forward_static_call(callable $function, ...$params)
8989
/**
9090
*
9191
*
92-
* @param callable $function The function name as a string, or an array consisting of an object and
93-
* a method.
92+
* @param callable $function The function to register.
9493
* @param mixed $params
9594
* @throws FunchandException
9695
*

generated/functionsList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@
914914
'socket_set_option',
915915
'socket_shutdown',
916916
'socket_write',
917+
'sodium_crypto_pwhash_str',
917918
'sodium_crypto_pwhash',
918919
'solr_get_version',
919920
'class_implements',
@@ -1036,6 +1037,8 @@
10361037
'xdiff_string_bpatch',
10371038
'xdiff_string_patch_binary',
10381039
'xdiff_string_patch',
1040+
'xml_parser_create_ns',
1041+
'xml_parser_create',
10391042
'xml_set_object',
10401043
'xmlrpc_set_type',
10411044
'yaml_parse_file',

generated/image.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,20 +1639,16 @@ function imagerotate($image, float $angle, int $bgd_color, int $ignore_transpare
16391639

16401640

16411641
/**
1642-
* imagesavealpha sets the flag to attempt to save
1642+
* imagesavealpha sets the flag which determines whether to retain
16431643
* full alpha channel information (as opposed to single-color transparency)
16441644
* when saving PNG images.
16451645
*
1646-
* You have to unset alphablending
1647-
* (imagealphablending($im, false)), to use it.
1648-
*
1649-
* Alpha channel is not supported by all browsers, if you have problem with
1650-
* your browser, try to load your script with an alpha channel compliant
1651-
* browser, e.g. latest Mozilla.
1646+
* Alphablending has to be disabled (imagealphablending($im, false))
1647+
* to retain the alpha-channel in the first place.
16521648
*
16531649
* @param resource $image An image resource, returned by one of the image creation functions,
16541650
* such as imagecreatetruecolor.
1655-
* @param bool $saveflag Whether to save the alpha channel or not. Default to FALSE.
1651+
* @param bool $saveflag Whether to save the alpha channel or not. Defaults to FALSE.
16561652
* @throws ImageException
16571653
*
16581654
*/

generated/mbstring.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ function mb_regex_encoding(string $encoding = null)
451451
*
452452
* This parameter is escaped by escapeshellcmd internally
453453
* to prevent command execution. escapeshellcmd prevents
454-
* command execution, but allows to add addtional parameters. For security reason,
454+
* command execution, but allows to add additional parameters. For security reason,
455455
* this parameter should be validated.
456456
*
457457
* Since escapeshellcmd is applied automatically, some characters

generated/misc.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,16 @@ function sapi_windows_cp_set(int $cp): void
110110

111111

112112
/**
113-
* If enable is omitted, the function return TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
113+
* If enable is omitted, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
114114
*
115115
* If enable is specified, the function will try to enable or disable the VT100 features of the stream stream.
116116
* If the feature has been successfully enabled (or disabled), .
117117
*
118118
* 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.
119119
*
120+
* If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal.
121+
* They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.
122+
*
120123
* @param resource $stream The stream on which the function will operate.
121124
* @param bool $enable If specified, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE).
122125
* @throws MiscException

generated/sodium.php

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,41 @@
55
use Safe\Exceptions\SodiumException;
66

77
/**
8+
* 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.
89
*
10+
* @param string $password string; The password to generate a hash for.
11+
* @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.
12+
* @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.
13+
* @return string Returns the hashed password, .
14+
*
15+
* 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
16+
* everything that's needed to verify the hash is included. This allows
17+
* the sodium_crypto_pwhash_str_verify function to verify the hash without
18+
* needing separate storage for the other parameters.
19+
* @throws SodiumException
20+
*
21+
*/
22+
function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string
23+
{
24+
error_clear_last();
25+
$result = \sodium_crypto_pwhash_str($password, $opslimit, $memlimit);
26+
if ($result === false) {
27+
throw SodiumException::createFromPhpError();
28+
}
29+
return $result;
30+
}
31+
32+
33+
/**
34+
* 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.
935
*
1036
* @param int $length integer; The length of the password hash to generate, in bytes.
1137
* @param string $password string; The password to generate a hash for.
1238
* @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.
1339
* @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.
1440
* @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.
15-
* @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_ARGON2I13, representing the Argon2id algorithm version 1.3.
16-
* @return string Returns the hashed password, .
17-
*
18-
* The used algorithm, opslimit, memlimit and salt are embedded within the hash, so
19-
* all information needed to verify the hash is included. This allows
20-
* the password_verify function to verify the hash without
21-
* needing separate storage for the salt or algorithm information.
41+
* @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.
42+
* @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.
2243
* @throws SodiumException
2344
*
2445
*/

generated/sqlsrv.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* sqlsrv_begin_transaction and before calls to
1111
* sqlsrv_rollback or sqlsrv_commit.
1212
* Explicit transactions should be started and committed or rolled back using
13-
* these functions instead of executing SQL statements that begin and committ/roll
13+
* these functions instead of executing SQL statements that begin and commit/roll
1414
* back transactions. For more information, see
1515
* SQLSRV Transactions.
1616
*
@@ -122,7 +122,7 @@ function sqlsrv_close($conn): void
122122
* is called. The transaction that is committed includes all statements that were
123123
* executed after the call to sqlsrv_begin_transaction.
124124
* Explicit transactions should be started and committed or rolled back using these
125-
* functions instead of executing SQL statements that begin and committ/roll back
125+
* functions instead of executing SQL statements that begin and commit/roll back
126126
* transactions. For more information, see
127127
* SQLSRV Transactions.
128128
*
@@ -218,7 +218,7 @@ function sqlsrv_execute($stmt): void
218218
* that alters server state, statement execution is terminated and the statement
219219
* is rolled back.
220220
*
221-
* @param resource $stmt The statment for which resources are freed.
221+
* @param resource $stmt The statement for which resources are freed.
222222
* Note that NULL is a valid parameter value. This allows the function to be
223223
* called multiple times in a script.
224224
* @throws SqlsrvException
@@ -271,7 +271,7 @@ function sqlsrv_get_field($stmt, int $fieldIndex, int $getAsType = null)
271271
* Makes the next result of the specified statement active. Results include result
272272
* sets, row counts, and output parameters.
273273
*
274-
* @param resource $stmt The statment on which the next result is being called.
274+
* @param resource $stmt The statement on which the next result is being called.
275275
* @return mixed Returns TRUE if the next result was successfully retrieved, FALSE if an error
276276
* occurred, and NULL if there are no more results to retrieve.
277277
* @throws SqlsrvException
@@ -291,7 +291,7 @@ function sqlsrv_next_result($stmt)
291291
/**
292292
* Retrieves the number of fields (columns) on a statement.
293293
*
294-
* @param resource $stmt The statment for which the number of fields is returned.
294+
* @param resource $stmt The statement for which the number of fields is returned.
295295
* sqlsrv_num_fields can be called on a statement before
296296
* or after statement execution.
297297
* @return mixed Returns the number of fields on success. Returns FALSE otherwise.
@@ -311,12 +311,12 @@ function sqlsrv_num_fields($stmt)
311311

312312
/**
313313
* Retrieves the number of rows in a result set. This function requires that the
314-
* statment resource be created with a static or keyset cursor. For more information,
314+
* statement resource be created with a static or keyset cursor. For more information,
315315
* see sqlsrv_query, sqlsrv_prepare,
316316
* or Specifying a Cursor Type and Selecting Rows
317317
* in the Microsoft SQLSRV documentation.
318318
*
319-
* @param resource $stmt The statement for which the row count is returned. The statment resource
319+
* @param resource $stmt The statement for which the row count is returned. The statement resource
320320
* must be created with a static or keyset cursor. For more information, see
321321
* sqlsrv_query, sqlsrv_prepare, or
322322
* Specifying a Cursor Type and Selecting Rows
@@ -352,7 +352,7 @@ function sqlsrv_num_rows($stmt)
352352
* array($value [, $direction [, $phpType [, $sqlType]]])
353353
*
354354
* The following table describes the elements in the array structure above:
355-
* @param array $options An array specifing query property options. The supported keys are described
355+
* @param array $options An array specifying query property options. The supported keys are described
356356
* in the following table:
357357
* @return mixed Returns a statement resource on success and FALSE if an error occurred.
358358
* @throws SqlsrvException
@@ -389,7 +389,7 @@ function sqlsrv_prepare($conn, string $sql, array $params = null, array $options
389389
* array($value [, $direction [, $phpType [, $sqlType]]])
390390
*
391391
* The following table describes the elements in the array structure above:
392-
* @param array $options An array specifing query property options. The supported keys are described
392+
* @param array $options An array specifying query property options. The supported keys are described
393393
* in the following table:
394394
* @return mixed Returns a statement resource on success and FALSE if an error occurred.
395395
* @throws SqlsrvException

generated/strings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function sha1_file(string $filename, bool $raw_output = false): string
253253
*
254254
*
255255
* G - shorter of %E and
256-
* %f.
256+
* %F.
257257
*
258258
*
259259
* o - the argument is treated as an
@@ -328,7 +328,7 @@ function sha1_file(string $filename, bool $raw_output = false): string
328328
*
329329
*
330330
* G - shorter of %E and
331-
* %f.
331+
* %F.
332332
*
333333
*
334334
* o - the argument is treated as an

generated/xml.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,76 @@
44

55
use Safe\Exceptions\XmlException;
66

7+
/**
8+
* xml_parser_create_ns creates a new XML parser
9+
* with XML namespace support and returns a resource handle referencing
10+
* it to be used by the other XML functions.
11+
*
12+
* @param string $encoding The input encoding is automatically detected, so that the
13+
* encoding parameter specifies only the output
14+
* encoding. In PHP 5.0.0 and 5.0.1, the default output charset is
15+
* ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported
16+
* encodings are ISO-8859-1, UTF-8 and
17+
* US-ASCII.
18+
* @param string $separator With a namespace aware parser tag parameters passed to the various
19+
* handler functions will consist of namespace and tag name separated by
20+
* the string specified in separator.
21+
* @return resource Returns a resource handle for the new XML parser, .
22+
* @throws XmlException
23+
*
24+
*/
25+
function xml_parser_create_ns(string $encoding = null, string $separator = ":")
26+
{
27+
error_clear_last();
28+
if ($separator !== ":") {
29+
$result = \xml_parser_create_ns($encoding, $separator);
30+
} elseif ($encoding !== null) {
31+
$result = \xml_parser_create_ns($encoding);
32+
} else {
33+
$result = \xml_parser_create_ns();
34+
}
35+
if ($result === false) {
36+
throw XmlException::createFromPhpError();
37+
}
38+
return $result;
39+
}
40+
41+
42+
/**
43+
* xml_parser_create creates a new XML parser
44+
* and returns a resource handle referencing it to be used by the
45+
* other XML functions.
46+
*
47+
* @param string $encoding The optional encoding specifies the character
48+
* encoding for the input/output in PHP 4. Starting from PHP 5, the input
49+
* encoding is automatically detected, so that the
50+
* encoding parameter specifies only the output
51+
* encoding. In PHP 4, the default output encoding is the same as the
52+
* input charset. If empty string is passed, the parser attempts to identify
53+
* which encoding the document is encoded in by looking at the heading 3 or
54+
* 4 bytes. In PHP 5.0.0 and 5.0.1, the default output charset is
55+
* ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported
56+
* encodings are ISO-8859-1, UTF-8 and
57+
* US-ASCII.
58+
* @return resource Returns a resource handle for the new XML parser, .
59+
* @throws XmlException
60+
*
61+
*/
62+
function xml_parser_create(string $encoding = null)
63+
{
64+
error_clear_last();
65+
if ($encoding !== null) {
66+
$result = \xml_parser_create($encoding);
67+
} else {
68+
$result = \xml_parser_create();
69+
}
70+
if ($result === false) {
71+
throw XmlException::createFromPhpError();
72+
}
73+
return $result;
74+
}
75+
76+
777
/**
878
* This function allows to use parser inside
979
* object. All callback functions could be set with

0 commit comments

Comments
 (0)