Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

`blueprints()` function: infinite loop

Solved by Samuele Masetto View solution

Started by Samuele Masetto 5 years ago · 5 replies · 515 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 Jerry Hunt, 4 days ago
2 76 8 hours ago
General · by pamtbaau, 13 hours ago
1 47 12 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago