Skip to content

Commit 0f45d97

Browse files
authored
Fix deprecation error in I18n (#71)
Utility\I18n's protected _bindTextDomain method was sometimes assigning an array key to an array element that evaluated as false. This was trigging deprecation error 'Automatic conversion of false to array is deprecated'. This modification checks whether the array element is false and explicitly converts it to an array if it is. closes #70
1 parent c124297 commit 0f45d97

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/Cake/I18n/I18n.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,27 @@ protected function _bindTextDomain($domain) {
437437
}
438438

439439
if ($translations !== false) {
440-
$this->_domains[$domain][$this->_lang][$this->category] = $translations;
440+
if ($this->_domains[$domain][$this->_lang] === false) {
441+
$this->_domains[$domain][$this->_lang] = [
442+
$this->category => $translations
443+
];
444+
} else {
445+
$this->_domains[$domain][$this->_lang][$this->category] = $translations;
446+
}
441447
$this->_noLocale = false;
442448
break 2;
443449
}
444450
}
445451
}
446452

447453
if (empty($this->_domains[$domain][$this->_lang][$this->category])) {
448-
$this->_domains[$domain][$this->_lang][$this->category] = array();
454+
if ($this->_domains[$domain][$this->_lang] === false) {
455+
$this->_domains[$domain][$this->_lang] = [
456+
$this->category => []
457+
];
458+
} else {
459+
$this->_domains[$domain][$this->_lang][$this->category] = [];
460+
}
449461
return $domain;
450462
}
451463

0 commit comments

Comments
 (0)