craft-linkfield icon indicating copy to clipboard operation
craft-linkfield copied to clipboard

Craft 4: Craft debug toolbar not working with linkfield plugin installed

Open WHITE-developer opened this issue 2 years ago • 14 comments

When you have the linkfield plugin installed the debug toolbar is not working anymore because of the following error:

Exception 'Error' with message 'Typed property lenz\craft\utils\foreignField\ForeignFieldModel::$_field must not be accessed before initialization'

in /var/www/html/vendor/sebastianlenz/linkfield/src/models/Link.php:435

Craft: 4.0.1 linkfield: 2.1.3-rc

WHITE-developer avatar May 11 '22 13:05 WHITE-developer

That's a strange error that should not be triggered as the code right in front of it should set the property $_field. Is it possible that you look at old debug data?

sebastian-lenz avatar Jul 12 '22 21:07 sebastian-lenz

@sebastian-lenz I could also do with this fix, I'm getting the same error @WHITE-developer mentioned, on Craft CMS 4.2.0.1 and 2.1.3-rc FWIW.

mtwalsh avatar Jul 27 '22 18:07 mtwalsh

I'm also getting the same error with the same versions as @mtwalsh.

smcyr avatar Aug 05 '22 15:08 smcyr

I just encountered this on Typed link field 2.1.4. Different error message, same problem. The Debug toolbar is broken when this plugin is installed. Errors:

image

image

darylknight avatar Aug 31 '22 12:08 darylknight

Related to #152 and #244. Hoping for a quick solution!

TomDeSmet avatar Nov 29 '22 10:11 TomDeSmet

This seems to be a very tricky issue. I've tried to track it down, but didn't find a way to reproduce it. However, the following two things seemed to help - although not all the time:

  • Check the lenz_linkedfield table for any strange lines where payload is not parse-able with JSON, e.g [] For example I found several lines like this one:

| 57938 | 123754 | 185 | 2 | entry | NULL | 86530 | 2 | NULL | [] | 2022-12-06 23:10:14 | 2022-12-06 23:11:31 | c6af0ed6-9c9e-48dc-b4c9-009594b9deaf |

Removing them seemed to help. Although I've tried to re-import my old database and try to re-create those entries, but never succeeded

  • The other thing that sometimes helped was to recreate the project config, either by adding fields with the LinkField field or by using craft project-config/apply

However also this approach only seemed to work some times... But another person had luck with this approach: https://github.com/craftcms/cms/issues/12010#issuecomment-1271225724

@sebastian-lenz happy to investigate further if you can give me some pointers...

dgsiegel avatar Dec 07 '22 00:12 dgsiegel

@sebastian-lenz any updates on this?

ddnetters avatar Jan 10 '23 07:01 ddnetters

Hi @sebastian-lenz I recently upgraded a Craft 3.x site to Craft 4 (currently 4.3.7.1) with Typed Link Field 2.1.5 and am running into this issue. Has there been any progress on fixing it? Thanks!

oblongd avatar Feb 07 '23 01:02 oblongd

Getting the same error. Is this plugin being actively maintained? The Craft plugin store shows 31k active installs - I'm sure most would pay $5-$10/year for regular updates and maintenance.

mightyfineyall avatar Feb 21 '23 18:02 mightyfineyall

This plugin is free and it will stay like that, there are paid plugins available in the plugin store if someone needs commercial support. This plugin is supported by the community, if you need a certain bug fixed go ahead and create a pull request.

sebastian-lenz avatar Feb 22 '23 09:02 sebastian-lenz

@sebastian-lenz while it is free, and I do understand your perspective that it's technically open source, I believe the general consensus is that if you create a plugin and keep the GitHub repository online, people expect that it is maintained by the author. I'm not aware of any other plugins where the default expectation from the author is for people to submit pull requests rather than filing issues for bugs they find.

If you don't intend to maintain this plugin personally, it may be worth updating the readme.md file to say something like "Pull requests are welcome from the community, but this plugin is not maintained by the author" so that we know what to expect rather than wondering if it's been abandoned because you haven't replied to any issues since July 2022.

I really appreciate all your work on creating this; but as it's not going to be updated, we'll be switching our sites to Hyper.

darylknight avatar Feb 22 '23 09:02 darylknight

This plugin is free and it will stay like that, there are paid plugins available in the plugin store if someone needs commercial support. This plugin is supported by the community, if you need a certain bug fixed go ahead and create a pull request.

I fully understand your position @sebastian-lenz, but it seems that none of us are able to understand this plugins as well as you do. I've offered help in my previous comment (https://github.com/sebastian-lenz/craft-linkfield/issues/225#issuecomment-1340176500), and I am happy to provide a PR, but I'd need some pointers and support from your side to be able to track this down. Thanks for your work!

dgsiegel avatar Mar 21 '23 12:03 dgsiegel

This bug can be solved by updating yiisoft/yii2-debug to 2.1.20 (see: https://github.com/yiisoft/yii2-debug/pull/461). Unfortunately, as of writing this, Craft has it version locked at ~2.1.19.0. Asked for a bump here: https://github.com/craftcms/cms/issues/13058

ddnetters avatar Apr 06 '23 13:04 ddnetters

Fixed on next craft release (https://github.com/craftcms/cms/issues/13058). @sebastian-lenz this issue can be closed.

ddnetters avatar Apr 07 '23 08:04 ddnetters