Changing ZF2 Core 2.4.13 /Zend/I18n/Translator/Loader/Gettext::load

class: Zend\I18n/Translator/Loader/Gettext
function: load
php version: 7.4

Last portion change …….

if ($textDomain->offsetExists(”)) {
$rawHeaders = explode(“\n”, trim($textDomain->offsetGet(”)));
foreach ($rawHeaders as $rawHeader) {
list($header, $content) = explode(‘:’, $rawHeader, 2);
if (trim(strtolower($header)) === ‘plural-forms’) {
$textDomain->setPluralRule(PluralRule::fromString($content));
}
}
$textDomain->offsetUnset(”);
}

………….. end of change ………………..

Reason to change: Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in …/Zend/I18n/Translator/Loader/Gettext.php on line 142

///////// previous code ///////////////////

if (array_key_exists(”, $textDomain)) {
$rawHeaders = explode(“\n”, trim($textDomain[”]));
foreach ($rawHeaders as $rawHeader) {
list($header, $content) = explode(‘:’, $rawHeader, 2);
if (trim(strtolower($header)) === ‘plural-forms’) {
$textDomain->setPluralRule(PluralRule::fromString($content));
}
}
unset($textDomain[”]);
}

Posted in php, zf2Tagged , , , ,