Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When pass an undefined typed data type (e.g resource, object etc) for a config key which has config schema, getting endless look on Config->castValue()
Proposed resolution
Fix the castValue() so that throws Exception for such case.
Remaining tasks
User interface changes
No
API changes
No
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff-2172941-6.txt | 4.42 KB | damiankloip |
#6 | 2172941-6-PASS.patch | 6.06 KB | damiankloip |
#6 | 2172941-6-test-only-FAIL.patch | 4.86 KB | damiankloip |
Comments
Comment #1
vijaycs85Initial patch with test-only-fail patch...
Comment #3
vijaycs85It is a bug and blocking a beta blocker - #2167623: Add test for all default configuration to ensure schema exists and is correct, So major.
Comment #4
vijaycs85Addressing #2167623-44: Add test for all default configuration to ensure schema exists and is correct.1 here...
Comment #5
alexpottThe test currently works because an exception is being thrown by Symfony's YAMP dumper
\Symfony\Component\Yaml\Exception\DumpException
. I think it is an improvement to move the error up to the Config class and make it independent of the Config storage layer.But I think we need to ensure that the exception thrown is consistent. So we have to decide how to do this. Config data is set through two methods - we could throw an exception in the
set()
method if the value is an unsupported data type. But we have an issue with setData(). The current patch won't throw this exception for config that does not have schema.So I think we need to add a catch in
FileStorage::encode()
for the DumpException and rethrow aUnsupportedConfigDataTypeException
. Actually looking at the name of the exception I think iUnsupportedDataTypeConfigException
is better since this extendsConfigException
. In order to test this we need to try saving to a config file that has no schema. The test should also assert that the config object has no schema just in case someone tries to implement one at a later date.Comment #6
damiankloip CreditAttribution: damiankloip commented- Renames exception
- Catches DumpException in FileStorage::write (Not in encode, so we can provide the config name).
- Added a new test for this, that has no config schema.
- Minor other changes.
Comment #8
alexpottIt's going to be great to get helpful error messages from CMI +1
Comment #9
catchNice change, committed pushed to 8.x, thanks!