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

Some changes for compatibility with PHP 8.1 #1812

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2040871
Fix deprecated functionality: trim(): passing null to parameter #1 ($…
luigifab Oct 9, 2021
fcd55eb
Fix deprecated functionality: PDOStatement::fetch(): passing null to …
luigifab Oct 9, 2021
2ff0203
Fix deprecated functionality: str_replace(): passing null to paramete…
luigifab Oct 9, 2021
71d384e
Fix deprecated functionality: strlen(): passing null to parameter #1 …
luigifab Oct 9, 2021
ba300ae
Fix deprecated functionality: strpos(): passing null to parameter #1 …
luigifab Oct 9, 2021
d196a33
Fix deprecated functionality: strtolower(): passing null to parameter…
luigifab Oct 9, 2021
11fa00b
Fix deprecated functionality: addcslashes(): passing null to paramete…
luigifab Oct 9, 2021
c070dc9
Fix deprecated functionality: strtolower(): passing null to parameter…
luigifab Oct 9, 2021
70e19ae
Fix deprecated functionality: strtolower(): passing null to parameter…
luigifab Oct 9, 2021
b1597cf
Fix deprecated functionality: strtolower(): passing null to parameter…
luigifab Oct 9, 2021
b1950b2
Fix deprecated functionality: htmlspecialchars(): passing null to par…
luigifab Oct 9, 2021
cedc039
Fix deprecated functionality: auto_detect_line_endings is deprecated
luigifab Oct 9, 2021
a669060
Fix deprecated functionality: trim(): passing null to parameter #1 ($…
luigifab Oct 9, 2021
f53c0e3
Fix deprecated functionality: trim(): passing null to parameter #1 ($…
luigifab Oct 9, 2021
8fd3228
Fix deprecated functionality: urlencode(): Passing null to parameter …
luigifab Oct 9, 2021
7c92977
Fix deprecated functionality: preg_split(): passing null to parameter…
luigifab Oct 9, 2021
75841c2
Fix deprecated functionality: htmlspecialchars(): passing null to par…
luigifab Oct 9, 2021
aef2d26
Fix deprecated functionality: preg_match(): passing null to parameter…
luigifab Oct 9, 2021
7a4aa96
Fix deprecated functionality: explode(): passing null to parameter #2…
luigifab Oct 9, 2021
d81b47f
Fix deprecated functionality: explode(): passing null to parameter #2…
luigifab Oct 9, 2021
060654b
Fix deprecated functionality: strpos(): passing null to parameter #1 …
luigifab Oct 9, 2021
88cad3f
Fix deprecated functionality: preg_match(): passing null to parameter…
luigifab Oct 9, 2021
82ffa4c
Fix deprecated functionality: str_replace(): passing null to paramete…
luigifab Oct 9, 2021
77c582d
Fix deprecated functionality: strtotime(): passing null to parameter …
luigifab Oct 14, 2021
274f65a
Fix deprecated functionality: trim(): passing null to parameter #1 ($…
luigifab Oct 14, 2021
c2e12d5
Fix deprecated functionality: preg_match(): passing null to parameter…
luigifab Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ public static function getStoreConfig($path, $store = null)
*/
public static function getStoreConfigFlag($path, $store = null)
{
$flag = strtolower(self::getStoreConfig($path, $store));
$flag = self::getStoreConfig($path, $store);
$flag = is_string($flag) ? strtolower($flag) : $flag;
Copy link
Contributor

Choose a reason for hiding this comment

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

$flag = strtolower((string)self::getStoreConfig($path, $store));

if (!empty($flag) && 'false' !== $flag) {
return true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public function getStoreLastLoginDateTimezone()
public function getCurrentStatus()
{
$log = $this->getCustomerLog();
if ($log->getLogoutAt() ||
strtotime(now())-strtotime($log->getLastVisitAt())>Mage_Log_Model_Visitor::getOnlineMinutesInterval()*60) {
if ($log->getLogoutAt() || (!empty($log->getLastVisitAt()) &&
Copy link
Contributor

@Sdfendor Sdfendor Jan 19, 2022

Choose a reason for hiding this comment

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

This fix removes the deprecation error but introduces a bug. Up to the fix the behavior has been that strtotime(null) evaluates to false so nothing is subtracted (false = 0) from strtotime(now()) and the 2nd condition evaluates to true so 'offline' is returned. With your fix in those cases the method returns 'online'
.
Your solution displays:
image
before:
image

I fixed it by combining your check with correctly executing the subtraction:

if ($log->getLogoutAt() 
    || strtotime(now()) - (!empty($log->getLastVisitAt()) ? strtotime($log->getLastVisitAt()) : 0) > Mage_Log_Model_Visitor::getOnlineMinutesInterval() * 60) {
    return Mage::helper('customer')->__('Offline');
}

(strtotime(now()) - strtotime($log->getLastVisitAt()) > Mage_Log_Model_Visitor::getOnlineMinutesInterval() * 60))) {
return Mage::helper('customer')->__('Offline');
}
return Mage::helper('customer')->__('Online');
Expand Down
6 changes: 4 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ public function setRenderer($renderer)

protected function _getRendererByType()
{
$type = strtolower($this->getType());
$type = $this->getType();
$type = is_string($type) ? strtolower($type) : $type;
$renderers = $this->getGrid()->getColumnRenderers();

if (is_array($renderers) && isset($renderers[$type])) {
Expand Down Expand Up @@ -301,7 +302,8 @@ public function setFilter($filterClass)

protected function _getFilterByType()
{
$type = strtolower($this->getType());
$type = $this->getType();
$type = is_string($type) ? strtolower($type) : $type;
$filters = $this->getGrid()->getColumnFilters();
if (is_array($filters) && isset($filters[$type])) {
return $filters[$type];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ protected function _getHtmlId()
*/
public function getEscapedValue($index = null)
{
return htmlspecialchars($this->getValue($index));
$value = $this->getValue($index);
return is_string($value) ? htmlspecialchars($value) : $value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ public function renderHeader()
{
if (false !== $this->getColumn()->getGrid()->getSortable() && false !== $this->getColumn()->getSortable()) {
$className = 'not-sort';
$dir = strtolower($this->getColumn()->getDir());
$nDir= ($dir=='asc') ? 'desc' : 'asc';
$dir = $this->getColumn()->getDir();
$dir = is_string($dir) ? strtolower($dir) : $dir;
$nDir = ($dir == 'asc') ? 'desc' : 'asc';
if ($this->getColumn()->getDir()) {
$className = 'sort-arrow-' . $dir;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function escapeHtml($data, $allowedTags = null)
}
} else {
// process single item
if (strlen($data)) {
if (is_string($data) && (strlen($data) > 0)) {
if (is_array($allowedTags) && !empty($allowedTags)) {
$allowed = implode('|', $allowedTags);
$result = preg_replace('/<([\/\s\r\n]*)(' . $allowed . ')([\/\s\r\n]*)>/si', '##$1$2$3##', $data);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false,
}
} // split smartly, keeping words
else {
$split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, null, PREG_SPLIT_DELIM_CAPTURE);
$split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
$i = 0;
$space = '';
$spaceLen = 0;
Expand Down
18 changes: 9 additions & 9 deletions app/code/core/Mage/Core/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ public function getGroupedClassName($groupType, $classId, $groupRootNode = null)
// First - check maybe the entity class was rewritten
$className = null;
if (isset($config->rewrite->$class)) {
$className = (string)$config->rewrite->$class;
$className = trim((string) $config->rewrite->$class);
} else {
/**
* Backwards compatibility for pre-MMDB extensions.
Expand All @@ -1284,13 +1284,11 @@ public function getGroupedClassName($groupType, $classId, $groupRootNode = null)
$deprecatedNode = $config->deprecatedNode;
$configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
if (isset($configOld->rewrite->$class)) {
$className = (string) $configOld->rewrite->$class;
$className = trim((string) $configOld->rewrite->$class);
}
}
}

$className = trim($className);

// Second - if entity is not rewritten then use class prefix to form class name
if (empty($className)) {
if (!empty($config)) {
Expand All @@ -1317,7 +1315,7 @@ public function getGroupedClassName($groupType, $classId, $groupRootNode = null)
*/
public function getBlockClassName($blockType)
{
if (strpos($blockType, '/')===false) {
if (strpos($blockType, '/') === false) {
return $blockType;
}
return $this->getGroupedClassName('block', $blockType);
Expand Down Expand Up @@ -1367,11 +1365,13 @@ public function getResourceHelper($moduleName)
*/
public function getModelClassName($modelClass)
{
$modelClass = trim($modelClass);
if (strpos($modelClass, '/')===false) {
return $modelClass;
if (empty($modelClass)) {
return '';
}
if (strpos($modelClass, '/') === false) {
return trim($modelClass);
}
return $this->getGroupedClassName('model', $modelClass);
return $this->getGroupedClassName('model', trim($modelClass));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Design/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public function getSkinUrl($file = null, array $params = array())
Varien_Profiler::start(__METHOD__);

// Prevent reading files outside of the proper directory while still allowing symlinked files
if (strpos($file, '..') !== false) {
if (is_string($file) && (strpos($file, '..') !== false)) {
Mage::log(sprintf('Invalid path requested: %s (params: %s)', $file, json_encode($params)), Zend_Log::ERR);
throw new Exception('Invalid path requested.');
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Resource/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function loadToXml(Mage_Core_Model_Config $xmlConfig, $condition = null)
if ($r['scope'] !== 'default') {
continue;
}
$value = str_replace($substFrom, $substTo, $r['value']);
$value = empty($r['value']) ? $r['value'] : str_replace($substFrom, $substTo, $r['value']);
Copy link
Contributor

@Sdfendor Sdfendor Dec 13, 2021

Choose a reason for hiding this comment

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

This added empty-check must also be applied to line 121 and 150 for website and store scope, respectively.

$xmlConfig->setNode('default/' . $r['path'], $value);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Eav/Model/Attribute/Data/Multiline.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function outputValue($format = Mage_Eav_Model_Attribute_Data::OUTPUT_FORM
{
$values = $this->getEntity()->getData($this->getAttribute()->getAttributeCode());
if (!is_array($values)) {
$values = explode("\n", $values);
$values = is_string($values) ? explode("\n", $values) : [];
}
$values = array_map(array($this, '_applyOutputFilter'), $values);
switch ($format) {
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ public function getBackendTable()
if ($this->isStatic()) {
$this->_dataTable = $this->getEntityType()->getValueTablePrefix();
} else {
$backendTable = trim($this->_getData('backend_table'));
$backendTable = $this->_getData('backend_table');
$backendTable = is_string($backendTable) ? trim($backendTable) : $backendTable;
if (empty($backendTable)) {
$entityTable = array($this->getEntity()->getEntityTablePrefix(), $this->getBackendType());
$backendTable = $this->getResource()->getTable($entityTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class Mage_Eav_Model_Entity_Attribute_Backend_Time_Created extends Mage_Eav_Mode
*/
protected function _getFormat($date)
{
if (is_string($date) && preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\s\d{2,2}:\d{2,2}:\d{2,2}$#', $date)
|| preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\w{1,1}\d{2,2}:\d{2,2}:\d{2,2}[+-]\d{2,2}:\d{2,2}$#', $date)) {
if (is_string($date) && (preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\s\d{2,2}:\d{2,2}:\d{2,2}$#', $date)
|| preg_match('#^\d{4,4}-\d{2,2}-\d{2,2}\w{1,1}\d{2,2}:\d{2,2}:\d{2,2}[+-]\d{2,2}:\d{2,2}$#', $date))) {
return 'yyyy-MM-dd HH:mm:ss';
}
return null;
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Eav/Model/Entity/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ public function getValueTablePrefix()
*/
public function getEntityTablePrefix()
{
$tablePrefix = trim($this->_data['value_table_prefix']);
$tablePrefix = $this->_data['value_table_prefix'];
$tablePrefix = is_string($tablePrefix) ? trim($tablePrefix) : $tablePrefix;

if (empty($tablePrefix)) {
$tablePrefix = $this->getEntityTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php if($this->getTitle()): ?>
<?php if ($this->getTitle()): ?>
<h3><?php echo $this->getTitle() ?></h3>
<?php endif ?>
<?php if(!empty($tabs)): ?>
<?php if (!empty($tabs)): ?>
<ul id="<?php echo $this->getId() ?>" class="tabs">
<?php foreach ($tabs as $_tab): ?>
<?php if (!$this->canShowTab($_tab)): continue; endif; ?>
<li <?php if($this->getTabIsHidden($_tab)): ?> style="display:none"<?php endif ?>>
<a href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->getTabTitle($_tab)) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $_tab->getClass())) {?> notloaded<?php }?>">
<li <?php if ($this->getTabIsHidden($_tab)): ?> style="display:none"<?php endif ?>>
<a href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->getTabTitle($_tab)) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (!empty($_tab->getClass()) && preg_match('/\s?ajax\s?/', $_tab->getClass())) {?> notloaded<?php }?>">
<span><span class="changed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('The information in this tab has been changed.')) ?>"></span><span class="error" title="<?php echo Mage::helper('core')->quoteEscape($this->__('This tab contains invalid data. Please solve the problem before saving.')) ?>"></span><?php echo $this->getTabLabel($_tab); ?></span>
</a>
<div id="<?php echo $this->getTabId($_tab) ?>_content" style="display:none;"><?php echo $this->getTabContent($_tab) ?></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,19 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<!-- <?php if($this->getTitle()): ?>
<h3><?php echo $this->getTitle() ?></h3>
<?php endif ?> -->
<?php if(!empty($tabs)): ?>
<ul id="<?php echo $this->getId() ?>" class="tabs-horiz">
<?php foreach ($tabs as $_tab): ?>
<li>
<a href="<?php echo $this->getTabUrl($_tab)?>" id="<?php echo $this->getTabId($_tab) ?>" title="<?php echo $this->getTabTitle($_tab) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $this->getTabClass($_tab))) {?> notloaded<?php }?>">
<span><span class="changed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('The information in this tab has been changed.')) ?>"></span><span class="error" title="<?php echo Mage::helper('core')->quoteEscape($this->__('This tab contains invalid data. Please solve the problem before saving.')) ?>"></span><?php echo $this->getTabLabel($_tab) ?></span>
</a>
<div id="<?php echo $this->getTabId($_tab) ?>_content" style="display:none"><?php echo $this->getTabContent($_tab) ?></div>
</li>
<?php endforeach ?>
</ul>
<script type="text/javascript">

<?php echo $this->getId() ?>JsTabs = new varienTabs('<?php echo $this->getId() ?>', '<?php echo $this->getDestElementId() ?>', '<?php echo $this->getActiveTabId() ?>', <?php echo $this->getAllShadowTabs()?>);
</script>
<?php if (!empty($tabs)): ?>
<ul id="<?php echo $this->getId() ?>" class="tabs-horiz">
<?php foreach ($tabs as $tab): ?>
<li>
<a href="<?php echo $this->getTabUrl($tab) ?>" id="<?php echo $this->getTabId($tab) ?>" title="<?php echo $this->getTabTitle($tab) ?>" class="tab-item-link <?php echo $class = $this->getTabClass($tab),((!empty($class) && preg_match('/\s?ajax\s?/', $class)) ? ' notloaded' : '') ?>">
<span><span class="changed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('The information in this tab has been changed.')) ?>"></span><span class="error" title="<?php echo Mage::helper('core')->quoteEscape($this->__('This tab contains invalid data. Please solve the problem before saving.')) ?>"></span><?php echo $this->getTabLabel($tab) ?></span>
</a>
<div id="<?php echo $this->getTabId($tab) ?>_content" style="display:none"><?php echo $this->getTabContent($tab) ?></div>
</li>
<?php endforeach ?>
</ul>
<script type="text/javascript">
<?php echo $this->getId() ?>JsTabs = new varienTabs('<?php echo $this->getId() ?>', '<?php echo $this->getDestElementId() ?>', '<?php echo $this->getActiveTabId() ?>', <?php echo $this->getAllShadowTabs() ?>);
</script>
<?php endif ?>
2 changes: 1 addition & 1 deletion lib/Varien/Data/Form/Element/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function removeClass($class)
*/
protected function _escape($string)
{
return htmlspecialchars($string, ENT_COMPAT);
return is_string($string) ? htmlspecialchars($string, ENT_COMPAT) : $string;
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I'm happy with your PR mainly relying on added typechecks to avoid problems with PHP 8.1. But in this case I would like to argue that an explicit cast to string htmlspecialchars((string)$string, ENT_COMPAT) would be more appropriate to use (because we don't want to introduce parameter types here to avoid breaking things).
The method clearly escapes a string, the parameter name and the phpdoc type point in that direction. While a is_string is not taxing the check will be performed a lot of times judging by its location in Varien Lib.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest

return htmlspecialchars((string)$string, ENT_COMPAT);

}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Form/Element/Multiselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getElementHtml()

$value = $this->getValue();
if (!is_array($value)) {
$value = explode(',', $value);
$value = is_string($value) ? explode(',', $value) : [];
}

if ($values = $this->getValues()) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Io/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function streamOpen($fileName, $mode = 'w+', $chmod = 0666)
throw new Exception('Permission denied for write to ' . $this->getFilteredPath($this->_cwd));
}

if (!ini_get('auto_detect_line_endings')) {
if ((PHP_VERSION_ID < 80100) && !ini_get('auto_detect_line_endings')) {
ini_set('auto_detect_line_endings', 1);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public function getData($key='', $index=null)
$default = null;

// accept a/b/c as ['a']['b']['c']
if (strpos($key,'/')) {
if (is_string($key) && strpos($key, '/')) {
$keyArr = explode('/', $key);
$data = $this->_data;
foreach ($keyArr as $i=>$k) {
Expand Down Expand Up @@ -609,7 +609,7 @@ public function toString($format='')
} else {
preg_match_all('/\{\{([a-z0-9_]+)\}\}/is', $format, $matches);
foreach ($matches[1] as $var) {
$format = str_replace('{{'.$var.'}}', $this->getData($var), $format);
$format = str_replace('{{'.$var.'}}', (string) $this->getData($var), $format);
}
$str = $format;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Zend/Db/Adapter/Pdo/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ public function exec($sql)
*/
protected function _quote($value)
{
if (is_null($value)) {
return "''";
}
if (is_int($value) || is_float($value)) {
return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Db/Statement/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function _execute(array $params = null)
* @return mixed Array, object, or scalar depending on fetch mode.
* @throws Zend_Db_Statement_Exception
*/
public function fetch($style = null, $cursor = null, $offset = null)
public function fetch($style = null, $cursor = PDO::FETCH_ORI_NEXT, $offset = 0)
{
if ($style === null) {
$style = $this->_fetchMode;
Expand Down
5 changes: 3 additions & 2 deletions lib/Zend/Locale/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public static function getList($locale, $path, $value = false)
$val = implode('_' , $value);
}

$val = urlencode($val);
$val = is_string($val) ? urlencode($val) : $val;
$id = self::_filterCacheId('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val);

// add runtime cache to avoid calling cache backend multiple times during one request
Expand Down Expand Up @@ -998,7 +998,8 @@ public static function getContent($locale, $path, $value = false)
if (is_array($value)) {
$val = implode('_' , $value);
}
$val = urlencode($val);

$val = is_string($val) ? urlencode($val) : $val;
$id = self::_filterCacheId('Zend_LocaleC_' . $locale . '_' . $path . '_' . $val);

// add runtime cache to avoid calling cache backend multiple times during one request
Expand Down