Project

General

Profile

Actions

Bug #105356

closed

Type error in Doctrine Schema\Column::setLength argument 1 must be int

Added by Franz Holzinger about 1 month ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2024-10-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

After the activation of an extension I get this error messsage in the backend:

Doctrine\DBAL\Schema\Column::setLength(): Argument #1 ($length) must be of type ?int, string given, called in /path/typo3_src-13.4.0/vendor/doctrine/dbal/src/Schema/Column.php on line 68

Called from TCA:

at Doctrine\DBAL\Schema\Column->setLength('10')
in /path/typo3_src-13.4.0/vendor/doctrine/dbal/src/Schema/Column.php line 68
            if (! method_exists($this, $method)) {
                throw UnknownColumnOption::new($name);
            }

            $this->$method($value);
        }

        return $this;
    }
at Doctrine\DBAL\Schema\Column->setOptions(array('length' => '10', 'default' => '', 'notnull' => true))
in /path/typo3_src-13.4.0/vendor/doctrine/dbal/src/Schema/Column.php line 55
    public function __construct(string $name, Type $type, array $options = [])
    {
        $this->_setName($name);
        $this->setType($type);
        $this->setOptions($options);
    }

    /** @param array<string, mixed> $options */
    public function setOptions(array $options): self
at Doctrine\DBAL\Schema\Column->__construct('`creditpoints_gifts`', object(Doctrine\DBAL\Types\StringType), array('length' => '10', 'default' => '', 'notnull' => true))
in /path/typo3_src-13.4.0/vendor/doctrine/dbal/src/Schema/Table.php line 266

    /** @param array<string, mixed> $options */
    public function addColumn(string $name, string $typeName, array $options = []): Column
    {
        $column = new Column($name, Type::getType($typeName), $options);

        $this->_addColumn($column);

        return $column;
at Doctrine\DBAL\Schema\Table->addColumn('`creditpoints_gifts`', 'string', array('length' => '10', 'default' => '', 'notnull' => true))
in /path/typo3_src-13.4.0/typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php line 785
            ]
        );
        break;
    }
    $tables[$tableName]->addColumn(
        $this->quote($fieldName),
        Types::STRING,
        [
            'length' => $length,

Actions #1

Updated by Garvin Hicking about 1 month ago

  • Category changed from Backend API to Database API (Doctrine DBAL)
Actions #2

Updated by Garvin Hicking about 1 month ago

  • Status changed from New to Needs Feedback

Please check your TCA for your "creditpoints_gift" definition. Set "length" to 10 instead of "10".

Actions #3

Updated by Franz Holzinger about 1 month ago

This change magically fixes this issue.

tt_products sys_products_orders TCA Modification

Actions #4

Updated by Garvin Hicking about 1 month ago

We can look into applying (int) typecasting at the appropriate places to make this a bit more "casual". Will address this in the next days and see what the others say about more relaxed TCA definition here.

(Note though that the type-safer way would be to use integers for numbers here, of course)

Actions #5

Updated by Gerrit Code Review about 1 month ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86661

Actions #6

Updated by Gerrit Code Review about 1 month ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86661

Actions #7

Updated by Gerrit Code Review about 1 month ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86661

Actions #8

Updated by Gerrit Code Review about 1 month ago

Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86630

Actions #9

Updated by Garvin Hicking about 1 month ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF