Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

`blueprints()` function: infinite loop

Solved by Samuele Masetto View solution

Started by Samuele Masetto 5 years ago · 5 replies · 941 views
5 years ago

Hello,
in a custom plugin in Grav 1.6 I had this code:

PHP
$grav_user = $this->grav['accounts']->load('my_user');

$grav_user['login'] = 'my_user';
$grav_user['fullname'] = 'John Smith';

$data['access']['site']['login'] = true;

$grav_user->merge($data);

Now, in Grav 1.7, the call to the merge function causes a infinite loop: the problem is in function Grav\Common\User\DataUser\User->blueprints()...but I don't know why.

5 years ago

@samuele, Have you tried to use:

PHP
$grav_user->update($data);

According the code for UserData::merge():

@deprecated 1.6 Use ->update($data) instead (same but with data validation & filtering, file upload support).

and UserData::update():

// Note: $this->merge() would cause infinite loop as it calls this method.

5 years ago

Hi @pamtbaau, sorry, I had already tried using update instead of merge, but nothing changes: the browser stays frozen and then goes into timeout.

5 years ago

@samuele, In that case I would open an issue at Github.

5 years ago Solution

After rebuilding my project with a fresh Grav install, the problem has not recurred.
I close the issue on GitHub.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 39 16 hours ago
General · by Hanns Mattes, 1 week ago
0 119 1 week ago
General · by Karmalakas, 1 week ago
2 184 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 234 3 weeks ago
General · by Dima, 4 weeks ago
1 210 4 weeks ago