Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Replace incorrect usages of array_key_exists when the variable … #17573

Merged

Conversation

seamuslee001
Copy link
Contributor

…is not an array with property_exists and also fix the parameter order for an implode statement

Overview

In PHP7.4 there has been a crackdown on where using array_key_exists is actually on an object not an array so I have swapped these out for property_exists and also fixed the paraemeter order on an implode which now if you don't pass the parameters in the correct order it puts out a deprecation notice

ping @eileenmcnaughton @colemanw

@civibot
Copy link

civibot bot commented Jun 10, 2020

(Standard links)

@civibot civibot bot added the master label Jun 10, 2020
@@ -175,7 +175,7 @@ public static function add(&$params) {
// Since hash was required, make sure we have a 0 value for it (CRM-1063).
// @todo - does this mean we can remove this block?
// Fixed in 1.5 by making hash optional, only do this in create mode, not update.
if ((!array_key_exists('hash', $contact) || !$contact->hash) && !$contact->id) {
if ((!property_exists($contact, 'hash') || !$contact->hash) && !$contact->id) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other option would be isset() but i feel like that might be taken care of by the other parts of the if

…is not an array with property_exists and also fix the parameter order for an implode statement
@seamuslee001 seamuslee001 force-pushed the incorrect_use_array_key_exists branch from 57ed021 to 770d8a4 Compare June 11, 2020 04:32
@seamuslee001 seamuslee001 merged commit 745e92a into civicrm:master Jun 11, 2020
@seamuslee001 seamuslee001 deleted the incorrect_use_array_key_exists branch June 11, 2020 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants