craft-linkfield
craft-linkfield copied to clipboard
Craft 4: Craft debug toolbar not working with linkfield plugin installed
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
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 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.
I'm also getting the same error with the same versions as @mtwalsh.
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:
Related to #152 and #244. Hoping for a quick solution!
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 wherepayload
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...
@sebastian-lenz any updates on this?
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!
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.
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 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.
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!
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
Fixed on next craft release (https://github.com/craftcms/cms/issues/13058). @sebastian-lenz this issue can be closed.