laravel-nestedset icon indicating copy to clipboard operation
laravel-nestedset copied to clipboard

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

Open gregor-gabriel opened this issue 2 years ago • 0 comments

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.

gregor-gabriel avatar Jul 21 '23 13:07 gregor-gabriel