? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
24 Dec 2021

Code Review.

At this location $pks is an array, and you are trying to sprintf it as if it were a string, which would raise a warning/notice (see https://3v4l.org/lnOBl)

We know its going to be an array at this point as $pks = ArrayHelper::toInteger($pks); returns an array.

Ive chosen implode, but json_encode would have been just as good I guess. No one has ever seen this error in real life I doubt

In PHP 8 this would be a Warning whereas before it would be a Notice and I bet it will become a Fatal Error in later PHP versions probably... who knows...

https://3v4l.org/lnOBl

avatar PhilETaylor PhilETaylor - open - 24 Dec 2021
avatar PhilETaylor PhilETaylor - change - 24 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Dec 2021
Category Libraries
avatar wilsonge
wilsonge - comment - 29 Dec 2021

Obviously this is fine. But can I persuade you to redo this one targeting the 3.10 branch please. As it's going to be relevant there and it will be merged up.

avatar PhilETaylor
PhilETaylor - comment - 29 Dec 2021

This fix is not needed on Joomla 3 as the code is different and Joomla 3 is using $pk[0] and not the whole array of $pk like Joomla 4 does.

The line in Joomla 3 is this:

$e = new \UnexpectedValueException(sprintf('%s::publish(%s, %d, %d) empty.', get_class($this), $pks[0], $state, $userId));

avatar wilsonge wilsonge - change - 29 Dec 2021
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-12-29 23:13:47
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 29 Dec 2021
avatar wilsonge wilsonge - merge - 29 Dec 2021
avatar wilsonge
wilsonge - comment - 29 Dec 2021

Doh! I failed to read properly. Thanks!

avatar PhilETaylor
PhilETaylor - comment - 29 Dec 2021

No worries - thanks.

Add a Comment

Login with GitHub to post a comment