putyourlightson / craft-campaign

Send and manage email campaigns, contacts and mailing lists in Craft CMS.
https://putyourlightson.com/plugins/campaign
Other
64 stars 24 forks source link

Errors in logs `Argument #1 ($mailingListId) must be of type int, string given` #440

Closed bossanova808 closed 9 months ago

bossanova808 commented 9 months ago

Hey Ben

Have recently started seeing a few of these in our logs...I don't think I've changed anything that would cause/effect this, but history also shows I can be a bit of an idiot, so maybe I have. Any clues as to what I should be looking at?

(Craft Pro 4.5.11.1/ Campaign 2.11.0)

I can see new contacts being subscribed and added to lists, so I can't find an actual functional fault to match...just these log errors.

body : putyourlightson\campaign\services\MailingListsService::getMailingListById(): Argument #1 ($mailingListId) must be of type int, string given, called in /home/forge/imagescience.com.au/releases/dev/vendor/putyourlightson/craft-campaign/src/controllers/FormsController.php on line 153
logged-via-site-php-handler : yes
function : getMailingListById
0 : 122565/zSYa/j9mxAQ/AQ/fc3b1870-d2e3-4633-a0b9-03fb9569d9a6/2/449fb6_kLI
file : /home/forge/imagescience.com.au/releases/dev/vendor/putyourlightson/craft-campaign/src/controllers/FormsController.php
line : 153
type : ->
class : putyourlightson\campaign\services\MailingListsService
function : actionVerifySubscribe
type : ->
class : putyourlightson\campaign\controllers\FormsController

With the trace:

function : getMailingListById
0 : 122565/zSYa/j9mxAQ/AQ/fc3b1870-d2e3-4633-a0b9-03fb9569d9a6/2/449fb6_kLI
file : /home/forge/imagescience.com.au/releases/dev/vendor/putyourlightson/craft-campaign/src/controllers/FormsController.php
line : 153
type : ->
class : putyourlightson\campaign\services\MailingListsService
function : actionVerifySubscribe
type : ->
class : putyourlightson\campaign\controllers\FormsController
function : call_user_func_array
line : 57
file : /home/forge/imagescience.com.au/releases/dev/vendor/yiisoft/yii2/base/InlineAction.php
function : runWithParams
mlid : 122565/zSYa/j9mxAQ/AQ/fc3b1870-d2e3-4633-a0b9-03fb9569d9a6/2/449fb6_kLI
pid : p6573a9fe3a370kqx
file : /home/forge/imagescience.com.au/releases/dev/vendor/yiisoft/yii2/base/Controller.php
line : 178
type : ->
class : yii\base\InlineAction
function : runAction
0 : verify-subscribe
mlid : 122565/zSYa/j9mxAQ/AQ/fc3b1870-d2e3-4633-a0b9-03fb9569d9a6/2/449fb6_kLI
pid : p6573a9fe3a370kqx
file : /home/forge/imagescience.com.au/releases/dev/vendor/yiisoft/yii2/base/Module.php
line : 552
type : ->
class : yii\base\Controller
bencroker commented 9 months ago

This is not a bug. If you can find the value of $_GET in the stack track then we should see a mlid value that is not an integer, which is why the request is being correctly blocked.

bossanova808 commented 9 months ago

It's actually there in the trace:

mlid : 122565/zSYa/j9mxAQ/AQ/fc3b1870-d2e3-4633-a0b9-03fb9569d9a6/2/449fb6_kLI
pid : p6573a9fe3a370kqx

And actually, the first 6 digits there are correct, so it's the other stuff on the end that is weird.

Hmmm...so the next question is...why might I be getting hits to verify-subscribe that look like that?

I've just checked a few outgoing ones in postmark and the links in those look ok - definitely nothing on the ends there: https://domain.com.au/actions/campaign/forms/verify-subscribe?pid=p6576a21c812cicix&mlid=122565

Is it just bot traffic, maybe? Seems an oddly specific bot hit though...and the pid kinda looks like it might be legit.

Obviously I can mute these, just didn't want to be missing some actual error/issue.

bencroker commented 9 months ago

I can’t say what is causing this, but you can clearly see that the value of mlid is invalid (and not an integer), so the error message is to be expected.