Skip to content

Commit 0c41b00

Browse files
tacmanfranmomu
authored andcommitted
Fix passing null to abs() function at Nested::shiftRangeRL()
1 parent 60a9731 commit 0c41b00

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ a release.
2121

2222
### Fixed
2323
- Tree: Allow sorting children by a ManyToOne relation (#2492)
24+
- Tree: Fix passing `null` to `abs()` function
25+
26+
### Deprecated
27+
- Tree: Passing `null` as argument 8 to `Nested::shiftRangeRL()`
2428

2529
## [3.8.0] - 2022-07-17
2630
### Added

src/Tree/Strategy/ORM/Nested.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,18 @@ public function shiftRL(EntityManagerInterface $em, $class, $first, $delta, $roo
639639
*/
640640
public function shiftRangeRL(EntityManagerInterface $em, $class, $first, $last, $delta, $root = null, $destRoot = null, $levelDelta = null)
641641
{
642+
// @todo: Remove the following condition and assignment in the next major release and use 0 as default value for
643+
// the `$levelDelta` parameter.
644+
if (null === $levelDelta && func_num_args() >= 8) {
645+
@trigger_error(sprintf(
646+
'Passing a type different than "int" as argument 8 to "%s()" is deprecated since gedmo/doctrine-extensions'.
647+
' 3.x and will throw a "%s" error in version 4.0.',
648+
__METHOD__,
649+
\TypeError::class
650+
), E_USER_DEPRECATED);
651+
}
652+
$levelDelta = $levelDelta ?? 0;
653+
642654
$meta = $em->getClassMetadata($class);
643655
$config = $this->listener->getConfiguration($em, $class);
644656

0 commit comments

Comments
 (0)