Cms: Entry Field with Slug "value" Breaks Statamic

Created on 22 Sep 2020  Â·  6Comments  Â·  Source: statamic/cms

Bug Description

Creating the field "Value" with slug "value" breaks something in the Statamic loading pipeline.

How to Reproduce

  1. Create a collection "testing" (name irrelevant)
  2. Create a single Entry in that collection
  3. Edit the blueprint of that collection to include an attribute with the name "Value" and slug "value". (I tested this with two different field types and it broke both times. Can't claim every type, but seems that way.)
  4. Add a {{ collection:testing }}{{ /collection:testing }} Antlers tag to your html
  5. Load that page, which should produce an error.

Extra Detail

Error Produced:

ArgumentCountError
Too few arguments to function Statamic\Entries\Entry::value(), 0 passed in /Users/Hermes/Sites/lloydm/vendor/statamic/cms/src/Data/AbstractAugmented.php on line 53 and exactly 1 expected

Environment

Statamic 3.0.8 Solo
Laravel 6.18.35
PHP 7.4.9
statamic/ssg dev-master

(I cannot update to 3.0.11 because of another issue (#2456) still being worked on)

augmentation bug

All 6 comments

This issue is likely caused by value being a reserved word in Statamic. These are still needing to be documented, there's an issue over here for that. https://github.com/statamic/docs/issues/236

A workaround would be to call the handle of the field something other than value and set Value as the label of the field.

A field named value doesn't need to be reserved. We can work around it.

This issue is likely caused by value being a reserved word in Statamic. These are still needing to be documented, there's an issue over here for that. statamic/docs#236

A workaround would be to call the handle of the field something other than value and set Value as the label of the field.

Hey @damcclean thank you for the quick reply. This is what I did, I was just pointing out that at no point in the process does Statamic make this clear to me as a user. If it is reserved, then don't let me set it as a slug. Alternatively, as @jasonvarga replied, if it is NOT reserved, then I believe we need to fix something. Regardless, the issue has a place until one of those two things happens.

Lloyd

All good, I reopened the issue already.

Note to self: I think the AugmentedEntry (and AbstractAugmented) class could have a list of proxyable methods rather than just checking everything. e.g. We'd want to proxy slug but not value.

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skoontastic picture skoontastic  Â·  4Comments

aerni picture aerni  Â·  3Comments

austenc picture austenc  Â·  3Comments

ReneWeCode picture ReneWeCode  Â·  3Comments

robdekort picture robdekort  Â·  3Comments