500 error on register with postHooks
krava77 opened this issue · 2 comments
Hello!
I have 500 error with Register snippet when I use the postHook option. It happens because $this->user
is empty but function try to get the user object parameter.
I've added checking the user value before geting parameters in row 412 of the processor if ($this->user == null)
Hope it help.
Server Log:
[10-Oct-2022 09:07:13 UTC] PHP Fatal error: Uncaught Error: Call to a member function get() on array in /www/core/components/login/processors/register.php:413 Stack trace: #0 /www/core/components/login/processors/register.php(89): LoginRegisterProcessor->checkForRegisteredRedirect() .... #17 {main} thrown in /www/core/components/login/processors/register.php on line 413
MODx 3.0.1-pl, 10.3.31-MariaDB, PHP Version 8.0.18, Login 1.9.10
This issue has been mentioned on MODX Community. There might be relevant details there:
When a post-hook snippet is executed, references to $this->user
and $this->profile
are added to the snippet properties.
Login/core/components/login/processors/register.php
Lines 355 to 356 in bcb5ec2
Login/core/components/login/model/login/loginhooks.class.php
Lines 117 to 119 in bcb5ec2
Before $snippet->process()
is called $this->user
is of type MODX\Revolution\mysql\modUser and $this->profile
of type MODX\Revolution\mysql\modUserProfile.
After $snippet->process()
they are both arrays. Why?