codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

Registrierung mit Notification Center und Haste schlägt fehl #202

Closed stu2019 closed 7 months ago

stu2019 commented 1 year ago

With Notification Center 1.7 installed the registration of a member in Contao 4.13.15 does not work.

The Stacktrace is:

ErrorException:
Warning: Undefined array key "username"

  at vendor/contao/core-bundle/src/Resources/contao/modules/ModuleRegistration.php:422
  at Contao\ModuleRegistration->createNewUser()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleRegistration.php:346)
  at Contao\ModuleRegistration->compile()
     (vendor/contao/core-bundle/src/Resources/contao/modules/Module.php:214)
  at Contao\Module->generate()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleRegistration.php:55)
  at Contao\ModuleRegistration->generate()
     (vendor/contao/core-bundle/src/Resources/contao/elements/ContentModule.php:98)
  at Contao\ContentModule->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:616)
  at Contao\Controller::getContentElement()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:197)
  at Contao\ModuleArticle->compile()
     (vendor/contao/core-bundle/src/Resources/contao/modules/Module.php:214)
  at Contao\Module->generate()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:70)
  at Contao\ModuleArticle->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:544)
  at Contao\Controller::getArticle()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:386)
  at Contao\Controller::getFrontendModule()
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:190)
  at Contao\PageRegular->prepare()
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:60)
  at Contao\PageRegular->getResponse()
     (vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:320)
  at Contao\FrontendIndex->renderPage()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:44)    

The log says: request.CRITICAL: Uncaught PHP Exception TypeError: "preg_match_all(): Argument #2 ($subject) must be of type string, null given" at /mnt/web524/b3/20/543420/htdocs/cms/dorf-zeitung.net/contao/vendor/codefog/contao-haste/src/StringParser.php line 85 {"exception":"[object] (TypeError(code: 0): preg_match_all(): Argument #2 ($subject) must be of type string, null given at /mnt/web524/b3/20/543420/htdocs/cms/dorf-zeitung.net/contao/vendor/codefog/contao-haste/src/StringParser.php:85)"}

qzminski commented 1 year ago

Can you post a screenshot of your registration module settings?

fritzmg commented 1 year ago

Also post your composer.json.

stu2019 commented 1 year ago

composer.json.zip

Bildschirmfoto 2023-01-30 um 10 22 25
fritzmg commented 1 year ago

This is likely an issue of terminal42/contao-mailusername, not codefog/contao-haste.

stu2019 commented 1 year ago

I removed the terminal42/contao-mailusername and also the philvdb/avatar-bundle. But the issue still occurred.

fritzmg commented 1 year ago

I am able to reproduce the issue while having

"terminal42/contao-mailusername": "^2.1",
"terminal42/notification_center": "^1.7"

installed and enabling Create a home directory in the registration module.

However, as I said, this is not an issue of codefog/contao-haste. This is an issue of terminal42/contao-mailusername, which cannot be fixed there either.

I removed the terminal42/contao-mailusername and also the philvdb/avatar-bundle. But the issue still occurred.

To fix it you need to enable the username in your registration module and not use terminal42/contao-mailusername. You can create an issue at terminal42/contao-mailusername in order to discuss a possible fix there.