Skip to content

Conversation

@batopa
Copy link
Contributor

@batopa batopa commented Oct 17, 2025

After cakephp/cakephp#18973 the default values of boolean type for SQLite database are always integers 1 or 0.

It impacts the value of $default attribute passed to SqliteAdapter::parseDefaultValue() that is an integer.
As consequence of that a TypeError is thrown calling preg_match_all($pattern, $default, $matches) because the second attribute must be a string.

This PR fixes the error, returning early the $default value if isn't a string.

In addition tests have been fixed to respect the integer default values.

@batopa
Copy link
Contributor Author

batopa commented Oct 17, 2025

🤔 the prefer-lowest tests fail because the minimum version of cakephp is 5.2.5 where there aren't the last changes about default values.

I don't know if it is possible to upgrade the minimum version of cakephp to 5.2.9 or if it is a problem.

@markstory
Copy link
Member

I don't know if it is possible to upgrade the minimum version of cakephp to 5.2.9 or if it is a problem.

We can bump the min-version up.

@markstory markstory added this to the 4.x (CakePHP 5) milestone Oct 17, 2025
@batopa
Copy link
Contributor Author

batopa commented Oct 17, 2025

If I'm not wrong it's missing the dependency to cakephp/database too.

@dereuromark dereuromark merged commit 3172645 into cakephp:4.x Oct 17, 2025
14 of 15 checks passed
@dereuromark
Copy link
Member

Nice work!

@batopa batopa deleted the fix/sqliteadapter-parse-default branch October 17, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants