utopia-php / utopia-php/database
`Utopia\Database\Adapter::getIntLimit()` is not enforced
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 74
- Forks
- 59
- Avg merge
- 10h 45m
- Merged PRs (30d)
- 20
Description
Each adapter must implement the getIntLimit() method, but it isn't enforced due to how we interpret $size for integer attributes.
In the case of strings, $size is pretty obvious - the length of the string. However, for integers (and before BIGINT), we just set $size = 0, so this check in createAttribute() would never actually prevent PDO from throwing the database exception:
Options to enforce int limit:
- Check values for
getIntLimit()as a filter when creating/updating documents - Get PDO error codes when size is exceeded and throw a custom
Utopia\Databaseexception
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the createAttribute() check in src/Database/Database.php at the linked lines, then trace how integer attributes currently set $size and how adapters implement getIntLimit(). Compare the two enforcement options described in the issue and define the expected behavior for create and update paths. Done means integer limits are enforced consistently without relying on an unhandled PDO database exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100