Skip to content

Commit 86c91cf

Browse files
committed
describe the behavior of the getPostGet() and getGetPost() methods in the user guide when no index is specified
1 parent b4c65a1 commit 86c91cf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

user_guide_src/source/incoming/incomingrequest.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ The methods provided by the parent classes that are available are:
339339
found `here <https://www.php.net/manual/en/filter.filters.php>`__.
340340
:param int $flags: Flags to apply. A list of flags can be found
341341
`here <https://www.php.net/manual/en/filter.filters.flags.php>`__.
342-
:returns: $_POST if no parameters supplied, otherwise the POST value if found, or null if not
342+
:returns: $_POST and $_GET combined if no parameters specified (prefer POST value on conflict),
343+
otherwise looks for POST value, if nothing found looks for GET value, if no value found returns null
343344
:rtype: mixed|null
344345

345346
This method works pretty much the same way as ``getPost()`` and ``getGet()``, only combined.
@@ -348,22 +349,29 @@ The methods provided by the parent classes that are available are:
348349

349350
.. literalinclude:: incomingrequest/032.php
350351

352+
If no index is specified, it will return both POST and GET streams combined.
353+
Although POST data will be preferred in case of name conflict.
354+
351355
.. php:method:: getGetPost([$index = null[, $filter = null[, $flags = null]]])
352356
353357
:param string $index: The name of the variable/key to look for.
354358
:param int $filter: The type of filter to apply. A list of filters can be
355359
found `here <https://www.php.net/manual/en/filter.filters.php>`__.
356360
:param int $flags: Flags to apply. A list of flags can be found
357361
`here <https://www.php.net/manual/en/filter.filters.flags.php>`__.
358-
:returns: $_POST if no parameters supplied, otherwise the POST value if found, or null if not
362+
:returns: $_GET and $_POST combined if no parameters specified (prefer GET value on conflict),
363+
otherwise looks for GET value, if nothing found looks for POST value, if no value found returns null
359364
:rtype: mixed|null
360365

361366
This method works pretty much the same way as ``getPost()`` and ``getGet()``, only combined.
362-
It will search through both POST and GET streams for data, looking first in GET, and
367+
It will search through both GET and POST streams for data, looking first in GET, and
363368
then in POST:
364369

365370
.. literalinclude:: incomingrequest/033.php
366371

372+
If no index is specified, it will return both GET and POST streams combined.
373+
Although GET data will be preferred in case of name conflict.
374+
367375
.. php:method:: getCookie([$index = null[, $filter = null[, $flags = null]]])
368376
:noindex:
369377

0 commit comments

Comments
 (0)