- Issue created by @joachim
- 🇨🇦Canada danrod Ottawa
@joachim What shall be the PHP equivalent of isNumericArray now? I'm looking at the documentation and I haven't found any: https://www.php.net/manual/en/ref.array.php
Any hint would be welcome.
- 🇬🇧United Kingdom joachim
It's https://www.php.net/manual/en/function.array-is-list.php.
Hmm though that insists on the array starting at 0.
We'd need to check that the arrays EntityShareUtility::isNumericArray() is checking do that too.
I suspect it's only used to check whether JSONAPI data is single- or multi-valued, so it should start at 0.
- 🇨🇦Canada danrod Ottawa
Looking at the file
src/EntityShareUtility.php
, the methodEntityShareUtility::isNumericArray()
is looking that the array is numeric and not an associative array, but this array is perfectly legal:[ 0 => ["block_content_href" => "http://drupal.10.5.1.ddev.site/admin/content/block/1"], 1 => ["block_content_href" => "http://drupal.10.5.1.ddev.site/admin/content/block/2"], ];
As you can see in the file:
modules/entity_share_client/src/Plugin/EntityShareClient/Processor/BlockFieldBlockContentImporter.php
but in the
EntityShareUtility::isNumericArray()
there is no validation to check if the array starts from 0, it just check if the index is numeric or not, so in this case it's not possible to replace it with the new PHP function unless there's a condition in place - 🇬🇧United Kingdom joachim
Ok thanks.
EntityShareUtility::isNumericArray() is only called with JSONAPI data, and IIRC that will be an array starting from 0 if it's numeric.
I'll check when I've got my local dev site in front of me again.
- First commit to issue fork.
- Merge request !119Issue #3539852: deprecate EntityShareUtility::isNumericArray → (Open) created by neerajsingh
- Merge request !122Issue #3539852: deprecate EntityShareUtility::isNumericArray → (Merged) created by joachim