Skip to content

Explicitly check for $keyValues whether they are array or not#1

Merged
mavericknsk merged 1 commit intoplesk:1.12.17-pleskfrom
mlapkin:handle-key-values-explicitly
May 21, 2018
Merged

Explicitly check for $keyValues whether they are array or not#1
mavericknsk merged 1 commit intoplesk:1.12.17-pleskfrom
mlapkin:handle-key-values-explicitly

Conversation

@mlapkin
Copy link
Member

@mlapkin mlapkin commented May 21, 2018

Since PHP 7.2 count() will emit E_WARNING if its first argument isn't an array or Countable.

$numberTerms = 0;
foreach ($args as $keyPosition => $keyValues) {
$keyValuesCount = count($keyValues);
$keyValuesCount = is_array($keyValues) || (interface_exists('Countable') && $keyValues instanceof Countable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to check interface_exists('Countable') before instanceof

@mavericknsk mavericknsk merged commit b11aa8c into plesk:1.12.17-plesk May 21, 2018
@mlapkin mlapkin deleted the handle-key-values-explicitly branch May 21, 2018 10:09
sofiiakulish pushed a commit that referenced this pull request Mar 28, 2025
… ($string) of type string is deprecated; File: /opt/psa/admin/plib/vendor/plesk/zf1/library/Zend/ProgressBar/Adapter/Console.php, Line: 458
sofiiakulish pushed a commit that referenced this pull request Mar 28, 2025
sofiiakulish added a commit that referenced this pull request Mar 28, 2025
…ruction-substr-Passing-null-to-parameter-1-string-of-type-string-is-deprecated-PPP-67969

Fix PHP Deprecated Construction: substr(): Passing null to parameter #1 ($string) of type string is deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants