From 378a029d0cc7ea6acb853751e7592873584a4aac Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 22 Oct 2022 11:22:13 +0200 Subject: [PATCH] BUGFIX #3885 Node::countChildNodes($nodeTypeConstraints) filter doesn't work `findChildNodes` is corrently implemented, but `countChildNodes` doesnt transform the argument $nodeTypeConstraints NodeTypeConstraints to a string for the legacy api: either this snipped must be included: ```php $filter = $nodeTypeConstraints !== null ? $nodeTypeConstraints->asLegacyNodeTypeFilterString() : null; ``` or we must use `$this->findChildNodes` without that, the `NodeTypeConstraints` is passed further down, and due to lack of typesafety it fails at the last moment: ```php Argument 2 passed to Neos\Utility\Arrays::trimExplode() must be of the type string, object given, called in /tmp/neos/Development/SubContextddev/Cache/Code/Flow_Object_Classes/Neos_ContentRepository_Domain_Repository_NodeDataRepository.php on line 1127 ``` --- Neos.ContentRepository/Classes/Domain/Model/Node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Neos.ContentRepository/Classes/Domain/Model/Node.php b/Neos.ContentRepository/Classes/Domain/Model/Node.php index d1eeb5dd1c6..a19a9170483 100644 --- a/Neos.ContentRepository/Classes/Domain/Model/Node.php +++ b/Neos.ContentRepository/Classes/Domain/Model/Node.php @@ -2081,7 +2081,7 @@ public function findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null, */ public function countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null): int { - return count($this->getChildNodes($nodeTypeConstraints)); + return count($this->findChildNodes($nodeTypeConstraints)); } /**