CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • White screen in 4.4.3 if I add the array argument to ts for extension domain
Pages: [1]

Author Topic: White screen in 4.4.3 if I add the array argument to ts for extension domain  (Read 1384 times)

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
White screen in 4.4.3 if I add the array argument to ts for extension domain
May 15, 2014, 10:07:03 am
If I include any ts call in my extension that uses the array argument I get a white screen with no error in the Apache, Drupal or CiviCRM logs. This is happening in one 4.4.3 install. I haven't yet tested it on others, instead I wanted to ask if there is a minimum version compatibility on this change?

Code: [Select]
  -          array('title' => ts('Contact Name'),
  +          array('title' => ts('Contact Name', array('domain' => 'org.civicrm.cdntaxreceipts')),

(The above causes a white screen on this install)
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
May 15, 2014, 10:35:03 am
It should be working from 4.3.x onwards.

* are you using native gettext, or default phpgettext? (native gettext requires you to define a constant in your civicrm.settings.php)
* to reproduce the issue, do I download the latest version of the extension from git/master, and patch the line of your example? do i need to go to a specific page, or is it happening when the extension is installed?
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
May 15, 2014, 12:53:41 pm
Mathieu,

This server (client's external cheap hosting) doesn't have gettext support compiled into php. We are using the default php-gettext.

I wouldn't want to ask you to take up your time testing it for me at this point because it is very likely server specific. I just tested it on one of our standard servers on 4.4.4 and it is fine.

The problem site has a multilingual database and the default language is French (Canada).
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
May 15, 2014, 02:16:22 pm
Thanks for your reply btw.

I forgot to say though that is doesn't really matter which page of our extension. Any use of that form of ts function gives the result on this server.
The example from above is in the report the extension provides at line 19 (https://github.com/jake-mw/CDNTaxReceipts/commit/ef2c95a8e1ab3c1bd06b2bd42f6e6f80478150e6#diff-edac228b91f1873c3b7b24c4af3164bfL19)

To test I checked out the last commit before Karin added the updated ts calls (https://github.com/jake-mw/CDNTaxReceipts/commit/d7363154fb0873ee2fcd3f52fd8a1e70fb9c3520) which works fine on this server. Then I add in any one ts call with the second argument and boom!

If you have any troubleshooting suggestions let me know otherwise I will be filing this issue for a later date (not needed immediately) and creating a patched version of the extension for this customer.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
May 20, 2014, 07:20:48 am
Thanks for the references, I'll try to test it on another server. It's an issue that could potentially affect a lot of people.

Btw, off-topic, but in SQL queries, while glancing one of the diffs (cdntaxreceipts.db.inc line ~ 101), you should use the following syntax:

Code: [Select]
$sql = "SELECT l.id, l.receipt_no, [...]
     FROM cdntaxreceipts_log l
     INNER JOIN cdntaxreceipts_log_contributions c ON l.id = c.receipt_id
     WHERE is_duplicate = 0 AND l.id = %1";

$params = array(
  1 => array($receipt_id, 'Positive'),
);
$dao = CRM_Core_DAO::executeQuery($sql, $params);

In your case, the $receipt_id is probably not user-submitted and low risk of sql-injection, but you never know how people can call those functions and forget to sanitize input. I find that it also helps to validate bugs, in case $receipt_id == ''.
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
May 30, 2014, 12:41:48 pm
@Lola: I should have looked into this earlier, but ends up that extension is probably indeed what was causing a white screen. Probably the host didn't have gettext enabled at all, so it was probably crashing on a "unknown function" PHP error.

I did some testing with extensions for phpgettext and filed a patch & PR for 4.4.6 here:
https://issues.civicrm.org/jira/browse/CRM-14769
https://github.com/civicrm/civicrm-core/pull/3395

If you could test, it would be much appreciated. I also found a weird bug that was affecting native gettext in some circumstances.
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
June 04, 2014, 01:46:18 pm
Hello Matthieu,

Thanks! 
I am going to test it now. I'll see how it goes and comment on the github pull request as well as here.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: White screen in 4.4.3 if I add the array argument to ts for extension domain
June 04, 2014, 02:38:19 pm
Excellent it fixes the problem reported. Thanks a lot!
I've commented on the JIRA issue and pull request. I hope this gets merged soon.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • White screen in 4.4.3 if I add the array argument to ts for extension domain

This forum was archived on 2017-11-26.