Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: FormSecret

Status Resolved
Add-on / Version Bloqs 4.2.1
Severity
EE Version 5.3.0

Jelle Dijkstra

Jan 07, 2020

after updating to this version i’m getting a php error on saving entries, and when editing/creating an entry with bloqs fields

Argument 1 passed to BoldMinded\Bloqs\Service\FormSecret::setSecret() must be an instance of BoldMinded\Bloqs\Service\int, string given, called in user/addons/bloqs/ft.bloqs.php on line 225 and defined
user/addons/bloqs/Service/FormSecret.php, line 74

#1

BoldMinded (Brian)

Jan 07, 2020

Jelle, did you try to replicate this with a brand new install of EE? I’ve tried to replicate this on two environments and can’t. This also seems like the sort of issue that I’d be getting multiple reports about, but I haven’t. Try adding this var_dump and see what it prints

Line 75 of that FormSecret file:

public function setSecret(int $fieldId)
    {
        var_dump($fieldId); die;
#2

Jelle Dijkstra

Jan 07, 2020

looks like it returns string(1) “7”

#3

Jelle Dijkstra

Jan 07, 2020

Comment has been marked private.

#4

BoldMinded (Brian)

Jan 07, 2020

Line 225 of ft.bloqs.php contains this: $secretService->setSecret($this->field_id);

Add (int) in front

$secretService->setSecret((int) $this->field_id);

See if that fixes it. I’m a little confused at why yours is a string and mine is an actual integer without having to cast it as an int, which is why I asked if you had tested this on a brand new EE install to see if another add-on is maybe messing with the field_id property.

 

#5

Jelle Dijkstra

Jan 07, 2020

Doesn’t have an effect. hoever might this not be that the license i got from EE is a string and has characters and dashes in it?

#6

BoldMinded (Brian)

Jan 07, 2020

Add-on license should have nothing to do with that error.

Adding (int) should definitely fix the error you reported, which was that the function expects an integer, and adding (int) casts a string to an int.

#7

Jelle Dijkstra

Jan 07, 2020

fyi it now returns int(7)

#8

BoldMinded (Brian)

Jan 07, 2020

If that is the case, then it should not throw that initial error you were seeing and should submit fine. Is that the case?

#9

Jelle Dijkstra

Jan 07, 2020

hmm nope…
the bloqs field shows Argument 1 passed to BoldMinded\Bloqs\Service\FormSecret::setSecret() must be an instance of BoldMinded\Bloqs\Service\int, integer given, called in user/addons/bloqs/ft.bloqs.php on line 225 and defined
user/addons/bloqs/Service/FormSecret.php, line 74

found another instance of the setfield on line 335. i changed line 335 from ft to $secretService->setFieldId((int) $this->field_id);

after save getting Error
Argument 1 passed to BoldMinded\Bloqs\Service\FormSecret::setFieldId() must be an instance of BoldMinded\Bloqs\Service\int, string given, called in user/addons/bloqs/ft.bloqs.php on line 335 and defined
user/addons/bloqs/Service/FormSecret.php, line 146

#10

BoldMinded (Brian)

Jan 07, 2020

What version of PHP are you using?

#11

BoldMinded (Brian)

Jan 07, 2020

Comment has been marked private.

#12

Jelle Dijkstra

Jan 07, 2020

quickly flipped the php version of the server and errors went away. stupid stuff but another site or 2 on that server stille depend on php 5.6. thanks for the help!

Login to reply