Skip to content

Code runs in SQL error for height = 0 in QueryBuilder::columnPatch(...) #587

Open
@gregor-gabriel

Description

@gregor-gabriel

https://github.com/lazychaser/laravel-nestedset/blob/2d5c99fe1bfbaa4004f8d6fb24475f7ff88bb526/src/QueryBuilder.php#L643C11-L643C14

In line 638 there is function columnPatch(...)

    protected function columnPatch($col, array $params)
    {
        extract($params);

        /** @var int $height */
        if ($height > 0) $height = '+'.$height;
        ...

checks $height > 0 but it should check $height >= 0

otherwise it generates an invalid SQL snippet if $cut is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions