Bug #105356
closedType error in Doctrine Schema\Column::setLength argument 1 must be int
100%
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,
Updated by Garvin Hicking about 1 month ago
- Category changed from Backend API to Database API (Doctrine DBAL)
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".
Updated by Franz Holzinger about 1 month ago
This change magically fixes this issue.
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)
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
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
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
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
Updated by Garvin Hicking about 1 month ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 3db508c687ff053c50ec5a86355577254d0df934.