Skip to content

respect DB restrictions on number of arguments in statements and queries - #25036

Merged
blizzz merged 3 commits into
masterfrom
fix/noid/limitied-allowed-items-db-in_2
Jan 14, 2021
Merged

respect DB restrictions on number of arguments in statements and queries#25036
blizzz merged 3 commits into
masterfrom
fix/noid/limitied-allowed-items-db-in_2

Conversation

@blizzz

Copy link
Copy Markdown
Member

Follow up of #25020

Additionally to what was stated before:

  • in the relevant LDAP issue run the query before there are too many parameters
  • the query builder logs when there are too many parameters in total per statement (by array type parameter)

@blizzz

Copy link
Copy Markdown
MemberAuthor

/backport to stable20

@blizzz

Copy link
Copy Markdown
MemberAuthor

/backport to stable19

@blizzz

Copy link
Copy Markdown
MemberAuthor

might lead to a small conflict with #24948 (execute method in our QueryBuilder), but nothing dramatic.

Comment threadlib/private/DB/QueryBuilder/QueryBuilder.php Outdated
Comment threadapps/user_ldap/lib/Mapping/AbstractMapping.php Outdated
@rullzerrullzer mentioned this pull request Jan 8, 2021
5 tasks
@blizzz
blizzzforce-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from 36ed317 to e7c2cd8CompareJanuary 8, 2021 17:57
@blizzz

Copy link
Copy Markdown
MemberAuthor

rebased and adjusted to the dbal bump.

@blizzz
blizzzforce-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from e7c2cd8 to ef28844CompareJanuary 8, 2021 18:05
@rullzerrullzer mentioned this pull request Jan 11, 2021
14 tasks
@MorrisJobke

Copy link
Copy Markdown
Member

Postgres says "no".

@blizzz

blizzz commented Jan 11, 2021

Copy link
Copy Markdown
MemberAuthor

Postgres says "no".

aye. seems to be a form of off-by-1

But confirms the test is working 🚀

@blizzz
blizzzforce-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from ef28844 to 90005a6CompareJanuary 11, 2021 10:31
@blizzzblizzz added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jan 11, 2021
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz
blizzzforce-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from 90005a6 to f9484d1CompareJanuary 11, 2021 12:43
@blizzzblizzz added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 11, 2021
@blizzz

Copy link
Copy Markdown
MemberAuthor

Postgres says "no".

Not anymore 🧑‍🔧

$slice++;
$fdnsSlice = array_slice($fdns, $sliceSize * ($slice - 1), $sliceSize);

if (!isset($qb)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psalm:

TypeDoesNotContainType: Cannot resolve types for $qb with type OCP\DB\QueryBuilder\IQueryBuilder and !isset assertion

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurs to me that Psalm does not understand the unset(), or am I wrong?

@blizzzblizzzJan 12, 2021

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@rullzerrullzer mentioned this pull request Jan 14, 2021
15 tasks

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has tests, so what could go wrong 👍

FYI https://www.php.net/manual/en/function.array-chunk.php seems a tad more elegant than manual slicing, but the result is the same

@blizzz

Copy link
Copy Markdown
MemberAuthor

Has tests, so what could go wrong +1

FYI https://www.php.net/manual/en/function.array-chunk.php seems a tad more elegant than manual slicing, but the result is the same

would have a bigger memory footprint as it would return all slices at once.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbugfeature: ldap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@blizzz@MorrisJobke@rullzer@nickvergessen@ChristophWurst