1

while dealing with a white screen, I found a suspicious message in php_errorlog. In debugging that, I think I hit a bug. The documentation says that instead of directly reporting it, I should ask here if it is actually a bug.

  • civicrm 5.26.2
  • wordpress

In the logging, I see this line:

[22-Jun-2020 16:58:39 Europe/Amsterdam] PHP Notice:  Undefined offset: 0 in /home/user/public_html/civicrm-nw/wp-content/plugins/civicrm/civicrm/CRM/Financial/BAO/FinancialAccount.php on line 255

This is in function getFinancialAccountForFinancialTypeByRelationship; I put in some print statements and found out that it gets value 'Income Account is' in parameter $relationshipType. The line of the message uses the hard coded value instead:

$incomeAccountRelationshipID = array_search('Income Account is', $accountRelationships);

which is suspicious in itself. But the array $accountRelationships does not contain that value, which causes the message. The array appears to contain the dutch equivalents of the relationships:

LOC103 Array 
(
    [1] => Inkomsten rekening is
    [2] => Credit/Contra Revenue Account is
....more
}

I am no php programmer, so I fixed it for my site by changing the hard code value to 'Inkomsten rekening is', making the message disappear. I think the code should be changed to somethink like

$incomeAccountRelationshipID = array_search(translation_of ($relationshipType), $accountRelationships);

Is it OK to file a bug report on this?

Ruud

  • Ik vind van wel Ruud :-) (For the non-Dutch: I would say yes) – ErikH - CiviCooP Jun 23 at 8:07
  • thanks, I raised lab.civicrm.org/dev/wordpress/-/issues/61 – ruud Jun 23 at 12:59
  • should I delete this question now? – ruud Jun 23 at 13:00
  • 1
    I'd leave the question here so others can find it too in case they have the same problem. It does sound like a bug, but I think it's not because of hardcoding it's because the line before is retrieving labels instead of names. Civi has an internal machine name for each value which doesn't change, and then the label which is what you see on screen and can change. So it should be comparing to the internal name not the label. – Demerit Jun 23 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.