Skip to content

Empty decimal field is not treated in database driver #347

@filipbartmann

Description

@filipbartmann

Steps to reproduce the issue

Add decimal field to table and save content in own component with empty field.

Expected result

Content would be successfully saved

Actual result

Appears error "Incorrect decimal value"

System information (as much as possible)

I try it on Joomla 5.3, 5.4 and 6.0.

Additional comments

It's caused by missing next contidion in function insertObject in Mysql and Mysqli database drivers:

if (stristr($tableColumns[$k], 'decimal') !== false && $v === '') {
                continue;
}

If I add this under condition:

if (stristr($tableColumns[$k], 'int') !== false && $v === '') {
               continue;
}

then saving content on my component works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions