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

Files: 
CommentFileSizeAuthor
#6 interdiff-2172941-6.txt4.42 KBdamiankloip
#6 2172941-6-PASS.patch6.06 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 63,151 pass(es). View
#6 2172941-6-test-only-FAIL.patch4.86 KBdamiankloip
FAILED: [[SimpleTest]]: [MySQL] 63,133 pass(es), 1 fail(s), and 0 exception(s). View

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
1.11 KB
FAILED: [[SimpleTest]]: [MySQL] 59,854 pass(es), 1 fail(s), and 0 exception(s). View
3.42 KB
PASSED: [[SimpleTest]]: [MySQL] 59,889 pass(es). View

Initial patch with test-only-fail patch...

The last submitted patch, 1: 2172941-config-cast-value-loop-1-test_only-fail.patch, failed testing.

vijaycs85’s picture

Category: Task » Bug report
Priority: Normal » Major
vijaycs85’s picture

FileSize
3.77 KB
PASSED: [[SimpleTest]]: [MySQL] 59,925 pass(es). View
580 bytes
alexpott’s picture

Status: Needs review » Needs work
Issue tags: -CMI +Configuration system

The 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 a UnsupportedConfigDataTypeException. Actually looking at the name of the exception I think iUnsupportedDataTypeConfigException is better since this extends ConfigException. 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.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
4.86 KB
FAILED: [[SimpleTest]]: [MySQL] 63,133 pass(es), 1 fail(s), and 0 exception(s). View
6.06 KB
PASSED: [[SimpleTest]]: [MySQL] 63,151 pass(es). View
4.42 KB

- 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.

The last submitted patch, 6: 2172941-6-test-only-FAIL.patch, failed testing.

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

It's going to be great to get helpful error messages from CMI +1

catch’s picture

Status: Reviewed & tested by the community » Fixed

Nice change, committed pushed to 8.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.