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

CRM-21728 Prevent intermittant fail on pcp api calls. #11606

Merged
merged 1 commit into from
Feb 7, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jan 29, 2018

Overview

Fix for fatal errors on Mac to do with loading of Pcp.php file when it gets confused about casing. Unlikely to affect live sites as does not fail on jenkins

Before

Tests pass on Mac when SyntaxConformance::singleValueAlter run in isolation

After

Tests pass on Mac when SyntaxConformance::singleValueAlter run in isolation

Technical Details

When I run the SyntaxConformance tests locally I get a fatal error because it tries
to include api_v3_pcp.php after having included api_v3_PCP.php & thinks they are 2 files.
This is a Mac so obviously the handling is different to the jenkins method. Not overwriting the
param if passed in works locally

Comments


When I run the SyntaxConformance tests locally I get a fatal error because it tries
to include api_v3_pcp.php after having included api_v3_PCP.php & thinks they are 2 files.
This is a Mac so obviously the handling is different to the jenkins method. Not overwriting the
 param if passed in works locally
@yashodha
Copy link
Contributor

@eileenmcnaughton : Does this have a related JIRA issue?

@eileenmcnaughton
Copy link
Contributor Author

@yashodha no - I'm a bit confused about the JIRA status after Matt's email - but will add one

@eileenmcnaughton eileenmcnaughton changed the title Prevent intermittant fail on pcp api calls. CRM-21728 Prevent intermittant fail on pcp api calls. Jan 30, 2018
@eileenmcnaughton
Copy link
Contributor Author

updated

@@ -1235,7 +1235,7 @@ function formatCheckBoxField(&$checkboxFieldValue, $customFieldLabel, $entity) {
* @return array
*/
function _civicrm_api3_basic_get($bao_name, $params, $returnAsSuccess = TRUE, $entity = "", $sql = NULL, $uniqueFields = FALSE) {
$entity = CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));
$entity = $entity ?: CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));
Copy link
Member

Choose a reason for hiding this comment

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

@eileenmcnaughton can you correct this to
$entity = $entity ? $entity : CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monishdeb that syntax is actually a correct variant on the tenary

"Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise."

http://php.net/manual/en/language.operators.comparison.php

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(in later php you can use var that might not be set that way which saves a lot of isset())

Copy link
Member

Choose a reason for hiding this comment

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

Ahh right, didn't know that. Thanks for explaining it to me :)

@monishdeb monishdeb merged commit 9143b42 into civicrm:master Feb 7, 2018
@monishdeb monishdeb deleted the pcp branch February 7, 2018 01:45
@eileenmcnaughton
Copy link
Contributor Author

thanks @monishdeb

@mlutfy mlutfy added this to the 4.7.31 milestone Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants