Closed reloxx13 closed 6 years ago
We got a similar error, from a different controller in our code, but I believe the same issue:
(1024): Undefined property: WebPagesController::$_currentUserViewVar in [local_directory]/vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php on line 81 [CORE/src/Controller/Controller.php, line 387]
our workaround, we added the property in the AppController (which our WebPagesController extends) as a public property:
`class AppController extends BaseController { use FootprintAwareTrait; public $_currentUserViewVar; ...`
We're curious to know more about what is intended to happen with this property that was previously undefined but didn't seem to pose any problems. As reloxx13 mentioned, it seems like the warning is due to a change in behavior in CakePHP release 3.6.12 :
Undefined controller properties now emit warnings when accessed. This prevents 'invalid method call on null' type errors.
Heya,
PHP Version 7.0.30-0+deb9u1 Apache/2.4.25 (Debian) Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64
just updated cakephp3 from 3.6.11 to 3.6.12 and now i get a notice after login submit.
i think it comes from this change: CakePHP 3.6.12 released cakephp/cakephp#PR12593
Cuz $this is an object(App\Controller\UsersController) in that context.
Workaround: In my UsersController i just added the property
FIX: Add this line in vendor/muffin/footprint/src/Auth/FootprintAwareTrait.php L81 to fix:
isset($this->_currentUserViewVar) && //FIX 3.6.12 notice
But i dont know where this "_currentUserViewVar" comes from or why it is not set.
EDIT: use isset and not empty in fix like ADmad did in the pr