2.6.1 StringPrimary no longer accepts aggregate functions as argument(AVG, SUM, COUNT, MIN and MAX) #6010

Closed
opened 2026-01-22 15:24:43 +01:00 by admin · 4 comments
Owner

Originally created by @NothingWeAre on GitHub (Jul 2, 2018).

Originally assigned to: @Majkl578 on GitHub.

BC Break Report

Q A
BC Break yes
Version 2.6.1

Summary

After upgrading from 2.5.14 to 2.6.1 StringPrimary no longer accepts aggregate functions as argument(AVG, SUM, COUNT, MIN and MAX).
Which affects any functions depending on StringPrimary, for example CONCAT

Previous behavior

CONCAT(teable.field1, MAX(table.field2)) => '{text from field1}{maximum value of field2}'

Current behavior

CONCAT(teable.field1, MAX(table.field2)) => ERROR: Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'MAX'

How to reproduce

pass any aggregate function to CONCAT (for example) as argument

PS

Old StringPrimary function looked like:

            case Lexer::T_CASE:
            case Lexer::T_COALESCE:
            case Lexer::T_NULLIF:
                return $this->CaseExpression();

            default:
                if ($this->isAggregateFunction($lookaheadType)) {
                    return $this->AggregateExpression();
                }
        }
        $this->syntaxError(
            'StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression'
        );

while new one missing part responsible for accepting aggregate expressions:

            case Lexer::T_CASE:
            case Lexer::T_COALESCE:
            case Lexer::T_NULLIF:
                return $this->CaseExpression();
        }
        $this->syntaxError(
            'StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression'
        );

Creating this as separate issue from #7205, because this concerns any function relient on StringPrimary

Originally created by @NothingWeAre on GitHub (Jul 2, 2018). Originally assigned to: @Majkl578 on GitHub. <!-- Before reporting a BC break, please consult the upgrading document to make sure it's not an expected change: https://github.com/doctrine/doctrine2/blob/master/UPGRADE.md --> ### BC Break Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes | Version | 2.6.1 #### Summary <!-- Provide a summary describing the problem you are experiencing. --> After upgrading from 2.5.14 to 2.6.1 StringPrimary no longer accepts aggregate functions as argument(AVG, SUM, COUNT, MIN and MAX). Which affects any functions depending on StringPrimary, for example CONCAT #### Previous behavior `CONCAT(teable.field1, MAX(table.field2))` => '{text from field1}{maximum value of field2}' #### Current behavior `CONCAT(teable.field1, MAX(table.field2))` => ERROR: Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'MAX' #### How to reproduce pass any aggregate function to CONCAT (for example) as argument #### PS Old `StringPrimary` function looked like: ``` case Lexer::T_CASE: case Lexer::T_COALESCE: case Lexer::T_NULLIF: return $this->CaseExpression(); default: if ($this->isAggregateFunction($lookaheadType)) { return $this->AggregateExpression(); } } $this->syntaxError( 'StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression' ); ``` while new one missing part responsible for accepting aggregate expressions: ``` case Lexer::T_CASE: case Lexer::T_COALESCE: case Lexer::T_NULLIF: return $this->CaseExpression(); } $this->syntaxError( 'StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression' ); ``` Creating this as separate issue from #7205, because this concerns any function relient on StringPrimary
admin added the BugBC BreakDQL labels 2026-01-22 15:24:43 +01:00
admin closed this issue 2026-01-22 15:24:43 +01:00
Author
Owner

@stof commented on GitHub (Jul 2, 2018):

866418e40f (diff-3aff39fbb5b16ba9be6df33f2fcde380) is the culprit

@stof commented on GitHub (Jul 2, 2018): https://github.com/doctrine/doctrine2/commit/866418e40f38e33f2c5dcf16ab9bccd3cdffa563#diff-3aff39fbb5b16ba9be6df33f2fcde380 is the culprit
Author
Owner

@NothingWeAre commented on GitHub (Jul 2, 2018):

I can make pull request, but should we use old approach

            default:
                if ($this->isAggregateFunction($lookaheadType)) {
                    return $this->AggregateExpression();
                }

or specify each concerned type inside StringPrimary

            case Lexer::T_COUNT:
            case Lexer::T_AVG:
            case Lexer::T_MIN:
            case Lexer::T_MAX:
            case Lexer::T_SUM:
                return $this->AggregateExpression();
@NothingWeAre commented on GitHub (Jul 2, 2018): I can make pull request, but should we use old approach ``` default: if ($this->isAggregateFunction($lookaheadType)) { return $this->AggregateExpression(); } ``` or specify each concerned type inside StringPrimary ``` case Lexer::T_COUNT: case Lexer::T_AVG: case Lexer::T_MIN: case Lexer::T_MAX: case Lexer::T_SUM: return $this->AggregateExpression(); ```
Author
Owner

@Majkl578 commented on GitHub (Jul 4, 2018):

#7296

@Majkl578 commented on GitHub (Jul 4, 2018): #7296
Author
Owner

@Majkl578 commented on GitHub (Jul 10, 2018):

Fixed via #7296 (for 2.6.2).

@Majkl578 commented on GitHub (Jul 10, 2018): Fixed via #7296 (for 2.6.2).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6010