Skip to content

Commit 9db8be9

Browse files
committed
docs: add warning to $this->validate()
1 parent 0ce37d5 commit 9db8be9

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

user_guide_src/source/incoming/controllers.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ The method accepts an array of rules in the first parameter,
9090
and in the optional second parameter, an array of custom error messages to display
9191
if the items are not valid. Internally, this uses the controller's
9292
``$this->request`` instance to get the data to be validated.
93+
94+
.. warning::
95+
The ``validate()`` method uses :ref:`Validation::withRequest() <validation-withrequest>` method.
96+
It validates data from :ref:`$request->getJSON() <incomingrequest-getting-json-data>`
97+
or :ref:`$request->getRawInput() <incomingrequest-retrieving-raw-data>`
98+
or :ref:`$request->getVar() <incomingrequest-getting-data>`.
99+
Which data is used depends on the request. Remember that an attacker is free to send any request to
100+
the server.
101+
93102
The :doc:`Validation Library docs </libraries/validation>` have details on
94103
rule and message array formats, as well as available rules:
95104

user_guide_src/source/libraries/validation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ To give a labeled error message you can set up as:
276276

277277
.. literalinclude:: validation/007.php
278278

279+
.. _validation-withrequest:
280+
279281
withRequest()
280282
=============
281283

0 commit comments

Comments
 (0)