@@ -226,8 +226,8 @@ class SecurityComponent extends Component {
226
226
*/
227
227
public function startup (Controller $ controller ) {
228
228
$ this ->request = $ controller ->request ;
229
- $ this ->_action = $ this ->request ->params ['action ' ];
230
- $ hasData = !empty ($ this ->request ->data );
229
+ $ this ->_action = $ controller ->request ->params ['action ' ];
230
+ $ hasData = !empty ($ controller ->request ->data );
231
231
try {
232
232
$ this ->_methodsRequired ($ controller );
233
233
$ this ->_secureRequired ($ controller );
@@ -396,7 +396,7 @@ protected function _methodsRequired(Controller $controller) {
396
396
if (is_array ($ this ->$ property ) && !empty ($ this ->$ property )) {
397
397
$ require = $ this ->$ property ;
398
398
if (in_array ($ this ->_action , $ require ) || $ this ->$ property === array ('* ' )) {
399
- if (!$ this ->request ->is ($ method )) {
399
+ if (!$ controller ->request ->is ($ method )) {
400
400
throw new SecurityException (
401
401
sprintf ('The request method must be %s ' , strtoupper ($ method ))
402
402
);
@@ -419,7 +419,7 @@ protected function _secureRequired(Controller $controller) {
419
419
$ requireSecure = $ this ->requireSecure ;
420
420
421
421
if (in_array ($ this ->_action , $ requireSecure ) || $ this ->requireSecure === array ('* ' )) {
422
- if (!$ this ->request ->is ('ssl ' )) {
422
+ if (!$ controller ->request ->is ('ssl ' )) {
423
423
throw new SecurityException (
424
424
'Request is not SSL and the action is required to be secure '
425
425
);
@@ -438,10 +438,10 @@ protected function _secureRequired(Controller $controller) {
438
438
* @deprecated 2.8.1 This feature is confusing and not useful.
439
439
*/
440
440
protected function _authRequired (Controller $ controller ) {
441
- if (is_array ($ this ->requireAuth ) && !empty ($ this ->requireAuth ) && !empty ($ this ->request ->data )) {
441
+ if (is_array ($ this ->requireAuth ) && !empty ($ this ->requireAuth ) && !empty ($ controller ->request ->data )) {
442
442
$ requireAuth = $ this ->requireAuth ;
443
443
444
- if (in_array ($ this ->request ->params ['action ' ], $ requireAuth ) || $ this ->requireAuth === array ('* ' )) {
444
+ if (in_array ($ controller ->request ->params ['action ' ], $ requireAuth ) || $ this ->requireAuth === array ('* ' )) {
445
445
if (!isset ($ controller ->request ->data ['_Token ' ])) {
446
446
throw new AuthSecurityException ('\'_Token \' was not found in request data. ' );
447
447
}
@@ -450,23 +450,23 @@ protected function _authRequired(Controller $controller) {
450
450
$ tData = $ this ->Session ->read ('_Token ' );
451
451
452
452
if (!empty ($ tData ['allowedControllers ' ]) &&
453
- !in_array ($ this ->request ->params ['controller ' ], $ tData ['allowedControllers ' ])) {
453
+ !in_array ($ controller ->request ->params ['controller ' ], $ tData ['allowedControllers ' ])) {
454
454
throw new AuthSecurityException (
455
455
sprintf (
456
456
'Controller \'%s \' was not found in allowed controllers: \'%s \'. ' ,
457
- $ this ->request ->params ['controller ' ],
457
+ $ controller ->request ->params ['controller ' ],
458
458
implode (', ' , (array )$ tData ['allowedControllers ' ])
459
459
)
460
460
);
461
461
}
462
462
if (!empty ($ tData ['allowedActions ' ]) &&
463
- !in_array ($ this ->request ->params ['action ' ], $ tData ['allowedActions ' ])
463
+ !in_array ($ controller ->request ->params ['action ' ], $ tData ['allowedActions ' ])
464
464
) {
465
465
throw new AuthSecurityException (
466
466
sprintf (
467
467
'Action \'%s::%s \' was not found in allowed actions: \'%s \'. ' ,
468
- $ this ->request ->params ['controller ' ],
469
- $ this ->request ->params ['action ' ],
468
+ $ controller ->request ->params ['controller ' ],
469
+ $ controller ->request ->params ['action ' ],
470
470
implode (', ' , (array )$ tData ['allowedActions ' ])
471
471
)
472
472
);
@@ -839,7 +839,7 @@ protected function _callback(Controller $controller, $method, $params = array())
839
839
* will be unset
840
840
*
841
841
* @param array $dataFields Fields array, containing the POST data fields
842
- * @param array $expectedFields Fields array, containing the expected fields we should have in POST
842
+ * @param array & $expectedFields Fields array, containing the expected fields we should have in POST
843
843
* @param string $intKeyMessage Message string if unexpected found in data fields indexed by int (not protected)
844
844
* @param string $stringKeyMessage Message string if tampered found in data fields indexed by string (protected)
845
845
* @return array Error messages
0 commit comments